id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
151,800
|
FrodeRanders/java-vopn
|
src/main/java/org/gautelis/vopn/lang/Date.java
|
Date.validateDateFormat
|
public static boolean validateDateFormat(String date, Locale locale) {
SimpleDateFormat df;
SimpleDateFormat sdf;
java.text.ParsePosition pos;
java.util.Date dbDate;
dbDate = null;
try {
if (date == null || date.equals("")) {
return false;
}
df = (SimpleDateFormat) DateFormat.getDateInstance(
dateStyle,
locale
);
sdf = new SimpleDateFormat(df.toPattern());
pos = new java.text.ParsePosition(0);
sdf.setLenient(false);
dbDate = sdf.parse(date, pos);
return dbDate != null && dbDate.getTime() > 0L;
} catch (Exception e) {
return false;
}
}
|
java
|
public static boolean validateDateFormat(String date, Locale locale) {
SimpleDateFormat df;
SimpleDateFormat sdf;
java.text.ParsePosition pos;
java.util.Date dbDate;
dbDate = null;
try {
if (date == null || date.equals("")) {
return false;
}
df = (SimpleDateFormat) DateFormat.getDateInstance(
dateStyle,
locale
);
sdf = new SimpleDateFormat(df.toPattern());
pos = new java.text.ParsePosition(0);
sdf.setLenient(false);
dbDate = sdf.parse(date, pos);
return dbDate != null && dbDate.getTime() > 0L;
} catch (Exception e) {
return false;
}
}
|
[
"public",
"static",
"boolean",
"validateDateFormat",
"(",
"String",
"date",
",",
"Locale",
"locale",
")",
"{",
"SimpleDateFormat",
"df",
";",
"SimpleDateFormat",
"sdf",
";",
"java",
".",
"text",
".",
"ParsePosition",
"pos",
";",
"java",
".",
"util",
".",
"Date",
"dbDate",
";",
"dbDate",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"date",
"==",
"null",
"||",
"date",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"df",
"=",
"(",
"SimpleDateFormat",
")",
"DateFormat",
".",
"getDateInstance",
"(",
"dateStyle",
",",
"locale",
")",
";",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"df",
".",
"toPattern",
"(",
")",
")",
";",
"pos",
"=",
"new",
"java",
".",
"text",
".",
"ParsePosition",
"(",
"0",
")",
";",
"sdf",
".",
"setLenient",
"(",
"false",
")",
";",
"dbDate",
"=",
"sdf",
".",
"parse",
"(",
"date",
",",
"pos",
")",
";",
"return",
"dbDate",
"!=",
"null",
"&&",
"dbDate",
".",
"getTime",
"(",
")",
">",
"0L",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Validates the users inputted date value
@param date The Date in String form
@param locale Check format according to this locale
@return true if user inputted corect format, otherwise false
|
[
"Validates",
"the",
"users",
"inputted",
"date",
"value"
] |
4c7b2f90201327af4eaa3cd46b3fee68f864e5cc
|
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/Date.java#L81-L108
|
151,801
|
FrodeRanders/java-vopn
|
src/main/java/org/gautelis/vopn/lang/Date.java
|
Date.convertDate
|
public static java.sql.Date convertDate(String date, Locale locale) {
SimpleDateFormat df;
java.util.Date dbDate = null;
java.sql.Date sqldate = null;
try {
if (date == null || date.equals("")) {
return null;
}
df = (SimpleDateFormat) DateFormat.getDateInstance(dateStyle, locale);
SimpleDateFormat sdf = new SimpleDateFormat(df.toPattern());
java.text.ParsePosition pos = new java.text.ParsePosition(0);
sdf.setLenient(false);
dbDate = sdf.parse(date, pos);
return new java.sql.Date(dbDate.getTime());
} catch (Exception e) {
return null;
}
}
|
java
|
public static java.sql.Date convertDate(String date, Locale locale) {
SimpleDateFormat df;
java.util.Date dbDate = null;
java.sql.Date sqldate = null;
try {
if (date == null || date.equals("")) {
return null;
}
df = (SimpleDateFormat) DateFormat.getDateInstance(dateStyle, locale);
SimpleDateFormat sdf = new SimpleDateFormat(df.toPattern());
java.text.ParsePosition pos = new java.text.ParsePosition(0);
sdf.setLenient(false);
dbDate = sdf.parse(date, pos);
return new java.sql.Date(dbDate.getTime());
} catch (Exception e) {
return null;
}
}
|
[
"public",
"static",
"java",
".",
"sql",
".",
"Date",
"convertDate",
"(",
"String",
"date",
",",
"Locale",
"locale",
")",
"{",
"SimpleDateFormat",
"df",
";",
"java",
".",
"util",
".",
"Date",
"dbDate",
"=",
"null",
";",
"java",
".",
"sql",
".",
"Date",
"sqldate",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"date",
"==",
"null",
"||",
"date",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"null",
";",
"}",
"df",
"=",
"(",
"SimpleDateFormat",
")",
"DateFormat",
".",
"getDateInstance",
"(",
"dateStyle",
",",
"locale",
")",
";",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"df",
".",
"toPattern",
"(",
")",
")",
";",
"java",
".",
"text",
".",
"ParsePosition",
"pos",
"=",
"new",
"java",
".",
"text",
".",
"ParsePosition",
"(",
"0",
")",
";",
"sdf",
".",
"setLenient",
"(",
"false",
")",
";",
"dbDate",
"=",
"sdf",
".",
"parse",
"(",
"date",
",",
"pos",
")",
";",
"return",
"new",
"java",
".",
"sql",
".",
"Date",
"(",
"dbDate",
".",
"getTime",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Converts the users input date value to java.sql.Date
@param date Date to convert
@return The converted date in java.sql.date format
|
[
"Converts",
"the",
"users",
"input",
"date",
"value",
"to",
"java",
".",
"sql",
".",
"Date"
] |
4c7b2f90201327af4eaa3cd46b3fee68f864e5cc
|
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/Date.java#L116-L136
|
151,802
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/message/opt/AutoRecordMessageListener.java
|
AutoRecordMessageListener.updateFields
|
public void updateFields(Record record, BaseMessage message, boolean bUpdateOnlyIfFieldNotModified)
{
String strField = (String)message.get(DBParams.FIELD);
if (MULTIPLE_FIELDS.equalsIgnoreCase(strField))
{ // Process multiple fields
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
Object objFieldNameValue = message.get(field.getFieldName());
if (objFieldNameValue != null)
if ((!bUpdateOnlyIfFieldNotModified) || (!field.isModified()))
{
if (objFieldNameValue instanceof String)
field.setString((String)objFieldNameValue);
else
{
try {
objFieldNameValue = Converter.convertObjectToDatatype(objFieldNameValue, field.getDataClass(), null);
} catch (Exception ex) {
objFieldNameValue = null;
}
field.setData(objFieldNameValue);
}
}
}
}
else
{
String strValue = (String)message.get(DBParams.VALUE);
BaseField field = record.getField(strField);
if (field != null)
if ((!bUpdateOnlyIfFieldNotModified) || (!field.isModified()))
field.setString(strValue);
}
}
|
java
|
public void updateFields(Record record, BaseMessage message, boolean bUpdateOnlyIfFieldNotModified)
{
String strField = (String)message.get(DBParams.FIELD);
if (MULTIPLE_FIELDS.equalsIgnoreCase(strField))
{ // Process multiple fields
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
Object objFieldNameValue = message.get(field.getFieldName());
if (objFieldNameValue != null)
if ((!bUpdateOnlyIfFieldNotModified) || (!field.isModified()))
{
if (objFieldNameValue instanceof String)
field.setString((String)objFieldNameValue);
else
{
try {
objFieldNameValue = Converter.convertObjectToDatatype(objFieldNameValue, field.getDataClass(), null);
} catch (Exception ex) {
objFieldNameValue = null;
}
field.setData(objFieldNameValue);
}
}
}
}
else
{
String strValue = (String)message.get(DBParams.VALUE);
BaseField field = record.getField(strField);
if (field != null)
if ((!bUpdateOnlyIfFieldNotModified) || (!field.isModified()))
field.setString(strValue);
}
}
|
[
"public",
"void",
"updateFields",
"(",
"Record",
"record",
",",
"BaseMessage",
"message",
",",
"boolean",
"bUpdateOnlyIfFieldNotModified",
")",
"{",
"String",
"strField",
"=",
"(",
"String",
")",
"message",
".",
"get",
"(",
"DBParams",
".",
"FIELD",
")",
";",
"if",
"(",
"MULTIPLE_FIELDS",
".",
"equalsIgnoreCase",
"(",
"strField",
")",
")",
"{",
"// Process multiple fields",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"record",
".",
"getFieldCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"Object",
"objFieldNameValue",
"=",
"message",
".",
"get",
"(",
"field",
".",
"getFieldName",
"(",
")",
")",
";",
"if",
"(",
"objFieldNameValue",
"!=",
"null",
")",
"if",
"(",
"(",
"!",
"bUpdateOnlyIfFieldNotModified",
")",
"||",
"(",
"!",
"field",
".",
"isModified",
"(",
")",
")",
")",
"{",
"if",
"(",
"objFieldNameValue",
"instanceof",
"String",
")",
"field",
".",
"setString",
"(",
"(",
"String",
")",
"objFieldNameValue",
")",
";",
"else",
"{",
"try",
"{",
"objFieldNameValue",
"=",
"Converter",
".",
"convertObjectToDatatype",
"(",
"objFieldNameValue",
",",
"field",
".",
"getDataClass",
"(",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"objFieldNameValue",
"=",
"null",
";",
"}",
"field",
".",
"setData",
"(",
"objFieldNameValue",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"String",
"strValue",
"=",
"(",
"String",
")",
"message",
".",
"get",
"(",
"DBParams",
".",
"VALUE",
")",
";",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"strField",
")",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"if",
"(",
"(",
"!",
"bUpdateOnlyIfFieldNotModified",
")",
"||",
"(",
"!",
"field",
".",
"isModified",
"(",
")",
")",
")",
"field",
".",
"setString",
"(",
"strValue",
")",
";",
"}",
"}"
] |
Update the fields in this record using this property object.
|
[
"Update",
"the",
"fields",
"in",
"this",
"record",
"using",
"this",
"property",
"object",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/opt/AutoRecordMessageListener.java#L220-L254
|
151,803
|
jbundle/jbundle
|
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/DWsdlAccessScreen.java
|
DWsdlAccessScreen.printXML
|
public void printXML(HttpServletRequest req, PrintWriter out)
{
ServletTask task = (ServletTask)this.getTask();
Map<String,Object> properties = task.getRequestProperties(task.getServletRequest(), true);
CreateWSDL wsdl = null;
if ("2.0".equalsIgnoreCase(this.getProperty(WSDL_VERSION)))
wsdl = new CreateWSDL20(task, null, properties); // Default
else // 1.1 Is the default for now
wsdl = new CreateWSDL11(task, null, properties);
Object data = wsdl.createMarshallableObject();
String xml = wsdl.getXML(data);
out.println(xml);
wsdl.free();
}
|
java
|
public void printXML(HttpServletRequest req, PrintWriter out)
{
ServletTask task = (ServletTask)this.getTask();
Map<String,Object> properties = task.getRequestProperties(task.getServletRequest(), true);
CreateWSDL wsdl = null;
if ("2.0".equalsIgnoreCase(this.getProperty(WSDL_VERSION)))
wsdl = new CreateWSDL20(task, null, properties); // Default
else // 1.1 Is the default for now
wsdl = new CreateWSDL11(task, null, properties);
Object data = wsdl.createMarshallableObject();
String xml = wsdl.getXML(data);
out.println(xml);
wsdl.free();
}
|
[
"public",
"void",
"printXML",
"(",
"HttpServletRequest",
"req",
",",
"PrintWriter",
"out",
")",
"{",
"ServletTask",
"task",
"=",
"(",
"ServletTask",
")",
"this",
".",
"getTask",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"task",
".",
"getRequestProperties",
"(",
"task",
".",
"getServletRequest",
"(",
")",
",",
"true",
")",
";",
"CreateWSDL",
"wsdl",
"=",
"null",
";",
"if",
"(",
"\"2.0\"",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getProperty",
"(",
"WSDL_VERSION",
")",
")",
")",
"wsdl",
"=",
"new",
"CreateWSDL20",
"(",
"task",
",",
"null",
",",
"properties",
")",
";",
"// Default",
"else",
"// 1.1 Is the default for now",
"wsdl",
"=",
"new",
"CreateWSDL11",
"(",
"task",
",",
"null",
",",
"properties",
")",
";",
"Object",
"data",
"=",
"wsdl",
".",
"createMarshallableObject",
"(",
")",
";",
"String",
"xml",
"=",
"wsdl",
".",
"getXML",
"(",
"data",
")",
";",
"out",
".",
"println",
"(",
"xml",
")",
";",
"wsdl",
".",
"free",
"(",
")",
";",
"}"
] |
PrintXML Method.
|
[
"PrintXML",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/DWsdlAccessScreen.java#L77-L91
|
151,804
|
krotscheck/jersey2-toolkit
|
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactory.java
|
HibernateSessionFactory.dispose
|
@Override
public void dispose(final Session session) {
if (session != null && session.isConnected()) {
logger.trace("Disposing of hibernate session.");
session.close();
}
}
|
java
|
@Override
public void dispose(final Session session) {
if (session != null && session.isConnected()) {
logger.trace("Disposing of hibernate session.");
session.close();
}
}
|
[
"@",
"Override",
"public",
"void",
"dispose",
"(",
"final",
"Session",
"session",
")",
"{",
"if",
"(",
"session",
"!=",
"null",
"&&",
"session",
".",
"isConnected",
"(",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Disposing of hibernate session.\"",
")",
";",
"session",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Dispose of a hibernate session.
@param session The session to dispose of.
|
[
"Dispose",
"of",
"a",
"hibernate",
"session",
"."
] |
11d757bd222dc82ada462caf6730ba4ff85dae04
|
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactory.java#L78-L84
|
151,805
|
NessComputing/components-ness-jackson
|
src/main/java/com/nesscomputing/jackson/NessObjectMapperBinder.java
|
NessObjectMapperBinder.bindJacksonModule
|
public static LinkedBindingBuilder<Module> bindJacksonModule(final Binder binder)
{
final Multibinder<Module> moduleBinder = Multibinder.newSetBinder(binder, Module.class, JACKSON_NAMED);
return moduleBinder.addBinding();
}
|
java
|
public static LinkedBindingBuilder<Module> bindJacksonModule(final Binder binder)
{
final Multibinder<Module> moduleBinder = Multibinder.newSetBinder(binder, Module.class, JACKSON_NAMED);
return moduleBinder.addBinding();
}
|
[
"public",
"static",
"LinkedBindingBuilder",
"<",
"Module",
">",
"bindJacksonModule",
"(",
"final",
"Binder",
"binder",
")",
"{",
"final",
"Multibinder",
"<",
"Module",
">",
"moduleBinder",
"=",
"Multibinder",
".",
"newSetBinder",
"(",
"binder",
",",
"Module",
".",
"class",
",",
"JACKSON_NAMED",
")",
";",
"return",
"moduleBinder",
".",
"addBinding",
"(",
")",
";",
"}"
] |
Bind a Jackson module to the object mapper.
|
[
"Bind",
"a",
"Jackson",
"module",
"to",
"the",
"object",
"mapper",
"."
] |
6e201b9b266f6100c47231ded44b6432b071e9d1
|
https://github.com/NessComputing/components-ness-jackson/blob/6e201b9b266f6100c47231ded44b6432b071e9d1/src/main/java/com/nesscomputing/jackson/NessObjectMapperBinder.java#L40-L44
|
151,806
|
NessComputing/components-ness-jackson
|
src/main/java/com/nesscomputing/jackson/NessObjectMapperBinder.java
|
NessObjectMapperBinder.bindJacksonOption
|
public static LinkedBindingBuilder<Boolean> bindJacksonOption(final Binder binder, final Enum<?> option)
{
final MapBinder<Enum<?>, Boolean> optionBinder = MapBinder.newMapBinder(binder, new TypeLiteral<Enum<?>>() {}, new TypeLiteral<Boolean>() {}, JACKSON_NAMED);
return optionBinder.addBinding(option);
}
|
java
|
public static LinkedBindingBuilder<Boolean> bindJacksonOption(final Binder binder, final Enum<?> option)
{
final MapBinder<Enum<?>, Boolean> optionBinder = MapBinder.newMapBinder(binder, new TypeLiteral<Enum<?>>() {}, new TypeLiteral<Boolean>() {}, JACKSON_NAMED);
return optionBinder.addBinding(option);
}
|
[
"public",
"static",
"LinkedBindingBuilder",
"<",
"Boolean",
">",
"bindJacksonOption",
"(",
"final",
"Binder",
"binder",
",",
"final",
"Enum",
"<",
"?",
">",
"option",
")",
"{",
"final",
"MapBinder",
"<",
"Enum",
"<",
"?",
">",
",",
"Boolean",
">",
"optionBinder",
"=",
"MapBinder",
".",
"newMapBinder",
"(",
"binder",
",",
"new",
"TypeLiteral",
"<",
"Enum",
"<",
"?",
">",
">",
"(",
")",
"{",
"}",
",",
"new",
"TypeLiteral",
"<",
"Boolean",
">",
"(",
")",
"{",
"}",
",",
"JACKSON_NAMED",
")",
";",
"return",
"optionBinder",
".",
"addBinding",
"(",
"option",
")",
";",
"}"
] |
Set a Jackson feature on the Object Mapper.
@see {@link JsonGenerator.Feature}, {@link JsonParser.Feature}, {@link SerializationConfig.Feature} and {@link DeserializationConfig.Feature} for available features.
|
[
"Set",
"a",
"Jackson",
"feature",
"on",
"the",
"Object",
"Mapper",
"."
] |
6e201b9b266f6100c47231ded44b6432b071e9d1
|
https://github.com/NessComputing/components-ness-jackson/blob/6e201b9b266f6100c47231ded44b6432b071e9d1/src/main/java/com/nesscomputing/jackson/NessObjectMapperBinder.java#L51-L55
|
151,807
|
inkstand-io/scribble
|
scribble-all/src/main/java/io/inkstand/scribble/ScribbleShrinkwrapHelper.java
|
ScribbleShrinkwrapHelper.createEARDeployment
|
public static EnterpriseArchive createEARDeployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "scribble-test.ear");
// use local maven repository mirror only
final PomEquippedResolveStage pom = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml");
final File[] files = pom.importDependencies(ScopeType.COMPILE).resolve().withTransitivity().asFile();
for (final File f : files) {
if (f.getName().endsWith(".jar")) {
LOG.debug("Adding lib {}", f);
ear.addAsLibrary(f);
}
}
return ear;
}
|
java
|
public static EnterpriseArchive createEARDeployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "scribble-test.ear");
// use local maven repository mirror only
final PomEquippedResolveStage pom = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml");
final File[] files = pom.importDependencies(ScopeType.COMPILE).resolve().withTransitivity().asFile();
for (final File f : files) {
if (f.getName().endsWith(".jar")) {
LOG.debug("Adding lib {}", f);
ear.addAsLibrary(f);
}
}
return ear;
}
|
[
"public",
"static",
"EnterpriseArchive",
"createEARDeployment",
"(",
")",
"{",
"final",
"EnterpriseArchive",
"ear",
"=",
"ShrinkWrap",
".",
"create",
"(",
"EnterpriseArchive",
".",
"class",
",",
"\"scribble-test.ear\"",
")",
";",
"// use local maven repository mirror only",
"final",
"PomEquippedResolveStage",
"pom",
"=",
"Maven",
".",
"configureResolver",
"(",
")",
".",
"workOffline",
"(",
")",
".",
"loadPomFromFile",
"(",
"\"pom.xml\"",
")",
";",
"final",
"File",
"[",
"]",
"files",
"=",
"pom",
".",
"importDependencies",
"(",
"ScopeType",
".",
"COMPILE",
")",
".",
"resolve",
"(",
")",
".",
"withTransitivity",
"(",
")",
".",
"asFile",
"(",
")",
";",
"for",
"(",
"final",
"File",
"f",
":",
"files",
")",
"{",
"if",
"(",
"f",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Adding lib {}\"",
",",
"f",
")",
";",
"ear",
".",
"addAsLibrary",
"(",
"f",
")",
";",
"}",
"}",
"return",
"ear",
";",
"}"
] |
Creates an enterprise archive for the module in whose working directory the method is invoked, including all
compile-scoped jar archives.
@return an enterprise containgin all dependency of the current module
|
[
"Creates",
"an",
"enterprise",
"archive",
"for",
"the",
"module",
"in",
"whose",
"working",
"directory",
"the",
"method",
"is",
"invoked",
"including",
"all",
"compile",
"-",
"scoped",
"jar",
"archives",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-all/src/main/java/io/inkstand/scribble/ScribbleShrinkwrapHelper.java#L75-L90
|
151,808
|
inkstand-io/scribble
|
scribble-all/src/main/java/io/inkstand/scribble/ScribbleShrinkwrapHelper.java
|
ScribbleShrinkwrapHelper.createJackrabbitCDI10Webapp
|
public static WebArchive createJackrabbitCDI10Webapp() {
// extract the jackrabbit webapp
final File jackrabbitWarFile = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.apache.jackrabbit:jackrabbit-webapp:war:?").withTransitivity().asSingleFile();
// obtain the CDI1.0 compatible guava 15 jar
final File guava15CDIJarFile = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.google.guava:guava:jar:cdi1.0:15.0").withTransitivity().asSingleFile();
// get the custom web.xml
final URL webXml = ScribbleShrinkwrapHelper.class.getResource("jackrabbit_webapp_web.xml");
// create a patched war file with the custom web.xml and the guava jar
final WebArchive jackrabbitWar = ShrinkWrap.createFromZipFile(WebArchive.class, jackrabbitWarFile)
.setWebXML(webXml).addAsLibraries(guava15CDIJarFile);
// delete the incompatible guava jar
jackrabbitWar.delete("/WEB-INF/lib/guava-15.0.jar");
return jackrabbitWar;
}
|
java
|
public static WebArchive createJackrabbitCDI10Webapp() {
// extract the jackrabbit webapp
final File jackrabbitWarFile = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.apache.jackrabbit:jackrabbit-webapp:war:?").withTransitivity().asSingleFile();
// obtain the CDI1.0 compatible guava 15 jar
final File guava15CDIJarFile = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.google.guava:guava:jar:cdi1.0:15.0").withTransitivity().asSingleFile();
// get the custom web.xml
final URL webXml = ScribbleShrinkwrapHelper.class.getResource("jackrabbit_webapp_web.xml");
// create a patched war file with the custom web.xml and the guava jar
final WebArchive jackrabbitWar = ShrinkWrap.createFromZipFile(WebArchive.class, jackrabbitWarFile)
.setWebXML(webXml).addAsLibraries(guava15CDIJarFile);
// delete the incompatible guava jar
jackrabbitWar.delete("/WEB-INF/lib/guava-15.0.jar");
return jackrabbitWar;
}
|
[
"public",
"static",
"WebArchive",
"createJackrabbitCDI10Webapp",
"(",
")",
"{",
"// extract the jackrabbit webapp",
"final",
"File",
"jackrabbitWarFile",
"=",
"Maven",
".",
"resolver",
"(",
")",
".",
"loadPomFromFile",
"(",
"\"pom.xml\"",
")",
".",
"resolve",
"(",
"\"org.apache.jackrabbit:jackrabbit-webapp:war:?\"",
")",
".",
"withTransitivity",
"(",
")",
".",
"asSingleFile",
"(",
")",
";",
"// obtain the CDI1.0 compatible guava 15 jar",
"final",
"File",
"guava15CDIJarFile",
"=",
"Maven",
".",
"resolver",
"(",
")",
".",
"loadPomFromFile",
"(",
"\"pom.xml\"",
")",
".",
"resolve",
"(",
"\"com.google.guava:guava:jar:cdi1.0:15.0\"",
")",
".",
"withTransitivity",
"(",
")",
".",
"asSingleFile",
"(",
")",
";",
"// get the custom web.xml",
"final",
"URL",
"webXml",
"=",
"ScribbleShrinkwrapHelper",
".",
"class",
".",
"getResource",
"(",
"\"jackrabbit_webapp_web.xml\"",
")",
";",
"// create a patched war file with the custom web.xml and the guava jar",
"final",
"WebArchive",
"jackrabbitWar",
"=",
"ShrinkWrap",
".",
"createFromZipFile",
"(",
"WebArchive",
".",
"class",
",",
"jackrabbitWarFile",
")",
".",
"setWebXML",
"(",
"webXml",
")",
".",
"addAsLibraries",
"(",
"guava15CDIJarFile",
")",
";",
"// delete the incompatible guava jar",
"jackrabbitWar",
".",
"delete",
"(",
"\"/WEB-INF/lib/guava-15.0.jar\"",
")",
";",
"return",
"jackrabbitWar",
";",
"}"
] |
Creates a Jackrabbit WebArchive for a CDI 1.0 container that may be deployed along with the web app under test.
The jackrabbit web app uses a customized web.xml to provide a repository that is available as JNDI resource.
@return
|
[
"Creates",
"a",
"Jackrabbit",
"WebArchive",
"for",
"a",
"CDI",
"1",
".",
"0",
"container",
"that",
"may",
"be",
"deployed",
"along",
"with",
"the",
"web",
"app",
"under",
"test",
".",
"The",
"jackrabbit",
"web",
"app",
"uses",
"a",
"customized",
"web",
".",
"xml",
"to",
"provide",
"a",
"repository",
"that",
"is",
"available",
"as",
"JNDI",
"resource",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-all/src/main/java/io/inkstand/scribble/ScribbleShrinkwrapHelper.java#L98-L116
|
151,809
|
NessComputing/components-ness-lifecycle
|
src/main/java/com/nesscomputing/lifecycle/guice/DelegatingLifecycleProvider.java
|
DelegatingLifecycleProvider.of
|
public static <U> LifecycleProvider<U> of(@Nonnull final Class<? extends Provider<U>> providerClass)
{
return new DelegatingLifecycleProvider<U>(providerClass, null);
}
|
java
|
public static <U> LifecycleProvider<U> of(@Nonnull final Class<? extends Provider<U>> providerClass)
{
return new DelegatingLifecycleProvider<U>(providerClass, null);
}
|
[
"public",
"static",
"<",
"U",
">",
"LifecycleProvider",
"<",
"U",
">",
"of",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
"extends",
"Provider",
"<",
"U",
">",
">",
"providerClass",
")",
"{",
"return",
"new",
"DelegatingLifecycleProvider",
"<",
"U",
">",
"(",
"providerClass",
",",
"null",
")",
";",
"}"
] |
Returns a LifecycleProvider that delegates to an existing provider. The provider is managed by Guice
and injected.
|
[
"Returns",
"a",
"LifecycleProvider",
"that",
"delegates",
"to",
"an",
"existing",
"provider",
".",
"The",
"provider",
"is",
"managed",
"by",
"Guice",
"and",
"injected",
"."
] |
6c8ae8ec8fdcd16b30383092ce9e70424a6760f1
|
https://github.com/NessComputing/components-ness-lifecycle/blob/6c8ae8ec8fdcd16b30383092ce9e70424a6760f1/src/main/java/com/nesscomputing/lifecycle/guice/DelegatingLifecycleProvider.java#L37-L40
|
151,810
|
NessComputing/components-ness-lifecycle
|
src/main/java/com/nesscomputing/lifecycle/guice/DelegatingLifecycleProvider.java
|
DelegatingLifecycleProvider.of
|
public static <U> LifecycleProvider<U> of(@Nonnull final Provider<U> delegate)
{
return new DelegatingLifecycleProvider<U>(null, delegate);
}
|
java
|
public static <U> LifecycleProvider<U> of(@Nonnull final Provider<U> delegate)
{
return new DelegatingLifecycleProvider<U>(null, delegate);
}
|
[
"public",
"static",
"<",
"U",
">",
"LifecycleProvider",
"<",
"U",
">",
"of",
"(",
"@",
"Nonnull",
"final",
"Provider",
"<",
"U",
">",
"delegate",
")",
"{",
"return",
"new",
"DelegatingLifecycleProvider",
"<",
"U",
">",
"(",
"null",
",",
"delegate",
")",
";",
"}"
] |
Returns a LifecycleProvider that delegates to an existing provider instance.
|
[
"Returns",
"a",
"LifecycleProvider",
"that",
"delegates",
"to",
"an",
"existing",
"provider",
"instance",
"."
] |
6c8ae8ec8fdcd16b30383092ce9e70424a6760f1
|
https://github.com/NessComputing/components-ness-lifecycle/blob/6c8ae8ec8fdcd16b30383092ce9e70424a6760f1/src/main/java/com/nesscomputing/lifecycle/guice/DelegatingLifecycleProvider.java#L45-L48
|
151,811
|
krotscheck/jersey2-toolkit
|
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/HibernateFeature.java
|
HibernateFeature.configure
|
@Override
public boolean configure(final FeatureContext context) {
// Hibernate configuration.
context.register(new HibernateSessionFactory.Binder());
context.register(new HibernateSessionFactoryFactory.Binder());
context.register(new HibernateServiceRegistryFactory.Binder());
context.register(new FulltextSearchFactoryFactory.Binder());
context.register(new FulltextSessionFactory.Binder());
return true;
}
|
java
|
@Override
public boolean configure(final FeatureContext context) {
// Hibernate configuration.
context.register(new HibernateSessionFactory.Binder());
context.register(new HibernateSessionFactoryFactory.Binder());
context.register(new HibernateServiceRegistryFactory.Binder());
context.register(new FulltextSearchFactoryFactory.Binder());
context.register(new FulltextSessionFactory.Binder());
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"configure",
"(",
"final",
"FeatureContext",
"context",
")",
"{",
"// Hibernate configuration.",
"context",
".",
"register",
"(",
"new",
"HibernateSessionFactory",
".",
"Binder",
"(",
")",
")",
";",
"context",
".",
"register",
"(",
"new",
"HibernateSessionFactoryFactory",
".",
"Binder",
"(",
")",
")",
";",
"context",
".",
"register",
"(",
"new",
"HibernateServiceRegistryFactory",
".",
"Binder",
"(",
")",
")",
";",
"context",
".",
"register",
"(",
"new",
"FulltextSearchFactoryFactory",
".",
"Binder",
"(",
")",
")",
";",
"context",
".",
"register",
"(",
"new",
"FulltextSessionFactory",
".",
"Binder",
"(",
")",
")",
";",
"return",
"true",
";",
"}"
] |
Register the HibernateFeature with the current application context.
@param context The application context.
@return Always true.
|
[
"Register",
"the",
"HibernateFeature",
"with",
"the",
"current",
"application",
"context",
"."
] |
11d757bd222dc82ada462caf6730ba4ff85dae04
|
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/HibernateFeature.java#L48-L59
|
151,812
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java
|
ColumnTypeHelper.getCastingValue
|
public static Object getCastingValue(ColumnType columnType, Object value) throws ExecutionException {
validateInput(columnType);
Object returnValue = null;
if (value != null) {
switch (columnType.getDataType()) {
case BIGINT:
ensureNumber(value);
returnValue = ((Number) value).longValue();
break;
case DOUBLE:
ensureNumber(value);
returnValue = ((Number) value).doubleValue();
break;
case FLOAT:
ensureNumber(value);
returnValue = ((Number) value).floatValue();
break;
case INT:
ensureNumber(value);
returnValue = ((Number) value).intValue();
break;
default:
returnValue = value;
}
}
return returnValue;
}
|
java
|
public static Object getCastingValue(ColumnType columnType, Object value) throws ExecutionException {
validateInput(columnType);
Object returnValue = null;
if (value != null) {
switch (columnType.getDataType()) {
case BIGINT:
ensureNumber(value);
returnValue = ((Number) value).longValue();
break;
case DOUBLE:
ensureNumber(value);
returnValue = ((Number) value).doubleValue();
break;
case FLOAT:
ensureNumber(value);
returnValue = ((Number) value).floatValue();
break;
case INT:
ensureNumber(value);
returnValue = ((Number) value).intValue();
break;
default:
returnValue = value;
}
}
return returnValue;
}
|
[
"public",
"static",
"Object",
"getCastingValue",
"(",
"ColumnType",
"columnType",
",",
"Object",
"value",
")",
"throws",
"ExecutionException",
"{",
"validateInput",
"(",
"columnType",
")",
";",
"Object",
"returnValue",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"switch",
"(",
"columnType",
".",
"getDataType",
"(",
")",
")",
"{",
"case",
"BIGINT",
":",
"ensureNumber",
"(",
"value",
")",
";",
"returnValue",
"=",
"(",
"(",
"Number",
")",
"value",
")",
".",
"longValue",
"(",
")",
";",
"break",
";",
"case",
"DOUBLE",
":",
"ensureNumber",
"(",
"value",
")",
";",
"returnValue",
"=",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
";",
"break",
";",
"case",
"FLOAT",
":",
"ensureNumber",
"(",
"value",
")",
";",
"returnValue",
"=",
"(",
"(",
"Number",
")",
"value",
")",
".",
"floatValue",
"(",
")",
";",
"break",
";",
"case",
"INT",
":",
"ensureNumber",
"(",
"value",
")",
";",
"returnValue",
"=",
"(",
"(",
"Number",
")",
"value",
")",
".",
"intValue",
"(",
")",
";",
"break",
";",
"default",
":",
"returnValue",
"=",
"value",
";",
"}",
"}",
"return",
"returnValue",
";",
"}"
] |
Return a casting value adapt to columntType.
@param columnType the columnType.
@param value the value.
@return the casting value.
@throws ExecutionException if the casting is not possible.
|
[
"Return",
"a",
"casting",
"value",
"adapt",
"to",
"columntType",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java#L50-L79
|
151,813
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java
|
ColumnTypeHelper.validateInput
|
private static void validateInput(ColumnType columnType) throws ExecutionException {
if (columnType == null) {
String messagge = "The ColumnType can not be null.";
LOGGER.error(messagge);
throw new ExecutionException(messagge);
}
}
|
java
|
private static void validateInput(ColumnType columnType) throws ExecutionException {
if (columnType == null) {
String messagge = "The ColumnType can not be null.";
LOGGER.error(messagge);
throw new ExecutionException(messagge);
}
}
|
[
"private",
"static",
"void",
"validateInput",
"(",
"ColumnType",
"columnType",
")",
"throws",
"ExecutionException",
"{",
"if",
"(",
"columnType",
"==",
"null",
")",
"{",
"String",
"messagge",
"=",
"\"The ColumnType can not be null.\"",
";",
"LOGGER",
".",
"error",
"(",
"messagge",
")",
";",
"throw",
"new",
"ExecutionException",
"(",
"messagge",
")",
";",
"}",
"}"
] |
This method validate the Input.
@param columnType the columnType.
@throws ExecutionException if a exception happens.
|
[
"This",
"method",
"validate",
"the",
"Input",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java#L87-L93
|
151,814
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java
|
ColumnTypeHelper.ensureNumber
|
private static void ensureNumber(Object value) throws ExecutionException {
if (!isNumber(value)) {
String message = value.getClass().getCanonicalName() + " can not cast to a Number.";
LOGGER.error(message);
throw new ExecutionException(message);
}
}
|
java
|
private static void ensureNumber(Object value) throws ExecutionException {
if (!isNumber(value)) {
String message = value.getClass().getCanonicalName() + " can not cast to a Number.";
LOGGER.error(message);
throw new ExecutionException(message);
}
}
|
[
"private",
"static",
"void",
"ensureNumber",
"(",
"Object",
"value",
")",
"throws",
"ExecutionException",
"{",
"if",
"(",
"!",
"isNumber",
"(",
"value",
")",
")",
"{",
"String",
"message",
"=",
"value",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
"+",
"\" can not cast to a Number.\"",
";",
"LOGGER",
".",
"error",
"(",
"message",
")",
";",
"throw",
"new",
"ExecutionException",
"(",
"message",
")",
";",
"}",
"}"
] |
Ensure if a object is a number.
@param value the objet.
@throws ExecutionException if is not a number.
|
[
"Ensure",
"if",
"a",
"object",
"is",
"a",
"number",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ColumnTypeHelper.java#L112-L119
|
151,815
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/CommonsConnector.java
|
CommonsConnector.connect
|
@Override
public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
logger.info("Conecting connector [" + this.getClass().getSimpleName() + "]");
connectionHandler.createConnection(credentials, config);
}
|
java
|
@Override
public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
logger.info("Conecting connector [" + this.getClass().getSimpleName() + "]");
connectionHandler.createConnection(credentials, config);
}
|
[
"@",
"Override",
"public",
"void",
"connect",
"(",
"ICredentials",
"credentials",
",",
"ConnectorClusterConfig",
"config",
")",
"throws",
"ConnectionException",
"{",
"logger",
".",
"info",
"(",
"\"Conecting connector [\"",
"+",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\"]\"",
")",
";",
"connectionHandler",
".",
"createConnection",
"(",
"credentials",
",",
"config",
")",
";",
"}"
] |
Create a logical connection.
@param credentials the credentials.
@param config the connection configuration.
@throws ConnectionException if the connection fail.
|
[
"Create",
"a",
"logical",
"connection",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/CommonsConnector.java#L74-L79
|
151,816
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/CommonsConnector.java
|
CommonsConnector.close
|
@Override
public void close(ClusterName clusterName) {
logger.info("Close connection to cluster [" + clusterName + "] from connector [" + this.getClass().getSimpleName() + "]");
connectionHandler.closeConnection(clusterName.getName());
}
|
java
|
@Override
public void close(ClusterName clusterName) {
logger.info("Close connection to cluster [" + clusterName + "] from connector [" + this.getClass().getSimpleName() + "]");
connectionHandler.closeConnection(clusterName.getName());
}
|
[
"@",
"Override",
"public",
"void",
"close",
"(",
"ClusterName",
"clusterName",
")",
"{",
"logger",
".",
"info",
"(",
"\"Close connection to cluster [\"",
"+",
"clusterName",
"+",
"\"] from connector [\"",
"+",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\"]\"",
")",
";",
"connectionHandler",
".",
"closeConnection",
"(",
"clusterName",
".",
"getName",
"(",
")",
")",
";",
"}"
] |
It close the logical connection.
@param clusterName the connection identifier.
|
[
"It",
"close",
"the",
"logical",
"connection",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/CommonsConnector.java#L86-L91
|
151,817
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static <E extends Comparable<E>> boolean isSorted(E[] array) {
for(int i = 0; i < array.length - 1 ; i++) {
if(array[i].compareTo(array[i + 1]) > 0) {
return false;
}
}
return true;
}
|
java
|
public static <E extends Comparable<E>> boolean isSorted(E[] array) {
for(int i = 0; i < array.length - 1 ; i++) {
if(array[i].compareTo(array[i + 1]) > 0) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"boolean",
"isSorted",
"(",
"E",
"[",
"]",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"compareTo",
"(",
"array",
"[",
"i",
"+",
"1",
"]",
")",
">",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the array is sorted. It loops through the entire
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param <E> the type of elements in this array.
@param array the array to check
@return <i>true</i> if the array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L28-L37
|
151,818
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static <E extends Comparable<E>> boolean isSorted(List<E> list) {
for(int i = 0; i < list.size() - 1; i++) {
if(list.get(i).compareTo(list.get(i + 1)) > 0) {
return false;
}
}
return true;
}
|
java
|
public static <E extends Comparable<E>> boolean isSorted(List<E> list) {
for(int i = 0; i < list.size() - 1; i++) {
if(list.get(i).compareTo(list.get(i + 1)) > 0) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"boolean",
"isSorted",
"(",
"List",
"<",
"E",
">",
"list",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"list",
".",
"get",
"(",
"i",
")",
".",
"compareTo",
"(",
"list",
".",
"get",
"(",
"i",
"+",
"1",
")",
")",
">",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the list is sorted. It loops through the entire
list once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param <E> the type of elements in this list.
@param list the list to check
@return <i>true</i> if the list is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"list",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"list",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L53-L62
|
151,819
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(int[] intArray) {
for(int i = 0; i < intArray.length - 1 ; i++) {
if(intArray[i] > intArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(int[] intArray) {
for(int i = 0; i < intArray.length - 1 ; i++) {
if(intArray[i] > intArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"int",
"[",
"]",
"intArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"intArray",
"[",
"i",
"]",
">",
"intArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the integer array is sorted. It loops through the entire integer
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param intArray the integer array to check
@return <i>true</i> if the integer array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"integer",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"integer",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L77-L86
|
151,820
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(int[] intArray) {
for(int i = 0; i < intArray.length - 1 ; i++) {
if(intArray[i] < intArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(int[] intArray) {
for(int i = 0; i < intArray.length - 1 ; i++) {
if(intArray[i] < intArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"int",
"[",
"]",
"intArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"intArray",
"[",
"i",
"]",
"<",
"intArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the integer array is reverse sorted. It loops through the entire integer
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param intArray the integer array to check
@return <i>true</i> if the integer array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"integer",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"integer",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L151-L160
|
151,821
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(byte[] byteArray) {
for(int i = 0; i < byteArray.length - 1 ; i++) {
if(byteArray[i] > byteArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(byte[] byteArray) {
for(int i = 0; i < byteArray.length - 1 ; i++) {
if(byteArray[i] > byteArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"byteArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"byteArray",
"[",
"i",
"]",
">",
"byteArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the byte array is sorted. It loops through the entire byte
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param byteArray the byte array to check
@return <i>true</i> if the byte array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"byte",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"byte",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L175-L183
|
151,822
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(byte[] byteArray) {
for(int i = 0; i < byteArray.length - 1 ; i++) {
if(byteArray[i] < byteArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(byte[] byteArray) {
for(int i = 0; i < byteArray.length - 1 ; i++) {
if(byteArray[i] < byteArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"byteArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"byteArray",
"[",
"i",
"]",
"<",
"byteArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the byte array is reverse sorted. It loops through the entire byte
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param byteArray the byte array to check
@return <i>true</i> if the byte array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"byte",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"byte",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L198-L206
|
151,823
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(char[] charArray) {
for(int i = 0; i < charArray.length - 1 ; i++) {
if(charArray[i] > charArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(char[] charArray) {
for(int i = 0; i < charArray.length - 1 ; i++) {
if(charArray[i] > charArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"char",
"[",
"]",
"charArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"charArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"charArray",
"[",
"i",
"]",
">",
"charArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the char array is sorted. It loops through the entire char
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param charArray the char array to check
@return <i>true</i> if the char array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"char",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"char",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L221-L231
|
151,824
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(char[] charArray) {
for(int i = 0; i < charArray.length - 1 ; i++) {
if(charArray[i] < charArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(char[] charArray) {
for(int i = 0; i < charArray.length - 1 ; i++) {
if(charArray[i] < charArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"char",
"[",
"]",
"charArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"charArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"charArray",
"[",
"i",
"]",
"<",
"charArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the char array is reverse sorted. It loops through the entire char
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param charArray the char array to check
@return <i>true</i> if the char array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"char",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"char",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L246-L256
|
151,825
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(double[] doubleArray) {
for(int i = 0; i < doubleArray.length - 1 ; i++) {
if(doubleArray[i] > doubleArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(double[] doubleArray) {
for(int i = 0; i < doubleArray.length - 1 ; i++) {
if(doubleArray[i] > doubleArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"double",
"[",
"]",
"doubleArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"doubleArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"doubleArray",
"[",
"i",
"]",
">",
"doubleArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the double array is sorted. It loops through the entire double
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param doubleArray the double array to check
@return <i>true</i> if the double array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"double",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"double",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L271-L281
|
151,826
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(double[] doubleArray) {
for(int i = 0; i < doubleArray.length - 1 ; i++) {
if(doubleArray[i] < doubleArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(double[] doubleArray) {
for(int i = 0; i < doubleArray.length - 1 ; i++) {
if(doubleArray[i] < doubleArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"double",
"[",
"]",
"doubleArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"doubleArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"doubleArray",
"[",
"i",
"]",
"<",
"doubleArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the double array is reverse sorted. It loops through the entire double
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param doubleArray the double array to check
@return <i>true</i> if the double array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"double",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"double",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L296-L306
|
151,827
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(float[] floatArray) {
for(int i = 0; i < floatArray.length - 1 ; i++) {
if(floatArray[i] > floatArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(float[] floatArray) {
for(int i = 0; i < floatArray.length - 1 ; i++) {
if(floatArray[i] > floatArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"float",
"[",
"]",
"floatArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"floatArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"floatArray",
"[",
"i",
"]",
">",
"floatArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the float array is sorted. It loops through the entire float
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param floatArray the float array to check
@return <i>true</i> if the float array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"float",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"float",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L321-L331
|
151,828
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(float[] floatArray) {
for(int i = 0; i < floatArray.length - 1 ; i++) {
if(floatArray[i] < floatArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(float[] floatArray) {
for(int i = 0; i < floatArray.length - 1 ; i++) {
if(floatArray[i] < floatArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"float",
"[",
"]",
"floatArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"floatArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"floatArray",
"[",
"i",
"]",
"<",
"floatArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the float array is reverse sorted. It loops through the entire float
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param floatArray the float array to check
@return <i>true</i> if the float array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"float",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"float",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L346-L356
|
151,829
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(long[] longArray) {
for(int i = 0; i < longArray.length - 1 ; i++) {
if(longArray[i] > longArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(long[] longArray) {
for(int i = 0; i < longArray.length - 1 ; i++) {
if(longArray[i] > longArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"long",
"[",
"]",
"longArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"longArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"longArray",
"[",
"i",
"]",
">",
"longArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the long array is sorted. It loops through the entire long
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param longArray the long array to check
@return <i>true</i> if the long array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"long",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"long",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L371-L381
|
151,830
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(long[] longArray) {
for(int i = 0; i < longArray.length - 1 ; i++) {
if(longArray[i] < longArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(long[] longArray) {
for(int i = 0; i < longArray.length - 1 ; i++) {
if(longArray[i] < longArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"long",
"[",
"]",
"longArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"longArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"longArray",
"[",
"i",
"]",
"<",
"longArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the long array is reverse sorted. It loops through the entire long
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param longArray the long array to check
@return <i>true</i> if the long array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"long",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"long",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L396-L406
|
151,831
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isSorted
|
public static boolean isSorted(short[] shortArray) {
for(int i = 0; i < shortArray.length - 1 ; i++) {
if(shortArray[i] > shortArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isSorted(short[] shortArray) {
for(int i = 0; i < shortArray.length - 1 ; i++) {
if(shortArray[i] > shortArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isSorted",
"(",
"short",
"[",
"]",
"shortArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shortArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"shortArray",
"[",
"i",
"]",
">",
"shortArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the short array is sorted. It loops through the entire short
array once, checking that the elements are sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param shortArray the short array to check
@return <i>true</i> if the short array is sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"short",
"array",
"is",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"short",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L421-L431
|
151,832
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java
|
Sort.isReverseSorted
|
public static boolean isReverseSorted(short[] shortArray) {
for(int i = 0; i < shortArray.length - 1 ; i++) {
if(shortArray[i] < shortArray [i + 1]) {
return false;
}
}
return true;
}
|
java
|
public static boolean isReverseSorted(short[] shortArray) {
for(int i = 0; i < shortArray.length - 1 ; i++) {
if(shortArray[i] < shortArray [i + 1]) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isReverseSorted",
"(",
"short",
"[",
"]",
"shortArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shortArray",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"shortArray",
"[",
"i",
"]",
"<",
"shortArray",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if the short array is reverse sorted. It loops through the entire short
array once, checking that the elements are reverse sorted.
<br>
<br>
<i>Runtime: </i> O(n)
@param shortArray the short array to check
@return <i>true</i> if the short array is reverse sorted, else <i>false</i>.
|
[
"Check",
"if",
"the",
"short",
"array",
"is",
"reverse",
"sorted",
".",
"It",
"loops",
"through",
"the",
"entire",
"short",
"array",
"once",
"checking",
"that",
"the",
"elements",
"are",
"reverse",
"sorted",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/Sort.java#L446-L456
|
151,833
|
hdecarne/java-default
|
src/main/java/de/carne/util/ManifestInfos.java
|
ManifestInfos.getMainAttribute
|
public String getMainAttribute(String attributeName, String defaultValue) {
Attributes attributes = this.manifest.getMainAttributes();
String attributeValue = (attributes != null ? attributes.getValue(attributeName) : null);
return (attributeValue != null ? attributeValue : defaultValue);
}
|
java
|
public String getMainAttribute(String attributeName, String defaultValue) {
Attributes attributes = this.manifest.getMainAttributes();
String attributeValue = (attributes != null ? attributes.getValue(attributeName) : null);
return (attributeValue != null ? attributeValue : defaultValue);
}
|
[
"public",
"String",
"getMainAttribute",
"(",
"String",
"attributeName",
",",
"String",
"defaultValue",
")",
"{",
"Attributes",
"attributes",
"=",
"this",
".",
"manifest",
".",
"getMainAttributes",
"(",
")",
";",
"String",
"attributeValue",
"=",
"(",
"attributes",
"!=",
"null",
"?",
"attributes",
".",
"getValue",
"(",
"attributeName",
")",
":",
"null",
")",
";",
"return",
"(",
"attributeValue",
"!=",
"null",
"?",
"attributeValue",
":",
"defaultValue",
")",
";",
"}"
] |
Gets a manifest's main attribute.
@param attributeName the attribute name to get.
@param defaultValue the default value to return in case the attribute undefined.
@return the found attribute value or the submitted default value in case the attribute is undefined.
|
[
"Gets",
"a",
"manifest",
"s",
"main",
"attribute",
"."
] |
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
|
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/ManifestInfos.java#L68-L73
|
151,834
|
kametic/specifications
|
src/main/java/org/kametic/specifications/Specifications.java
|
Specifications.and
|
public static <T> Specification<T> and(Specification<T> lhs, Specification<? super T> rhs) {
return new AndSpecification<T>(lhs, rhs);
}
|
java
|
public static <T> Specification<T> and(Specification<T> lhs, Specification<? super T> rhs) {
return new AndSpecification<T>(lhs, rhs);
}
|
[
"public",
"static",
"<",
"T",
">",
"Specification",
"<",
"T",
">",
"and",
"(",
"Specification",
"<",
"T",
">",
"lhs",
",",
"Specification",
"<",
"?",
"super",
"T",
">",
"rhs",
")",
"{",
"return",
"new",
"AndSpecification",
"<",
"T",
">",
"(",
"lhs",
",",
"rhs",
")",
";",
"}"
] |
Returns a specification expecting that the two given specifications are satisfied.
@param <T> the specification type
@param lhs the left hand specification
@param rhs the right hand specification
@return an AndSpecification
|
[
"Returns",
"a",
"specification",
"expecting",
"that",
"the",
"two",
"given",
"specifications",
"are",
"satisfied",
"."
] |
7453ced475355bac8adae7605e259354e0a96479
|
https://github.com/kametic/specifications/blob/7453ced475355bac8adae7605e259354e0a96479/src/main/java/org/kametic/specifications/Specifications.java#L32-L34
|
151,835
|
kametic/specifications
|
src/main/java/org/kametic/specifications/Specifications.java
|
Specifications.or
|
public static <T> Specification<T> or(Specification<T> lhs, Specification<? super T> rhs) {
return new OrSpecification<T>(lhs, rhs);
}
|
java
|
public static <T> Specification<T> or(Specification<T> lhs, Specification<? super T> rhs) {
return new OrSpecification<T>(lhs, rhs);
}
|
[
"public",
"static",
"<",
"T",
">",
"Specification",
"<",
"T",
">",
"or",
"(",
"Specification",
"<",
"T",
">",
"lhs",
",",
"Specification",
"<",
"?",
"super",
"T",
">",
"rhs",
")",
"{",
"return",
"new",
"OrSpecification",
"<",
"T",
">",
"(",
"lhs",
",",
"rhs",
")",
";",
"}"
] |
Returns a specification expecting that at least one of the two specifications is satisfied.
@param <T> the specification type
@param lhs the left hand specification
@param rhs the right hand specification
@return an OrSpecification
|
[
"Returns",
"a",
"specification",
"expecting",
"that",
"at",
"least",
"one",
"of",
"the",
"two",
"specifications",
"is",
"satisfied",
"."
] |
7453ced475355bac8adae7605e259354e0a96479
|
https://github.com/kametic/specifications/blob/7453ced475355bac8adae7605e259354e0a96479/src/main/java/org/kametic/specifications/Specifications.java#L44-L46
|
151,836
|
kametic/specifications
|
src/main/java/org/kametic/specifications/Specifications.java
|
Specifications.not
|
public static <T> Specification<T> not(Specification<T> proposition) {
return new NotSpecification<T>(proposition);
}
|
java
|
public static <T> Specification<T> not(Specification<T> proposition) {
return new NotSpecification<T>(proposition);
}
|
[
"public",
"static",
"<",
"T",
">",
"Specification",
"<",
"T",
">",
"not",
"(",
"Specification",
"<",
"T",
">",
"proposition",
")",
"{",
"return",
"new",
"NotSpecification",
"<",
"T",
">",
"(",
"proposition",
")",
";",
"}"
] |
Returns a specification expecting that the given specification is not satisfied.
@param <T> the specification type
@param proposition the specification
@return a NotSpecification
|
[
"Returns",
"a",
"specification",
"expecting",
"that",
"the",
"given",
"specification",
"is",
"not",
"satisfied",
"."
] |
7453ced475355bac8adae7605e259354e0a96479
|
https://github.com/kametic/specifications/blob/7453ced475355bac8adae7605e259354e0a96479/src/main/java/org/kametic/specifications/Specifications.java#L55-L57
|
151,837
|
jbundle/jbundle
|
thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java
|
CalendarThinTableModel.getFieldListProxy
|
public CalendarItem getFieldListProxy(FieldList fieldList)
{
return new CalendarItemFieldListProxy(fieldList, m_strStartDateTimeField, m_strEndDateTimeField, m_strDescriptionField, m_strStatusField);
}
|
java
|
public CalendarItem getFieldListProxy(FieldList fieldList)
{
return new CalendarItemFieldListProxy(fieldList, m_strStartDateTimeField, m_strEndDateTimeField, m_strDescriptionField, m_strStatusField);
}
|
[
"public",
"CalendarItem",
"getFieldListProxy",
"(",
"FieldList",
"fieldList",
")",
"{",
"return",
"new",
"CalendarItemFieldListProxy",
"(",
"fieldList",
",",
"m_strStartDateTimeField",
",",
"m_strEndDateTimeField",
",",
"m_strDescriptionField",
",",
"m_strStatusField",
")",
";",
"}"
] |
Create a CalendarItem Proxy using this field list.
Usually, you use CalendarItemFieldListProxy, or override it.
|
[
"Create",
"a",
"CalendarItem",
"Proxy",
"using",
"this",
"field",
"list",
".",
"Usually",
"you",
"use",
"CalendarItemFieldListProxy",
"or",
"override",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java#L129-L132
|
151,838
|
jbundle/jbundle
|
thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java
|
CalendarThinTableModel.fireTableRowSelected
|
public void fireTableRowSelected(Object source, int iRowIndex, int iSelectionType)
{
this.fireMySelectionChanged(new MyListSelectionEvent(source, this, iRowIndex, iSelectionType));
}
|
java
|
public void fireTableRowSelected(Object source, int iRowIndex, int iSelectionType)
{
this.fireMySelectionChanged(new MyListSelectionEvent(source, this, iRowIndex, iSelectionType));
}
|
[
"public",
"void",
"fireTableRowSelected",
"(",
"Object",
"source",
",",
"int",
"iRowIndex",
",",
"int",
"iSelectionType",
")",
"{",
"this",
".",
"fireMySelectionChanged",
"(",
"new",
"MyListSelectionEvent",
"(",
"source",
",",
"this",
",",
"iRowIndex",
",",
"iSelectionType",
")",
")",
";",
"}"
] |
Notify listeners this row is selected; pass a -1 to de-select all rows.
|
[
"Notify",
"listeners",
"this",
"row",
"is",
"selected",
";",
"pass",
"a",
"-",
"1",
"to",
"de",
"-",
"select",
"all",
"rows",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java#L136-L139
|
151,839
|
jbundle/jbundle
|
thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java
|
CalendarThinTableModel.fireMySelectionChanged
|
protected void fireMySelectionChanged(MyListSelectionEvent event)
{
this.selectionChanged(event.getSource(), event.getRow(), event.getRow(), event.getType()); // Make sure model knows
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2)
{
if (listeners[i] == MyListSelectionListener.class)
if (listeners[i] != event.getSource()) // Don't send it back to source
{ // Send this message
((MyListSelectionListener)listeners[i+1]).selectionChanged(event);
}
}
}
|
java
|
protected void fireMySelectionChanged(MyListSelectionEvent event)
{
this.selectionChanged(event.getSource(), event.getRow(), event.getRow(), event.getType()); // Make sure model knows
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2)
{
if (listeners[i] == MyListSelectionListener.class)
if (listeners[i] != event.getSource()) // Don't send it back to source
{ // Send this message
((MyListSelectionListener)listeners[i+1]).selectionChanged(event);
}
}
}
|
[
"protected",
"void",
"fireMySelectionChanged",
"(",
"MyListSelectionEvent",
"event",
")",
"{",
"this",
".",
"selectionChanged",
"(",
"event",
".",
"getSource",
"(",
")",
",",
"event",
".",
"getRow",
"(",
")",
",",
"event",
".",
"getRow",
"(",
")",
",",
"event",
".",
"getType",
"(",
")",
")",
";",
"// Make sure model knows",
"// Guaranteed to return a non-null array",
"Object",
"[",
"]",
"listeners",
"=",
"listenerList",
".",
"getListenerList",
"(",
")",
";",
"// Process the listeners last to first, notifying",
"// those that are interested in this event",
"for",
"(",
"int",
"i",
"=",
"listeners",
".",
"length",
"-",
"2",
";",
"i",
">=",
"0",
";",
"i",
"-=",
"2",
")",
"{",
"if",
"(",
"listeners",
"[",
"i",
"]",
"==",
"MyListSelectionListener",
".",
"class",
")",
"if",
"(",
"listeners",
"[",
"i",
"]",
"!=",
"event",
".",
"getSource",
"(",
")",
")",
"// Don't send it back to source",
"{",
"// Send this message",
"(",
"(",
"MyListSelectionListener",
")",
"listeners",
"[",
"i",
"+",
"1",
"]",
")",
".",
"selectionChanged",
"(",
"event",
")",
";",
"}",
"}",
"}"
] |
Notify all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the parameters passed into
the fire method.
|
[
"Notify",
"all",
"listeners",
"that",
"have",
"registered",
"interest",
"for",
"notification",
"on",
"this",
"event",
"type",
".",
"The",
"event",
"instance",
"is",
"lazily",
"created",
"using",
"the",
"parameters",
"passed",
"into",
"the",
"fire",
"method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/grid/src/main/java/org/jbundle/thin/base/screen/cal/grid/CalendarThinTableModel.java#L164-L179
|
151,840
|
schwa-lab/libschwa-java
|
src/main/java/org/schwa/dr/Store.java
|
Store.clear
|
@Override
public void clear() {
for (T obj : items)
obj.setDRIndex(null);
items.clear();
}
|
java
|
@Override
public void clear() {
for (T obj : items)
obj.setDRIndex(null);
items.clear();
}
|
[
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"for",
"(",
"T",
"obj",
":",
"items",
")",
"obj",
".",
"setDRIndex",
"(",
"null",
")",
";",
"items",
".",
"clear",
"(",
")",
";",
"}"
] |
Removes all annotation instances from the store, setting their drIndex values to null in the
process.
|
[
"Removes",
"all",
"annotation",
"instances",
"from",
"the",
"store",
"setting",
"their",
"drIndex",
"values",
"to",
"null",
"in",
"the",
"process",
"."
] |
83a2330e212bbc0fcd62be12453424736d997f41
|
https://github.com/schwa-lab/libschwa-java/blob/83a2330e212bbc0fcd62be12453424736d997f41/src/main/java/org/schwa/dr/Store.java#L71-L76
|
151,841
|
schwa-lab/libschwa-java
|
src/main/java/org/schwa/dr/Store.java
|
Store.create
|
public T create(final Class<T> klass) {
T obj;
try {
obj = (T) klass.newInstance();
}
catch (IllegalAccessException e) {
throw new DocrepException(e);
}
catch (InstantiationException e) {
throw new DocrepException(e);
}
add(obj);
return obj;
}
|
java
|
public T create(final Class<T> klass) {
T obj;
try {
obj = (T) klass.newInstance();
}
catch (IllegalAccessException e) {
throw new DocrepException(e);
}
catch (InstantiationException e) {
throw new DocrepException(e);
}
add(obj);
return obj;
}
|
[
"public",
"T",
"create",
"(",
"final",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"T",
"obj",
";",
"try",
"{",
"obj",
"=",
"(",
"T",
")",
"klass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"DocrepException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"throw",
"new",
"DocrepException",
"(",
"e",
")",
";",
"}",
"add",
"(",
"obj",
")",
";",
"return",
"obj",
";",
"}"
] |
Creates a new annotation instance, adds it to the store, and returns the instance. This is
simply a convenience method to save the user from creating and adding to the store
separately.
|
[
"Creates",
"a",
"new",
"annotation",
"instance",
"adds",
"it",
"to",
"the",
"store",
"and",
"returns",
"the",
"instance",
".",
"This",
"is",
"simply",
"a",
"convenience",
"method",
"to",
"save",
"the",
"user",
"from",
"creating",
"and",
"adding",
"to",
"the",
"store",
"separately",
"."
] |
83a2330e212bbc0fcd62be12453424736d997f41
|
https://github.com/schwa-lab/libschwa-java/blob/83a2330e212bbc0fcd62be12453424736d997f41/src/main/java/org/schwa/dr/Store.java#L93-L106
|
151,842
|
schwa-lab/libschwa-java
|
src/main/java/org/schwa/dr/Store.java
|
Store.create
|
public void create(final Class<T> klass, final int n) {
for (int i = 0; i != n; i++)
create(klass);
}
|
java
|
public void create(final Class<T> klass, final int n) {
for (int i = 0; i != n; i++)
create(klass);
}
|
[
"public",
"void",
"create",
"(",
"final",
"Class",
"<",
"T",
">",
"klass",
",",
"final",
"int",
"n",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"n",
";",
"i",
"++",
")",
"create",
"(",
"klass",
")",
";",
"}"
] |
Creates n new annotation instances, adding them all to the store.
@see Store#create(Class)
|
[
"Creates",
"n",
"new",
"annotation",
"instances",
"adding",
"them",
"all",
"to",
"the",
"store",
"."
] |
83a2330e212bbc0fcd62be12453424736d997f41
|
https://github.com/schwa-lab/libschwa-java/blob/83a2330e212bbc0fcd62be12453424736d997f41/src/main/java/org/schwa/dr/Store.java#L113-L116
|
151,843
|
OwlPlatform/java-owl-solver
|
src/main/java/com/owlplatform/solver/protocol/messages/HandshakeMessage.java
|
HandshakeMessage.getDefaultMessage
|
public static HandshakeMessage getDefaultMessage() {
HandshakeMessage message = new HandshakeMessage();
message.setProtocolString(HandshakeMessage.PROTOCOL_STRING);
message.setReservedBits(HandshakeMessage.PROTOCOL_RESERVED_BITS);
message.setStringLength(HandshakeMessage.PROTOCOL_STRING_LENGTH);
message.setVersionNumber(HandshakeMessage.PROTOCOL_VERSION);
return message;
}
|
java
|
public static HandshakeMessage getDefaultMessage() {
HandshakeMessage message = new HandshakeMessage();
message.setProtocolString(HandshakeMessage.PROTOCOL_STRING);
message.setReservedBits(HandshakeMessage.PROTOCOL_RESERVED_BITS);
message.setStringLength(HandshakeMessage.PROTOCOL_STRING_LENGTH);
message.setVersionNumber(HandshakeMessage.PROTOCOL_VERSION);
return message;
}
|
[
"public",
"static",
"HandshakeMessage",
"getDefaultMessage",
"(",
")",
"{",
"HandshakeMessage",
"message",
"=",
"new",
"HandshakeMessage",
"(",
")",
";",
"message",
".",
"setProtocolString",
"(",
"HandshakeMessage",
".",
"PROTOCOL_STRING",
")",
";",
"message",
".",
"setReservedBits",
"(",
"HandshakeMessage",
".",
"PROTOCOL_RESERVED_BITS",
")",
";",
"message",
".",
"setStringLength",
"(",
"HandshakeMessage",
".",
"PROTOCOL_STRING_LENGTH",
")",
";",
"message",
".",
"setVersionNumber",
"(",
"HandshakeMessage",
".",
"PROTOCOL_VERSION",
")",
";",
"return",
"message",
";",
"}"
] |
Generates a basic handshake message according to the most recent protocol
definition.
@return a basic handshake message.
|
[
"Generates",
"a",
"basic",
"handshake",
"message",
"according",
"to",
"the",
"most",
"recent",
"protocol",
"definition",
"."
] |
53a1faabd63613c716203922cd52f871e5fedb9b
|
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/protocol/messages/HandshakeMessage.java#L77-L84
|
151,844
|
OwlPlatform/java-owl-solver
|
src/main/java/com/owlplatform/solver/protocol/messages/HandshakeMessage.java
|
HandshakeMessage.setProtocolString
|
public void setProtocolString(String protocolString) {
this.protocolString = protocolString;
if (protocolString != null) {
try {
this.stringLength = protocolString.getBytes("US-ASCII").length;
} catch (UnsupportedEncodingException uee) {
this.stringLength = 0;
log.error("Couldn't encode to US-ASCII.", uee);
}
} else {
this.stringLength = 0;
}
}
|
java
|
public void setProtocolString(String protocolString) {
this.protocolString = protocolString;
if (protocolString != null) {
try {
this.stringLength = protocolString.getBytes("US-ASCII").length;
} catch (UnsupportedEncodingException uee) {
this.stringLength = 0;
log.error("Couldn't encode to US-ASCII.", uee);
}
} else {
this.stringLength = 0;
}
}
|
[
"public",
"void",
"setProtocolString",
"(",
"String",
"protocolString",
")",
"{",
"this",
".",
"protocolString",
"=",
"protocolString",
";",
"if",
"(",
"protocolString",
"!=",
"null",
")",
"{",
"try",
"{",
"this",
".",
"stringLength",
"=",
"protocolString",
".",
"getBytes",
"(",
"\"US-ASCII\"",
")",
".",
"length",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"uee",
")",
"{",
"this",
".",
"stringLength",
"=",
"0",
";",
"log",
".",
"error",
"(",
"\"Couldn't encode to US-ASCII.\"",
",",
"uee",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"stringLength",
"=",
"0",
";",
"}",
"}"
] |
Sets the protocol string for this handshake message.
@param protocolString
the protocol string for this handshake message.
|
[
"Sets",
"the",
"protocol",
"string",
"for",
"this",
"handshake",
"message",
"."
] |
53a1faabd63613c716203922cd52f871e5fedb9b
|
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/protocol/messages/HandshakeMessage.java#L142-L154
|
151,845
|
bremersee/pagebuilder
|
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java
|
PageDto.getPageRequest
|
@XmlElement(name = "pageRequest", required = true)
@JsonProperty(value = "pageRequest", required = true)
@ApiModelProperty(value = "The page request.", position = 1, required = true)
@Override
public PageRequestDto getPageRequest() {
if (this.pageRequest == null) {
this.pageRequest = new PageRequestDto();
}
return pageRequest;
}
|
java
|
@XmlElement(name = "pageRequest", required = true)
@JsonProperty(value = "pageRequest", required = true)
@ApiModelProperty(value = "The page request.", position = 1, required = true)
@Override
public PageRequestDto getPageRequest() {
if (this.pageRequest == null) {
this.pageRequest = new PageRequestDto();
}
return pageRequest;
}
|
[
"@",
"XmlElement",
"(",
"name",
"=",
"\"pageRequest\"",
",",
"required",
"=",
"true",
")",
"@",
"JsonProperty",
"(",
"value",
"=",
"\"pageRequest\"",
",",
"required",
"=",
"true",
")",
"@",
"ApiModelProperty",
"(",
"value",
"=",
"\"The page request.\"",
",",
"position",
"=",
"1",
",",
"required",
"=",
"true",
")",
"@",
"Override",
"public",
"PageRequestDto",
"getPageRequest",
"(",
")",
"{",
"if",
"(",
"this",
".",
"pageRequest",
"==",
"null",
")",
"{",
"this",
".",
"pageRequest",
"=",
"new",
"PageRequestDto",
"(",
")",
";",
"}",
"return",
"pageRequest",
";",
"}"
] |
Returns the page request.
@return the page request
|
[
"Returns",
"the",
"page",
"request",
"."
] |
498614b02f577b08d2d65131ba472a09f080a192
|
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java#L174-L183
|
151,846
|
bremersee/pagebuilder
|
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java
|
PageDto.getTotalSize
|
@XmlElement(name = "totalSize", required = true)
@JsonProperty(value = "totalSize", required = true)
@ApiModelProperty(value = "The total size of available elements.", position = 2, required = true)
@Override
public long getTotalSize() {
return totalSize;
}
|
java
|
@XmlElement(name = "totalSize", required = true)
@JsonProperty(value = "totalSize", required = true)
@ApiModelProperty(value = "The total size of available elements.", position = 2, required = true)
@Override
public long getTotalSize() {
return totalSize;
}
|
[
"@",
"XmlElement",
"(",
"name",
"=",
"\"totalSize\"",
",",
"required",
"=",
"true",
")",
"@",
"JsonProperty",
"(",
"value",
"=",
"\"totalSize\"",
",",
"required",
"=",
"true",
")",
"@",
"ApiModelProperty",
"(",
"value",
"=",
"\"The total size of available elements.\"",
",",
"position",
"=",
"2",
",",
"required",
"=",
"true",
")",
"@",
"Override",
"public",
"long",
"getTotalSize",
"(",
")",
"{",
"return",
"totalSize",
";",
"}"
] |
Returns the size of all available elements.
@return the size of all available elements
|
[
"Returns",
"the",
"size",
"of",
"all",
"available",
"elements",
"."
] |
498614b02f577b08d2d65131ba472a09f080a192
|
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java#L200-L206
|
151,847
|
bremersee/pagebuilder
|
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java
|
PageDto.getTotalPages
|
@XmlElement(name = "totalPages", required = true)
@JsonProperty(value = "totalPages", required = true)
@ApiModelProperty(value = "The total size of available pages.", position = 3, required = true, readOnly = true)
@Override
public int getTotalPages() {
if (getTotalSize() <= 0L) {
return 1;
}
return (int) Math.ceil((double) getTotalSize() / (double) getPageRequest().getPageSize());
}
|
java
|
@XmlElement(name = "totalPages", required = true)
@JsonProperty(value = "totalPages", required = true)
@ApiModelProperty(value = "The total size of available pages.", position = 3, required = true, readOnly = true)
@Override
public int getTotalPages() {
if (getTotalSize() <= 0L) {
return 1;
}
return (int) Math.ceil((double) getTotalSize() / (double) getPageRequest().getPageSize());
}
|
[
"@",
"XmlElement",
"(",
"name",
"=",
"\"totalPages\"",
",",
"required",
"=",
"true",
")",
"@",
"JsonProperty",
"(",
"value",
"=",
"\"totalPages\"",
",",
"required",
"=",
"true",
")",
"@",
"ApiModelProperty",
"(",
"value",
"=",
"\"The total size of available pages.\"",
",",
"position",
"=",
"3",
",",
"required",
"=",
"true",
",",
"readOnly",
"=",
"true",
")",
"@",
"Override",
"public",
"int",
"getTotalPages",
"(",
")",
"{",
"if",
"(",
"getTotalSize",
"(",
")",
"<=",
"0L",
")",
"{",
"return",
"1",
";",
"}",
"return",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"(",
"double",
")",
"getTotalSize",
"(",
")",
"/",
"(",
"double",
")",
"getPageRequest",
"(",
")",
".",
"getPageSize",
"(",
")",
")",
";",
"}"
] |
Returns the number of all pages.
@return the number of all pages
|
[
"Returns",
"the",
"number",
"of",
"all",
"pages",
"."
] |
498614b02f577b08d2d65131ba472a09f080a192
|
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PageDto.java#L223-L232
|
151,848
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java
|
BridgeHeadTypeRegistry.register
|
public void register(BridgeFactory bridgeFactory) {
Class<?> nearType = bridgeFactory.getNearType();
Class<?> farType = bridgeFactory.getFarType();
logger.trace(display(nearType) + ": " + display(farType));
nearToFarType.put(nearType, farType);
farToNearType.put(farType, nearType);
nearTypeToFactory.put(nearType, bridgeFactory);
farTypeToFactory.put(farType, bridgeFactory);
if (accessors.containsKey(nearType)) {
for (FactoryAccessor<?> accessor : accessors.get(nearType)) {
injectInto(accessor);
}
accessors.remove(nearType);
}
}
|
java
|
public void register(BridgeFactory bridgeFactory) {
Class<?> nearType = bridgeFactory.getNearType();
Class<?> farType = bridgeFactory.getFarType();
logger.trace(display(nearType) + ": " + display(farType));
nearToFarType.put(nearType, farType);
farToNearType.put(farType, nearType);
nearTypeToFactory.put(nearType, bridgeFactory);
farTypeToFactory.put(farType, bridgeFactory);
if (accessors.containsKey(nearType)) {
for (FactoryAccessor<?> accessor : accessors.get(nearType)) {
injectInto(accessor);
}
accessors.remove(nearType);
}
}
|
[
"public",
"void",
"register",
"(",
"BridgeFactory",
"bridgeFactory",
")",
"{",
"Class",
"<",
"?",
">",
"nearType",
"=",
"bridgeFactory",
".",
"getNearType",
"(",
")",
";",
"Class",
"<",
"?",
">",
"farType",
"=",
"bridgeFactory",
".",
"getFarType",
"(",
")",
";",
"logger",
".",
"trace",
"(",
"display",
"(",
"nearType",
")",
"+",
"\": \"",
"+",
"display",
"(",
"farType",
")",
")",
";",
"nearToFarType",
".",
"put",
"(",
"nearType",
",",
"farType",
")",
";",
"farToNearType",
".",
"put",
"(",
"farType",
",",
"nearType",
")",
";",
"nearTypeToFactory",
".",
"put",
"(",
"nearType",
",",
"bridgeFactory",
")",
";",
"farTypeToFactory",
".",
"put",
"(",
"farType",
",",
"bridgeFactory",
")",
";",
"if",
"(",
"accessors",
".",
"containsKey",
"(",
"nearType",
")",
")",
"{",
"for",
"(",
"FactoryAccessor",
"<",
"?",
">",
"accessor",
":",
"accessors",
".",
"get",
"(",
"nearType",
")",
")",
"{",
"injectInto",
"(",
"accessor",
")",
";",
"}",
"accessors",
".",
"remove",
"(",
"nearType",
")",
";",
"}",
"}"
] |
Registers the given bridge factory and its bridge head types.
@param bridgeFactory The bridge factory to register
|
[
"Registers",
"the",
"given",
"bridge",
"factory",
"and",
"its",
"bridge",
"head",
"types",
"."
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java#L43-L57
|
151,849
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java
|
BridgeHeadTypeRegistry.getFarType
|
public Class<?> getFarType(Class<?> nearType) {
if (!nearToFarType.containsKey(nearType)) {
throw new IllegalStateException("Near type not registered: " + (nearType == null ? "null" : nearType.getSimpleName()));
}
return nearToFarType.get(nearType);
}
|
java
|
public Class<?> getFarType(Class<?> nearType) {
if (!nearToFarType.containsKey(nearType)) {
throw new IllegalStateException("Near type not registered: " + (nearType == null ? "null" : nearType.getSimpleName()));
}
return nearToFarType.get(nearType);
}
|
[
"public",
"Class",
"<",
"?",
">",
"getFarType",
"(",
"Class",
"<",
"?",
">",
"nearType",
")",
"{",
"if",
"(",
"!",
"nearToFarType",
".",
"containsKey",
"(",
"nearType",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Near type not registered: \"",
"+",
"(",
"nearType",
"==",
"null",
"?",
"\"null\"",
":",
"nearType",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"return",
"nearToFarType",
".",
"get",
"(",
"nearType",
")",
";",
"}"
] |
Returns the far type that corresponds to the given near type.
@param nearType The near type to look up
@return The corresponding far type
@throws java.lang.IllegalStateException If the given near type is not registered
|
[
"Returns",
"the",
"far",
"type",
"that",
"corresponds",
"to",
"the",
"given",
"near",
"type",
"."
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java#L87-L92
|
151,850
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java
|
BridgeHeadTypeRegistry.getBridgeFactory
|
@SuppressWarnings("unchecked")
public BridgeFactory getBridgeFactory(Class<?> farType) {
if (!farToNearType.containsKey(farType)) {
throw new IllegalStateException("Far type not registered: " + (farType == null ? "null" : farType.getSimpleName()));
}
return farTypeToFactory.get(farType);
}
|
java
|
@SuppressWarnings("unchecked")
public BridgeFactory getBridgeFactory(Class<?> farType) {
if (!farToNearType.containsKey(farType)) {
throw new IllegalStateException("Far type not registered: " + (farType == null ? "null" : farType.getSimpleName()));
}
return farTypeToFactory.get(farType);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"BridgeFactory",
"getBridgeFactory",
"(",
"Class",
"<",
"?",
">",
"farType",
")",
"{",
"if",
"(",
"!",
"farToNearType",
".",
"containsKey",
"(",
"farType",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Far type not registered: \"",
"+",
"(",
"farType",
"==",
"null",
"?",
"\"null\"",
":",
"farType",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"return",
"farTypeToFactory",
".",
"get",
"(",
"farType",
")",
";",
"}"
] |
Returns the bridge factory that corresponds to the given far type
@param farType The far type to look up
@return The corresponding bridge factory
@throws java.lang.IllegalStateException If the given far type is not registered
|
[
"Returns",
"the",
"bridge",
"factory",
"that",
"corresponds",
"to",
"the",
"given",
"far",
"type"
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/BridgeHeadTypeRegistry.java#L100-L106
|
151,851
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/message/trx/transport/xml/XMLMessageReceivingServlet.java
|
XMLMessageReceivingServlet.init
|
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
ServletTask.initServlet(this, BasicServlet.SERVLET_TYPE.XML);
Enumeration<?> paramNames = this.getInitParameterNames();
while (paramNames.hasMoreElements())
{
String strProperty = (String)paramNames.nextElement();
String strValue = this.getInitParameter(strProperty);
m_initProperties.put(strProperty, strValue);
}
}
|
java
|
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
ServletTask.initServlet(this, BasicServlet.SERVLET_TYPE.XML);
Enumeration<?> paramNames = this.getInitParameterNames();
while (paramNames.hasMoreElements())
{
String strProperty = (String)paramNames.nextElement();
String strValue = this.getInitParameter(strProperty);
m_initProperties.put(strProperty, strValue);
}
}
|
[
"public",
"void",
"init",
"(",
"ServletConfig",
"servletConfig",
")",
"throws",
"ServletException",
"{",
"super",
".",
"init",
"(",
"servletConfig",
")",
";",
"ServletTask",
".",
"initServlet",
"(",
"this",
",",
"BasicServlet",
".",
"SERVLET_TYPE",
".",
"XML",
")",
";",
"Enumeration",
"<",
"?",
">",
"paramNames",
"=",
"this",
".",
"getInitParameterNames",
"(",
")",
";",
"while",
"(",
"paramNames",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"strProperty",
"=",
"(",
"String",
")",
"paramNames",
".",
"nextElement",
"(",
")",
";",
"String",
"strValue",
"=",
"this",
".",
"getInitParameter",
"(",
"strProperty",
")",
";",
"m_initProperties",
".",
"put",
"(",
"strProperty",
",",
"strValue",
")",
";",
"}",
"}"
] |
Initialize the servlet.
@param servletConfig The servlet configuration.
|
[
"Initialize",
"the",
"servlet",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/message/trx/transport/xml/XMLMessageReceivingServlet.java#L55-L66
|
151,852
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BooleanField.java
|
BooleanField.convertIndexToString
|
public String convertIndexToString(int index)
{
String tempString = null;
if (index == 0)
tempString = NO;
else if (index == 1)
tempString = YES;
return tempString;
}
|
java
|
public String convertIndexToString(int index)
{
String tempString = null;
if (index == 0)
tempString = NO;
else if (index == 1)
tempString = YES;
return tempString;
}
|
[
"public",
"String",
"convertIndexToString",
"(",
"int",
"index",
")",
"{",
"String",
"tempString",
"=",
"null",
";",
"if",
"(",
"index",
"==",
"0",
")",
"tempString",
"=",
"NO",
";",
"else",
"if",
"(",
"index",
"==",
"1",
")",
"tempString",
"=",
"YES",
";",
"return",
"tempString",
";",
"}"
] |
Convert this index to a string.
This method return N for 0 and Y for 1.
@param index The index to convert.
@return The display string.
|
[
"Convert",
"this",
"index",
"to",
"a",
"string",
".",
"This",
"method",
"return",
"N",
"for",
"0",
"and",
"Y",
"for",
"1",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L113-L121
|
151,853
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BooleanField.java
|
BooleanField.getSQLType
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.BOOLEAN);
if (strType == null)
strType = DBSQLTypes.BYTE; // The default SQL Type (Byte)
return strType;
}
|
java
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.BOOLEAN);
if (strType == null)
strType = DBSQLTypes.BYTE; // The default SQL Type (Byte)
return strType;
}
|
[
"public",
"String",
"getSQLType",
"(",
"boolean",
"bIncludeLength",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DBSQLTypes",
".",
"BOOLEAN",
")",
";",
"if",
"(",
"strType",
"==",
"null",
")",
"strType",
"=",
"DBSQLTypes",
".",
"BYTE",
";",
"// The default SQL Type (Byte)",
"return",
"strType",
";",
"}"
] |
Get the SQL type of this field.
Typically BOOLEAN or BYTE.
@param bIncludeLength Include the field length in this description.
@param properties Database properties to determine the SQL type.
|
[
"Get",
"the",
"SQL",
"type",
"of",
"this",
"field",
".",
"Typically",
"BOOLEAN",
"or",
"BYTE",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L167-L173
|
151,854
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BooleanField.java
|
BooleanField.getValue
|
public double getValue()
{ // Get this field's value
Boolean bField = (Boolean)this.getData(); // Get the physical data
if (bField == null)
return 0;
boolean bValue = bField.booleanValue();
if (bValue == false)
return 0;
else
return 1;
}
|
java
|
public double getValue()
{ // Get this field's value
Boolean bField = (Boolean)this.getData(); // Get the physical data
if (bField == null)
return 0;
boolean bValue = bField.booleanValue();
if (bValue == false)
return 0;
else
return 1;
}
|
[
"public",
"double",
"getValue",
"(",
")",
"{",
"// Get this field's value",
"Boolean",
"bField",
"=",
"(",
"Boolean",
")",
"this",
".",
"getData",
"(",
")",
";",
"// Get the physical data",
"if",
"(",
"bField",
"==",
"null",
")",
"return",
"0",
";",
"boolean",
"bValue",
"=",
"bField",
".",
"booleanValue",
"(",
")",
";",
"if",
"(",
"bValue",
"==",
"false",
")",
"return",
"0",
";",
"else",
"return",
"1",
";",
"}"
] |
Get the Value of this field as a double.
For a boolean, return 0 for false 1 for true.
@return The value of this field.
|
[
"Get",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
".",
"For",
"a",
"boolean",
"return",
"0",
"for",
"false",
"1",
"for",
"true",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L221-L231
|
151,855
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BooleanField.java
|
BooleanField.setValue
|
public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
Boolean bField = Boolean.FALSE;
if (value != 0)
bField = Boolean.TRUE;
int errorCode = this.setData(bField, bDisplayOption, iMoveMode);
return errorCode;
}
|
java
|
public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
Boolean bField = Boolean.FALSE;
if (value != 0)
bField = Boolean.TRUE;
int errorCode = this.setData(bField, bDisplayOption, iMoveMode);
return errorCode;
}
|
[
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Set this field's value",
"Boolean",
"bField",
"=",
"Boolean",
".",
"FALSE",
";",
"if",
"(",
"value",
"!=",
"0",
")",
"bField",
"=",
"Boolean",
".",
"TRUE",
";",
"int",
"errorCode",
"=",
"this",
".",
"setData",
"(",
"bField",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"return",
"errorCode",
";",
"}"
] |
Set the Value of this field as a double.
For a boolean, 0 for false 1 for true.
@param value The value of this field.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success).
|
[
"Set",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
".",
"For",
"a",
"boolean",
"0",
"for",
"false",
"1",
"for",
"true",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L240-L247
|
151,856
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BooleanField.java
|
BooleanField.setToLimit
|
public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value
{ // By default compare as ASCII strings
Boolean bFlag = Boolean.TRUE; // Lowest value (in SQL)
if (iAreaDesc == DBConstants.END_SELECT_KEY)
bFlag = Boolean.FALSE; // Highest value (in SQL - Alpha order)
this.doSetData(bFlag, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE);
}
|
java
|
public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value
{ // By default compare as ASCII strings
Boolean bFlag = Boolean.TRUE; // Lowest value (in SQL)
if (iAreaDesc == DBConstants.END_SELECT_KEY)
bFlag = Boolean.FALSE; // Highest value (in SQL - Alpha order)
this.doSetData(bFlag, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE);
}
|
[
"public",
"void",
"setToLimit",
"(",
"int",
"iAreaDesc",
")",
"// Set this field to the largest or smallest value",
"{",
"// By default compare as ASCII strings",
"Boolean",
"bFlag",
"=",
"Boolean",
".",
"TRUE",
";",
"// Lowest value (in SQL)",
"if",
"(",
"iAreaDesc",
"==",
"DBConstants",
".",
"END_SELECT_KEY",
")",
"bFlag",
"=",
"Boolean",
".",
"FALSE",
";",
"// Highest value (in SQL - Alpha order)",
"this",
".",
"doSetData",
"(",
"bFlag",
",",
"DBConstants",
".",
"DONT_DISPLAY",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"}"
] |
Set to the min or max.
false is highest for boolean fields.
@param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest.
|
[
"Set",
"to",
"the",
"min",
"or",
"max",
".",
"false",
"is",
"highest",
"for",
"boolean",
"fields",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L253-L259
|
151,857
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java
|
ReceiveQueueProxy.addRemoteMessageFilter
|
public BaseMessageFilter addRemoteMessageFilter(BaseMessageFilter messageFilter, RemoteSession remoteSession) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(ADD_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
String strSessionPathID = null;
if (remoteSession instanceof BaseProxy)
{ // Always a SessionProxy
strSessionPathID = ((BaseProxy)remoteSession).getIDPath();
}
transport.addParam(SESSION, strSessionPathID);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
return (BaseMessageFilter)objReturn;
}
|
java
|
public BaseMessageFilter addRemoteMessageFilter(BaseMessageFilter messageFilter, RemoteSession remoteSession) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(ADD_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
String strSessionPathID = null;
if (remoteSession instanceof BaseProxy)
{ // Always a SessionProxy
strSessionPathID = ((BaseProxy)remoteSession).getIDPath();
}
transport.addParam(SESSION, strSessionPathID);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
return (BaseMessageFilter)objReturn;
}
|
[
"public",
"BaseMessageFilter",
"addRemoteMessageFilter",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"RemoteSession",
"remoteSession",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"ADD_REMOTE_MESSAGE_FILTER",
")",
";",
"transport",
".",
"addParam",
"(",
"FILTER",
",",
"messageFilter",
")",
";",
"// Don't use COMMAND",
"String",
"strSessionPathID",
"=",
"null",
";",
"if",
"(",
"remoteSession",
"instanceof",
"BaseProxy",
")",
"{",
"// Always a SessionProxy",
"strSessionPathID",
"=",
"(",
"(",
"BaseProxy",
")",
"remoteSession",
")",
".",
"getIDPath",
"(",
")",
";",
"}",
"transport",
".",
"addParam",
"(",
"SESSION",
",",
"strSessionPathID",
")",
";",
"Object",
"strReturn",
"=",
"transport",
".",
"sendMessageAndGetReply",
"(",
")",
";",
"Object",
"objReturn",
"=",
"transport",
".",
"convertReturnObject",
"(",
"strReturn",
")",
";",
"return",
"(",
"BaseMessageFilter",
")",
"objReturn",
";",
"}"
] |
Add a message filter to this remote receive queue.
@param messageFilter The message filter to add.
@param remoteSession The remote session.
@return The filter ID.
|
[
"Add",
"a",
"message",
"filter",
"to",
"this",
"remote",
"receive",
"queue",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java#L79-L92
|
151,858
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java
|
ReceiveQueueProxy.removeRemoteMessageFilter
|
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
transport.addParam(FREE, bFreeFilter);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
if (objReturn instanceof Boolean)
return ((Boolean)objReturn).booleanValue();
return true;
}
|
java
|
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER);
transport.addParam(FILTER, messageFilter); // Don't use COMMAND
transport.addParam(FREE, bFreeFilter);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
if (objReturn instanceof Boolean)
return ((Boolean)objReturn).booleanValue();
return true;
}
|
[
"public",
"boolean",
"removeRemoteMessageFilter",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"boolean",
"bFreeFilter",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"REMOVE_REMOTE_MESSAGE_FILTER",
")",
";",
"transport",
".",
"addParam",
"(",
"FILTER",
",",
"messageFilter",
")",
";",
"// Don't use COMMAND",
"transport",
".",
"addParam",
"(",
"FREE",
",",
"bFreeFilter",
")",
";",
"Object",
"strReturn",
"=",
"transport",
".",
"sendMessageAndGetReply",
"(",
")",
";",
"Object",
"objReturn",
"=",
"transport",
".",
"convertReturnObject",
"(",
"strReturn",
")",
";",
"if",
"(",
"objReturn",
"instanceof",
"Boolean",
")",
"return",
"(",
"(",
"Boolean",
")",
"objReturn",
")",
".",
"booleanValue",
"(",
")",
";",
"return",
"true",
";",
"}"
] |
Remove this remote message filter.
@param messageFilter The message filter to remove.
@param bFreeFilter If true, free the remote filter.
|
[
"Remove",
"this",
"remote",
"message",
"filter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java#L98-L108
|
151,859
|
jbundle/jbundle
|
main/screen/src/main/java/org/jbundle/main/screen/SContactButtonBox.java
|
SContactButtonBox.getRecord
|
public Record getRecord()
{
ContactField field = (ContactField)m_field;
if (field.getContactTypeField() != null)
{
String strContactTypeID = field.getContactTypeField().toString();
if (field.PROFILE_CONTACT_TYPE_ID.equals(strContactTypeID))
return field.m_recProfile;
}
return m_record;
}
|
java
|
public Record getRecord()
{
ContactField field = (ContactField)m_field;
if (field.getContactTypeField() != null)
{
String strContactTypeID = field.getContactTypeField().toString();
if (field.PROFILE_CONTACT_TYPE_ID.equals(strContactTypeID))
return field.m_recProfile;
}
return m_record;
}
|
[
"public",
"Record",
"getRecord",
"(",
")",
"{",
"ContactField",
"field",
"=",
"(",
"ContactField",
")",
"m_field",
";",
"if",
"(",
"field",
".",
"getContactTypeField",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"strContactTypeID",
"=",
"field",
".",
"getContactTypeField",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"field",
".",
"PROFILE_CONTACT_TYPE_ID",
".",
"equals",
"(",
"strContactTypeID",
")",
")",
"return",
"field",
".",
"m_recProfile",
";",
"}",
"return",
"m_record",
";",
"}"
] |
GetRecord Method.
|
[
"GetRecord",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/screen/SContactButtonBox.java#L68-L78
|
151,860
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
|
ContentRepository.doBefore
|
private void doBefore() throws Throwable { //NOSONAR
this.repository = this.createRepository();
doStateTransition(State.CREATED);
this.initialize();
doStateTransition(State.INITIALIZED);
}
|
java
|
private void doBefore() throws Throwable { //NOSONAR
this.repository = this.createRepository();
doStateTransition(State.CREATED);
this.initialize();
doStateTransition(State.INITIALIZED);
}
|
[
"private",
"void",
"doBefore",
"(",
")",
"throws",
"Throwable",
"{",
"//NOSONAR",
"this",
".",
"repository",
"=",
"this",
".",
"createRepository",
"(",
")",
";",
"doStateTransition",
"(",
"State",
".",
"CREATED",
")",
";",
"this",
".",
"initialize",
"(",
")",
";",
"doStateTransition",
"(",
"State",
".",
"INITIALIZED",
")",
";",
"}"
] |
Creates and initializes the repository. At first the repository is created, transitioning the state to CREATED.
Afterwards the repository is initialized and transitioned to INITIALIZED.
|
[
"Creates",
"and",
"initializes",
"the",
"repository",
".",
"At",
"first",
"the",
"repository",
"is",
"created",
"transitioning",
"the",
"state",
"to",
"CREATED",
".",
"Afterwards",
"the",
"repository",
"is",
"initialized",
"and",
"transitioned",
"to",
"INITIALIZED",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L152-L158
|
151,861
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
|
ContentRepository.login
|
public Session login(final String userId, final String password) throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
return this.repository.login(new SimpleCredentials(userId, password.toCharArray()));
}
|
java
|
public Session login(final String userId, final String password) throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
return this.repository.login(new SimpleCredentials(userId, password.toCharArray()));
}
|
[
"public",
"Session",
"login",
"(",
"final",
"String",
"userId",
",",
"final",
"String",
"password",
")",
"throws",
"RepositoryException",
"{",
"assertStateAfterOrEqual",
"(",
"State",
".",
"CREATED",
")",
";",
"return",
"this",
".",
"repository",
".",
"login",
"(",
"new",
"SimpleCredentials",
"(",
"userId",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"}"
] |
Logs into the repository with the given credentials. The created session is not managed and be logged out after
use by the caller.
@param userId
the user id to log in
@param password
the password for the user
@return the {@link Session} for the user
@throws RepositoryException
if the login failed for a repository internal error
|
[
"Logs",
"into",
"the",
"repository",
"with",
"the",
"given",
"credentials",
".",
"The",
"created",
"session",
"is",
"not",
"managed",
"and",
"be",
"logged",
"out",
"after",
"use",
"by",
"the",
"caller",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L215-L219
|
151,862
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
|
ContentRepository.clearACL
|
public void clearACL(String path, String... principalNames) throws RepositoryException {
final Session session = this.getAdminSession();
final AccessControlManager acm = session.getAccessControlManager();
final AccessControlList acl = this.getAccessControlList(session, path);
final String[] principals;
if (principalNames.length == 0) {
// remove all existing entries
principals = new String[] { ANY_WILDCARD };
} else {
principals = principalNames;
}
for (String username : principals) {
this.removeAccessControlEntries(acl, username);
}
// the policy must be re-set
acm.setPolicy(path, acl);
session.save();
}
|
java
|
public void clearACL(String path, String... principalNames) throws RepositoryException {
final Session session = this.getAdminSession();
final AccessControlManager acm = session.getAccessControlManager();
final AccessControlList acl = this.getAccessControlList(session, path);
final String[] principals;
if (principalNames.length == 0) {
// remove all existing entries
principals = new String[] { ANY_WILDCARD };
} else {
principals = principalNames;
}
for (String username : principals) {
this.removeAccessControlEntries(acl, username);
}
// the policy must be re-set
acm.setPolicy(path, acl);
session.save();
}
|
[
"public",
"void",
"clearACL",
"(",
"String",
"path",
",",
"String",
"...",
"principalNames",
")",
"throws",
"RepositoryException",
"{",
"final",
"Session",
"session",
"=",
"this",
".",
"getAdminSession",
"(",
")",
";",
"final",
"AccessControlManager",
"acm",
"=",
"session",
".",
"getAccessControlManager",
"(",
")",
";",
"final",
"AccessControlList",
"acl",
"=",
"this",
".",
"getAccessControlList",
"(",
"session",
",",
"path",
")",
";",
"final",
"String",
"[",
"]",
"principals",
";",
"if",
"(",
"principalNames",
".",
"length",
"==",
"0",
")",
"{",
"// remove all existing entries",
"principals",
"=",
"new",
"String",
"[",
"]",
"{",
"ANY_WILDCARD",
"}",
";",
"}",
"else",
"{",
"principals",
"=",
"principalNames",
";",
"}",
"for",
"(",
"String",
"username",
":",
"principals",
")",
"{",
"this",
".",
"removeAccessControlEntries",
"(",
"acl",
",",
"username",
")",
";",
"}",
"// the policy must be re-set",
"acm",
".",
"setPolicy",
"(",
"path",
",",
"acl",
")",
";",
"session",
".",
"save",
"(",
")",
";",
"}"
] |
Removes all ACLs on the node specified by the path.
@param path
the absolute path to the node
@param principalNames
the user(s) whose ACL entries should be removed. If none is provided, all ACLs will be removed. A word
of warning, if you invoke this on the root node '/' all ACls including those for administrators
and everyone-principal will be removed, rendering the entire repository useless.
|
[
"Removes",
"all",
"ACLs",
"on",
"the",
"node",
"specified",
"by",
"the",
"path",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L437-L459
|
151,863
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
|
ContentRepository.removeAccessControlEntry
|
private void removeAccessControlEntry(final AccessControlList acList,
final AccessControlEntry acEntry,
final String principalName) throws RepositoryException {
if (ANY_WILDCARD.equals(principalName) || acEntry.getPrincipal().getName().equals(principalName)) {
acList.removeAccessControlEntry(acEntry);
}
}
|
java
|
private void removeAccessControlEntry(final AccessControlList acList,
final AccessControlEntry acEntry,
final String principalName) throws RepositoryException {
if (ANY_WILDCARD.equals(principalName) || acEntry.getPrincipal().getName().equals(principalName)) {
acList.removeAccessControlEntry(acEntry);
}
}
|
[
"private",
"void",
"removeAccessControlEntry",
"(",
"final",
"AccessControlList",
"acList",
",",
"final",
"AccessControlEntry",
"acEntry",
",",
"final",
"String",
"principalName",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"ANY_WILDCARD",
".",
"equals",
"(",
"principalName",
")",
"||",
"acEntry",
".",
"getPrincipal",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"principalName",
")",
")",
"{",
"acList",
".",
"removeAccessControlEntry",
"(",
"acEntry",
")",
";",
"}",
"}"
] |
Removes the specified access control entry if the given principal name matches the principal associated with the
entry.
@param acList
the access control list to remove the entry from
@param acEntry
the entry to be potentially removed
@param principalName
the name of the principal to match. Use the '*' wildcard to match all principal.
@throws RepositoryException
if the entry removal failed
|
[
"Removes",
"the",
"specified",
"access",
"control",
"entry",
"if",
"the",
"given",
"principal",
"name",
"matches",
"the",
"principal",
"associated",
"with",
"the",
"entry",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L495-L502
|
151,864
|
fuinorg/utils4swing
|
src/main/java/org/fuin/utils4swing/common/AbstractScreenPositioner.java
|
AbstractScreenPositioner.checkMaxSize
|
protected final void checkMaxSize(final Dimension screenSize,
final Dimension frameSize) {
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
}
|
java
|
protected final void checkMaxSize(final Dimension screenSize,
final Dimension frameSize) {
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
}
|
[
"protected",
"final",
"void",
"checkMaxSize",
"(",
"final",
"Dimension",
"screenSize",
",",
"final",
"Dimension",
"frameSize",
")",
"{",
"if",
"(",
"frameSize",
".",
"height",
">",
"screenSize",
".",
"height",
")",
"{",
"frameSize",
".",
"height",
"=",
"screenSize",
".",
"height",
";",
"}",
"if",
"(",
"frameSize",
".",
"width",
">",
"screenSize",
".",
"width",
")",
"{",
"frameSize",
".",
"width",
"=",
"screenSize",
".",
"width",
";",
"}",
"}"
] |
Adjusts the width and height of the fraem if it's greater than the
screen.
@param screenSize Screen size.
@param frameSize Frame size.
|
[
"Adjusts",
"the",
"width",
"and",
"height",
"of",
"the",
"fraem",
"if",
"it",
"s",
"greater",
"than",
"the",
"screen",
"."
] |
560fb69eac182e3473de9679c3c15433e524ef6b
|
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/AbstractScreenPositioner.java#L51-L59
|
151,865
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/XYSamples.java
|
XYSamples.add
|
public void add(double x, double y)
{
if (count >= xarr.length)
{
grow();
}
xarr[count] = x;
yarr[count++] = y;
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
|
java
|
public void add(double x, double y)
{
if (count >= xarr.length)
{
grow();
}
xarr[count] = x;
yarr[count++] = y;
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
|
[
"public",
"void",
"add",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"count",
">=",
"xarr",
".",
"length",
")",
"{",
"grow",
"(",
")",
";",
"}",
"xarr",
"[",
"count",
"]",
"=",
"x",
";",
"yarr",
"[",
"count",
"++",
"]",
"=",
"y",
";",
"minX",
"=",
"Math",
".",
"min",
"(",
"minX",
",",
"x",
")",
";",
"minY",
"=",
"Math",
".",
"min",
"(",
"minY",
",",
"y",
")",
";",
"maxX",
"=",
"Math",
".",
"max",
"(",
"maxX",
",",
"x",
")",
";",
"maxY",
"=",
"Math",
".",
"max",
"(",
"maxY",
",",
"y",
")",
";",
"}"
] |
Adds sample and grows if necessary.
@param x
@param y
|
[
"Adds",
"sample",
"and",
"grows",
"if",
"necessary",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/XYSamples.java#L71-L83
|
151,866
|
GII/broccoli
|
broccoli-api/src/main/java/com/hi3project/broccoli/bsdl/impl/meta/MetaPropertyVersion.java
|
MetaPropertyVersion.compareTo
|
private static int compareTo(Deque<String> first, Deque<String> second) {
if (0 == first.size() && 0 == second.size()) {
return 0;
}
if (0 == first.size()) {
return 1;
}
if (0 == second.size()) {
return -1;
}
int headsComparation = (Integer.valueOf(first.remove())).compareTo(Integer.parseInt(second.remove()));
if (0 == headsComparation) {
return compareTo(first, second);
} else {
return headsComparation;
}
}
|
java
|
private static int compareTo(Deque<String> first, Deque<String> second) {
if (0 == first.size() && 0 == second.size()) {
return 0;
}
if (0 == first.size()) {
return 1;
}
if (0 == second.size()) {
return -1;
}
int headsComparation = (Integer.valueOf(first.remove())).compareTo(Integer.parseInt(second.remove()));
if (0 == headsComparation) {
return compareTo(first, second);
} else {
return headsComparation;
}
}
|
[
"private",
"static",
"int",
"compareTo",
"(",
"Deque",
"<",
"String",
">",
"first",
",",
"Deque",
"<",
"String",
">",
"second",
")",
"{",
"if",
"(",
"0",
"==",
"first",
".",
"size",
"(",
")",
"&&",
"0",
"==",
"second",
".",
"size",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"0",
"==",
"first",
".",
"size",
"(",
")",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"0",
"==",
"second",
".",
"size",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"headsComparation",
"=",
"(",
"Integer",
".",
"valueOf",
"(",
"first",
".",
"remove",
"(",
")",
")",
")",
".",
"compareTo",
"(",
"Integer",
".",
"parseInt",
"(",
"second",
".",
"remove",
"(",
")",
")",
")",
";",
"if",
"(",
"0",
"==",
"headsComparation",
")",
"{",
"return",
"compareTo",
"(",
"first",
",",
"second",
")",
";",
"}",
"else",
"{",
"return",
"headsComparation",
";",
"}",
"}"
] |
Compares two string ordered lists containing numbers.
@return -1 when first group is higher, 0 if equals, 1 when second group is higher
|
[
"Compares",
"two",
"string",
"ordered",
"lists",
"containing",
"numbers",
"."
] |
a3033a90322cbcee4dc0f1719143b84b822bc4ba
|
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-api/src/main/java/com/hi3project/broccoli/bsdl/impl/meta/MetaPropertyVersion.java#L82-L98
|
151,867
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellThreeStateCheckBox.java
|
JCellThreeStateCheckBox.setControlValue
|
public void setControlValue(Object objValue)
{
if (objValue instanceof String)
{
if (((String)objValue).equalsIgnoreCase(Constants.TRUE))
objValue = Boolean.TRUE;
else if (((String)objValue).equalsIgnoreCase(Constants.FALSE))
objValue = Boolean.FALSE;
}
super.setControlValue(objValue);
}
|
java
|
public void setControlValue(Object objValue)
{
if (objValue instanceof String)
{
if (((String)objValue).equalsIgnoreCase(Constants.TRUE))
objValue = Boolean.TRUE;
else if (((String)objValue).equalsIgnoreCase(Constants.FALSE))
objValue = Boolean.FALSE;
}
super.setControlValue(objValue);
}
|
[
"public",
"void",
"setControlValue",
"(",
"Object",
"objValue",
")",
"{",
"if",
"(",
"objValue",
"instanceof",
"String",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"objValue",
")",
".",
"equalsIgnoreCase",
"(",
"Constants",
".",
"TRUE",
")",
")",
"objValue",
"=",
"Boolean",
".",
"TRUE",
";",
"else",
"if",
"(",
"(",
"(",
"String",
")",
"objValue",
")",
".",
"equalsIgnoreCase",
"(",
"Constants",
".",
"FALSE",
")",
")",
"objValue",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"super",
".",
"setControlValue",
"(",
"objValue",
")",
";",
"}"
] |
Set the value of this control.
|
[
"Set",
"the",
"value",
"of",
"this",
"control",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellThreeStateCheckBox.java#L190-L200
|
151,868
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java
|
BaseProxy.getIDPath
|
public String getIDPath()
{
String strIDPath = this.getID();
if (this.getParentProxy() != null)
{
String strParentPath = this.getParentProxy().getIDPath();
if (strParentPath != null)
strIDPath = strParentPath + PATH_SEPARATOR + strIDPath;
}
return strIDPath;
}
|
java
|
public String getIDPath()
{
String strIDPath = this.getID();
if (this.getParentProxy() != null)
{
String strParentPath = this.getParentProxy().getIDPath();
if (strParentPath != null)
strIDPath = strParentPath + PATH_SEPARATOR + strIDPath;
}
return strIDPath;
}
|
[
"public",
"String",
"getIDPath",
"(",
")",
"{",
"String",
"strIDPath",
"=",
"this",
".",
"getID",
"(",
")",
";",
"if",
"(",
"this",
".",
"getParentProxy",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"strParentPath",
"=",
"this",
".",
"getParentProxy",
"(",
")",
".",
"getIDPath",
"(",
")",
";",
"if",
"(",
"strParentPath",
"!=",
"null",
")",
"strIDPath",
"=",
"strParentPath",
"+",
"PATH_SEPARATOR",
"+",
"strIDPath",
";",
"}",
"return",
"strIDPath",
";",
"}"
] |
Get the object's lookup ID.
|
[
"Get",
"the",
"object",
"s",
"lookup",
"ID",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java#L73-L83
|
151,869
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java
|
BaseProxy.createProxyTransport
|
public BaseTransport createProxyTransport(String strCommand)
{
BaseTransport transport = null;
if (m_parentProxy != null)
transport = m_parentProxy.createProxyTransport(strCommand);
transport.setProperty(TARGET, this.getIDPath()); // Only the outermost call will end up with the full path ID.
return transport;
}
|
java
|
public BaseTransport createProxyTransport(String strCommand)
{
BaseTransport transport = null;
if (m_parentProxy != null)
transport = m_parentProxy.createProxyTransport(strCommand);
transport.setProperty(TARGET, this.getIDPath()); // Only the outermost call will end up with the full path ID.
return transport;
}
|
[
"public",
"BaseTransport",
"createProxyTransport",
"(",
"String",
"strCommand",
")",
"{",
"BaseTransport",
"transport",
"=",
"null",
";",
"if",
"(",
"m_parentProxy",
"!=",
"null",
")",
"transport",
"=",
"m_parentProxy",
".",
"createProxyTransport",
"(",
"strCommand",
")",
";",
"transport",
".",
"setProperty",
"(",
"TARGET",
",",
"this",
".",
"getIDPath",
"(",
")",
")",
";",
"// Only the outermost call will end up with the full path ID.",
"return",
"transport",
";",
"}"
] |
Create the proxy transport.
@param strCommand The command.
@return The transport.
|
[
"Create",
"the",
"proxy",
"transport",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java#L89-L96
|
151,870
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java
|
BaseProxy.addChildProxy
|
public void addChildProxy(BaseProxy childProxy)
{
String strID = childProxy.getID();
m_hmChildList.put(strID, childProxy);
}
|
java
|
public void addChildProxy(BaseProxy childProxy)
{
String strID = childProxy.getID();
m_hmChildList.put(strID, childProxy);
}
|
[
"public",
"void",
"addChildProxy",
"(",
"BaseProxy",
"childProxy",
")",
"{",
"String",
"strID",
"=",
"childProxy",
".",
"getID",
"(",
")",
";",
"m_hmChildList",
".",
"put",
"(",
"strID",
",",
"childProxy",
")",
";",
"}"
] |
Add this child to the child list.
|
[
"Add",
"this",
"child",
"to",
"the",
"child",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseProxy.java#L108-L112
|
151,871
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/matrix/DoubleBinaryMatrix.java
|
DoubleBinaryMatrix.determinant
|
public DoubleBinaryOperator determinant()
{
int sign = 1;
SumBuilder sum = DoubleBinaryOperators.sumBuilder();
PermutationMatrix pm = PermutationMatrix.getInstance(rows);
int perms = pm.rows;
for (int p=0;p<perms;p++)
{
MultiplyBuilder mul = DoubleBinaryOperators.multiplyBuilder();
for (int i=0;i<rows;i++)
{
mul.add(get(i, pm.get(p, i)));
}
sum.add(DoubleBinaryOperators.sign(sign, mul.build()));
sign = -sign;
}
return sum.build();
}
|
java
|
public DoubleBinaryOperator determinant()
{
int sign = 1;
SumBuilder sum = DoubleBinaryOperators.sumBuilder();
PermutationMatrix pm = PermutationMatrix.getInstance(rows);
int perms = pm.rows;
for (int p=0;p<perms;p++)
{
MultiplyBuilder mul = DoubleBinaryOperators.multiplyBuilder();
for (int i=0;i<rows;i++)
{
mul.add(get(i, pm.get(p, i)));
}
sum.add(DoubleBinaryOperators.sign(sign, mul.build()));
sign = -sign;
}
return sum.build();
}
|
[
"public",
"DoubleBinaryOperator",
"determinant",
"(",
")",
"{",
"int",
"sign",
"=",
"1",
";",
"SumBuilder",
"sum",
"=",
"DoubleBinaryOperators",
".",
"sumBuilder",
"(",
")",
";",
"PermutationMatrix",
"pm",
"=",
"PermutationMatrix",
".",
"getInstance",
"(",
"rows",
")",
";",
"int",
"perms",
"=",
"pm",
".",
"rows",
";",
"for",
"(",
"int",
"p",
"=",
"0",
";",
"p",
"<",
"perms",
";",
"p",
"++",
")",
"{",
"MultiplyBuilder",
"mul",
"=",
"DoubleBinaryOperators",
".",
"multiplyBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
";",
"i",
"++",
")",
"{",
"mul",
".",
"add",
"(",
"get",
"(",
"i",
",",
"pm",
".",
"get",
"(",
"p",
",",
"i",
")",
")",
")",
";",
"}",
"sum",
".",
"add",
"(",
"DoubleBinaryOperators",
".",
"sign",
"(",
"sign",
",",
"mul",
".",
"build",
"(",
")",
")",
")",
";",
"sign",
"=",
"-",
"sign",
";",
"}",
"return",
"sum",
".",
"build",
"(",
")",
";",
"}"
] |
Composes determinant by using permutations
@return
|
[
"Composes",
"determinant",
"by",
"using",
"permutations"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleBinaryMatrix.java#L128-L145
|
151,872
|
jbundle/jbundle
|
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/TreeNodeCellRenderer.java
|
TreeNodeCellRenderer.getTreeCellRendererComponent
|
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
boolean leaf, int row,
boolean hasFocus) {
String stringValue = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
/** Set the text. */
this.setText(stringValue);
/** Tooltips used by the tree. */
// this.setToolTipText(stringValue);
/** Set the image. */
/** if(expanded)
setIcon(expandedIcon);
else if(!leaf)
setIcon(collapsedIcon);
else
setIcon(null);
*/
/** Set the color and the font based on the SampleData userObject. */
NodeData userObject = (NodeData)((DefaultMutableTreeNode)value).getUserObject();
/** Update the selected flag for the next paint. */
this.selected = selected;
if (selected)
this.setOpaque(true);
else
this.setOpaque(false);
return this;
}
|
java
|
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
boolean leaf, int row,
boolean hasFocus) {
String stringValue = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
/** Set the text. */
this.setText(stringValue);
/** Tooltips used by the tree. */
// this.setToolTipText(stringValue);
/** Set the image. */
/** if(expanded)
setIcon(expandedIcon);
else if(!leaf)
setIcon(collapsedIcon);
else
setIcon(null);
*/
/** Set the color and the font based on the SampleData userObject. */
NodeData userObject = (NodeData)((DefaultMutableTreeNode)value).getUserObject();
/** Update the selected flag for the next paint. */
this.selected = selected;
if (selected)
this.setOpaque(true);
else
this.setOpaque(false);
return this;
}
|
[
"public",
"Component",
"getTreeCellRendererComponent",
"(",
"JTree",
"tree",
",",
"Object",
"value",
",",
"boolean",
"selected",
",",
"boolean",
"expanded",
",",
"boolean",
"leaf",
",",
"int",
"row",
",",
"boolean",
"hasFocus",
")",
"{",
"String",
"stringValue",
"=",
"tree",
".",
"convertValueToText",
"(",
"value",
",",
"selected",
",",
"expanded",
",",
"leaf",
",",
"row",
",",
"hasFocus",
")",
";",
"/** Set the text. */",
"this",
".",
"setText",
"(",
"stringValue",
")",
";",
"/** Tooltips used by the tree. */",
"// this.setToolTipText(stringValue);",
"/** Set the image. */",
"/** if(expanded)\n setIcon(expandedIcon);\n else if(!leaf)\n setIcon(collapsedIcon);\n else\n setIcon(null);\n */",
"/** Set the color and the font based on the SampleData userObject. */",
"NodeData",
"userObject",
"=",
"(",
"NodeData",
")",
"(",
"(",
"DefaultMutableTreeNode",
")",
"value",
")",
".",
"getUserObject",
"(",
")",
";",
"/** Update the selected flag for the next paint. */",
"this",
".",
"selected",
"=",
"selected",
";",
"if",
"(",
"selected",
")",
"this",
".",
"setOpaque",
"(",
"true",
")",
";",
"else",
"this",
".",
"setOpaque",
"(",
"false",
")",
";",
"return",
"this",
";",
"}"
] |
This is messaged from JTree whenever it needs to get the size
of the component or it wants to draw it.
This attempts to set the font based on value, which will be
a TreeNode.
|
[
"This",
"is",
"messaged",
"from",
"JTree",
"whenever",
"it",
"needs",
"to",
"get",
"the",
"size",
"of",
"the",
"component",
"or",
"it",
"wants",
"to",
"draw",
"it",
".",
"This",
"attempts",
"to",
"set",
"the",
"font",
"based",
"on",
"value",
"which",
"will",
"be",
"a",
"TreeNode",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/TreeNodeCellRenderer.java#L37-L67
|
151,873
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java
|
Screen.addMainKeyBehavior
|
public void addMainKeyBehavior()
{ // Add the read keyed listener to all unique keys with one field
Record record = this.getMainRecord();
if (record == null)
return;
int keyCount = record.getKeyAreaCount();
for (int keyNumber = DBConstants.MAIN_KEY_AREA; keyNumber < keyCount + DBConstants.MAIN_KEY_AREA; keyNumber++)
{
KeyArea keyAreaInfo = record.getKeyArea(keyNumber);
if (((keyAreaInfo.getUniqueKeyCode() == DBConstants.UNIQUE)
|| (keyAreaInfo.getUniqueKeyCode() == DBConstants.SECONDARY_KEY))
& (keyAreaInfo.getKeyFields() == 1))
{
BaseField mainField = keyAreaInfo.getField(DBConstants.MAIN_KEY_FIELD);
MainFieldHandler readKeyed = new MainFieldHandler(record.getKeyArea(keyNumber).getKeyName());
mainField.addListener(readKeyed);
}
}
}
|
java
|
public void addMainKeyBehavior()
{ // Add the read keyed listener to all unique keys with one field
Record record = this.getMainRecord();
if (record == null)
return;
int keyCount = record.getKeyAreaCount();
for (int keyNumber = DBConstants.MAIN_KEY_AREA; keyNumber < keyCount + DBConstants.MAIN_KEY_AREA; keyNumber++)
{
KeyArea keyAreaInfo = record.getKeyArea(keyNumber);
if (((keyAreaInfo.getUniqueKeyCode() == DBConstants.UNIQUE)
|| (keyAreaInfo.getUniqueKeyCode() == DBConstants.SECONDARY_KEY))
& (keyAreaInfo.getKeyFields() == 1))
{
BaseField mainField = keyAreaInfo.getField(DBConstants.MAIN_KEY_FIELD);
MainFieldHandler readKeyed = new MainFieldHandler(record.getKeyArea(keyNumber).getKeyName());
mainField.addListener(readKeyed);
}
}
}
|
[
"public",
"void",
"addMainKeyBehavior",
"(",
")",
"{",
"// Add the read keyed listener to all unique keys with one field",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
";",
"int",
"keyCount",
"=",
"record",
".",
"getKeyAreaCount",
"(",
")",
";",
"for",
"(",
"int",
"keyNumber",
"=",
"DBConstants",
".",
"MAIN_KEY_AREA",
";",
"keyNumber",
"<",
"keyCount",
"+",
"DBConstants",
".",
"MAIN_KEY_AREA",
";",
"keyNumber",
"++",
")",
"{",
"KeyArea",
"keyAreaInfo",
"=",
"record",
".",
"getKeyArea",
"(",
"keyNumber",
")",
";",
"if",
"(",
"(",
"(",
"keyAreaInfo",
".",
"getUniqueKeyCode",
"(",
")",
"==",
"DBConstants",
".",
"UNIQUE",
")",
"||",
"(",
"keyAreaInfo",
".",
"getUniqueKeyCode",
"(",
")",
"==",
"DBConstants",
".",
"SECONDARY_KEY",
")",
")",
"&",
"(",
"keyAreaInfo",
".",
"getKeyFields",
"(",
")",
"==",
"1",
")",
")",
"{",
"BaseField",
"mainField",
"=",
"keyAreaInfo",
".",
"getField",
"(",
"DBConstants",
".",
"MAIN_KEY_FIELD",
")",
";",
"MainFieldHandler",
"readKeyed",
"=",
"new",
"MainFieldHandler",
"(",
"record",
".",
"getKeyArea",
"(",
"keyNumber",
")",
".",
"getKeyName",
"(",
")",
")",
";",
"mainField",
".",
"addListener",
"(",
"readKeyed",
")",
";",
"}",
"}",
"}"
] |
Add the read-main-key listener.
|
[
"Add",
"the",
"read",
"-",
"main",
"-",
"key",
"listener",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java#L120-L138
|
151,874
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java
|
Screen.addScreenMenus
|
public void addScreenMenus()
{
AppletScreen appletScreen = this.getAppletScreen();
if (appletScreen != null)
{
ScreenField menuBar = appletScreen.getSField(0);
if ((menuBar == null) || (!(menuBar instanceof SMenuBar)))
{
if (menuBar instanceof SBaseMenuBar)
menuBar.free(); // Wrong menu
new SMenuBar(new ScreenLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), appletScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
}
}
}
|
java
|
public void addScreenMenus()
{
AppletScreen appletScreen = this.getAppletScreen();
if (appletScreen != null)
{
ScreenField menuBar = appletScreen.getSField(0);
if ((menuBar == null) || (!(menuBar instanceof SMenuBar)))
{
if (menuBar instanceof SBaseMenuBar)
menuBar.free(); // Wrong menu
new SMenuBar(new ScreenLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), appletScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
}
}
}
|
[
"public",
"void",
"addScreenMenus",
"(",
")",
"{",
"AppletScreen",
"appletScreen",
"=",
"this",
".",
"getAppletScreen",
"(",
")",
";",
"if",
"(",
"appletScreen",
"!=",
"null",
")",
"{",
"ScreenField",
"menuBar",
"=",
"appletScreen",
".",
"getSField",
"(",
"0",
")",
";",
"if",
"(",
"(",
"menuBar",
"==",
"null",
")",
"||",
"(",
"!",
"(",
"menuBar",
"instanceof",
"SMenuBar",
")",
")",
")",
"{",
"if",
"(",
"menuBar",
"instanceof",
"SBaseMenuBar",
")",
"menuBar",
".",
"free",
"(",
")",
";",
"// Wrong menu",
"new",
"SMenuBar",
"(",
"new",
"ScreenLocation",
"(",
"ScreenConstants",
".",
"FIRST_SCREEN_LOCATION",
",",
"ScreenConstants",
".",
"SET_ANCHOR",
")",
",",
"appletScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"null",
")",
";",
"}",
"}",
"}"
] |
Add the menus that belong with this screen.
|
[
"Add",
"the",
"menus",
"that",
"belong",
"with",
"this",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java#L156-L169
|
151,875
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java
|
Screen.onMove
|
public boolean onMove(int nIDMoveCommand)
{
boolean flag = super.onMove(nIDMoveCommand);
this.selectField(null, DBConstants.SELECT_FIRST_FIELD);
return flag;
}
|
java
|
public boolean onMove(int nIDMoveCommand)
{
boolean flag = super.onMove(nIDMoveCommand);
this.selectField(null, DBConstants.SELECT_FIRST_FIELD);
return flag;
}
|
[
"public",
"boolean",
"onMove",
"(",
"int",
"nIDMoveCommand",
")",
"{",
"boolean",
"flag",
"=",
"super",
".",
"onMove",
"(",
"nIDMoveCommand",
")",
";",
"this",
".",
"selectField",
"(",
"null",
",",
"DBConstants",
".",
"SELECT_FIRST_FIELD",
")",
";",
"return",
"flag",
";",
"}"
] |
Move Record Command.
@return True if successful.
|
[
"Move",
"Record",
"Command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/Screen.java#L234-L239
|
151,876
|
TrueNight/Utils
|
utils/src/main/java/xyz/truenight/utils/Cache.java
|
Cache.that
|
@SuppressWarnings("unchecked")
public static <T> T that(Object key, Supplier<T> what) {
if (CACHE.get(key) != null) {
try {
return (T) CACHE.get(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
}
T value = what.get();
CACHE.put(key, value);
return value;
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T that(Object key, Supplier<T> what) {
if (CACHE.get(key) != null) {
try {
return (T) CACHE.get(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
}
T value = what.get();
CACHE.put(key, value);
return value;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"that",
"(",
"Object",
"key",
",",
"Supplier",
"<",
"T",
">",
"what",
")",
"{",
"if",
"(",
"CACHE",
".",
"get",
"(",
"key",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"CACHE",
".",
"get",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"E/Cache: Can't use cached object: wrong type\"",
")",
";",
"}",
"}",
"T",
"value",
"=",
"what",
".",
"get",
"(",
")",
";",
"CACHE",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"value",
";",
"}"
] |
Registers creator of item and returns item from cache or creator
|
[
"Registers",
"creator",
"of",
"item",
"and",
"returns",
"item",
"from",
"cache",
"or",
"creator"
] |
78a11faa16258b09f08826797370310ab650530c
|
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Cache.java#L33-L46
|
151,877
|
TrueNight/Utils
|
utils/src/main/java/xyz/truenight/utils/Cache.java
|
Cache.that
|
public static <T> T that(Object key, T what) {
CACHE.put(key, what);
return what;
}
|
java
|
public static <T> T that(Object key, T what) {
CACHE.put(key, what);
return what;
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"that",
"(",
"Object",
"key",
",",
"T",
"what",
")",
"{",
"CACHE",
".",
"put",
"(",
"key",
",",
"what",
")",
";",
"return",
"what",
";",
"}"
] |
Puts item to cache
|
[
"Puts",
"item",
"to",
"cache"
] |
78a11faa16258b09f08826797370310ab650530c
|
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Cache.java#L51-L54
|
151,878
|
TrueNight/Utils
|
utils/src/main/java/xyz/truenight/utils/Cache.java
|
Cache.get
|
@SuppressWarnings("unchecked")
public static <T> T get(Object key) {
try {
return (T) CACHE.get(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
return null;
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T get(Object key) {
try {
return (T) CACHE.get(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
return null;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Object",
"key",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"CACHE",
".",
"get",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"E/Cache: Can't use cached object: wrong type\"",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns cached item
|
[
"Returns",
"cached",
"item"
] |
78a11faa16258b09f08826797370310ab650530c
|
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Cache.java#L59-L67
|
151,879
|
TrueNight/Utils
|
utils/src/main/java/xyz/truenight/utils/Cache.java
|
Cache.poll
|
@SuppressWarnings("unchecked")
public static <T> T poll(Object key) {
try {
return (T) CACHE.remove(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
return null;
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T poll(Object key) {
try {
return (T) CACHE.remove(key);
} catch (ClassCastException e) {
System.out.print("E/Cache: Can't use cached object: wrong type");
}
return null;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"poll",
"(",
"Object",
"key",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"CACHE",
".",
"remove",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"E/Cache: Can't use cached object: wrong type\"",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns cached item and removes it from cache
|
[
"Returns",
"cached",
"item",
"and",
"removes",
"it",
"from",
"cache"
] |
78a11faa16258b09f08826797370310ab650530c
|
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Cache.java#L72-L80
|
151,880
|
jbundle/jbundle
|
app/program/demo/src/main/java/org/jbundle/app/program/demo/SiteRegistrationScreen.java
|
SiteRegistrationScreen.addOtherSFields
|
public void addOtherSFields()
{
super.addOtherSFields();
// Subdomain field
UserInfo recUserInfo = (UserInfo)this.getRecord(UserInfo.USER_INFO_FILE);
BaseField field = new StringField(recUserInfo, "Sub-Domain", 10, null, null);
field.setVirtual(true);
recUserInfo.addPropertiesFieldBehavior(field, MenusMessageData.SITE_PREFIX);
field.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
new SStaticString(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), this, "xxxxx.tourgeek.com");
}
|
java
|
public void addOtherSFields()
{
super.addOtherSFields();
// Subdomain field
UserInfo recUserInfo = (UserInfo)this.getRecord(UserInfo.USER_INFO_FILE);
BaseField field = new StringField(recUserInfo, "Sub-Domain", 10, null, null);
field.setVirtual(true);
recUserInfo.addPropertiesFieldBehavior(field, MenusMessageData.SITE_PREFIX);
field.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY);
new SStaticString(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), this, "xxxxx.tourgeek.com");
}
|
[
"public",
"void",
"addOtherSFields",
"(",
")",
"{",
"super",
".",
"addOtherSFields",
"(",
")",
";",
"// Subdomain field",
"UserInfo",
"recUserInfo",
"=",
"(",
"UserInfo",
")",
"this",
".",
"getRecord",
"(",
"UserInfo",
".",
"USER_INFO_FILE",
")",
";",
"BaseField",
"field",
"=",
"new",
"StringField",
"(",
"recUserInfo",
",",
"\"Sub-Domain\"",
",",
"10",
",",
"null",
",",
"null",
")",
";",
"field",
".",
"setVirtual",
"(",
"true",
")",
";",
"recUserInfo",
".",
"addPropertiesFieldBehavior",
"(",
"field",
",",
"MenusMessageData",
".",
"SITE_PREFIX",
")",
";",
"field",
".",
"setupDefaultView",
"(",
"this",
".",
"getNextLocation",
"(",
"ScreenConstants",
".",
"NEXT_LOGICAL",
",",
"ScreenConstants",
".",
"ANCHOR_DEFAULT",
")",
",",
"this",
",",
"ScreenConstants",
".",
"DEFAULT_DISPLAY",
")",
";",
"new",
"SStaticString",
"(",
"this",
".",
"getNextLocation",
"(",
"ScreenConstants",
".",
"RIGHT_OF_LAST",
",",
"ScreenConstants",
".",
"DONT_SET_ANCHOR",
")",
",",
"this",
",",
"\"xxxxx.tourgeek.com\"",
")",
";",
"}"
] |
AddOtherSFields Method.
|
[
"AddOtherSFields",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/demo/src/main/java/org/jbundle/app/program/demo/SiteRegistrationScreen.java#L97-L110
|
151,881
|
jbundle/jbundle
|
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java
|
PhysicalDatabaseParent.setCacheMinutes
|
public void setCacheMinutes(int iMinutes)
{
if (iMinutes == -1)
iMinutes = DEFAULT_CACHED_MINUTES; // Default cache time.
cacheMinutes = iMinutes;
if (iMinutes == 0)
{
if (timerCache != null)
{
timerCache.cancel();
timerCache = null;
this.stopCache();
}
}
else
{
if (timerCache != null)
{
timerCache.cancel(); //m_timerCache.setDelay(iMilliseconds);
}
// Set up the timer for the first time.
this.startCache();
timerTask = new DBTimerTask();
timerCache = new java.util.Timer();
timerCache.schedule(timerTask, cacheMinutes * 60 * 1000);
}
}
|
java
|
public void setCacheMinutes(int iMinutes)
{
if (iMinutes == -1)
iMinutes = DEFAULT_CACHED_MINUTES; // Default cache time.
cacheMinutes = iMinutes;
if (iMinutes == 0)
{
if (timerCache != null)
{
timerCache.cancel();
timerCache = null;
this.stopCache();
}
}
else
{
if (timerCache != null)
{
timerCache.cancel(); //m_timerCache.setDelay(iMilliseconds);
}
// Set up the timer for the first time.
this.startCache();
timerTask = new DBTimerTask();
timerCache = new java.util.Timer();
timerCache.schedule(timerTask, cacheMinutes * 60 * 1000);
}
}
|
[
"public",
"void",
"setCacheMinutes",
"(",
"int",
"iMinutes",
")",
"{",
"if",
"(",
"iMinutes",
"==",
"-",
"1",
")",
"iMinutes",
"=",
"DEFAULT_CACHED_MINUTES",
";",
"// Default cache time.",
"cacheMinutes",
"=",
"iMinutes",
";",
"if",
"(",
"iMinutes",
"==",
"0",
")",
"{",
"if",
"(",
"timerCache",
"!=",
"null",
")",
"{",
"timerCache",
".",
"cancel",
"(",
")",
";",
"timerCache",
"=",
"null",
";",
"this",
".",
"stopCache",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"timerCache",
"!=",
"null",
")",
"{",
"timerCache",
".",
"cancel",
"(",
")",
";",
"//m_timerCache.setDelay(iMilliseconds);",
"}",
"// Set up the timer for the first time.",
"this",
".",
"startCache",
"(",
")",
";",
"timerTask",
"=",
"new",
"DBTimerTask",
"(",
")",
";",
"timerCache",
"=",
"new",
"java",
".",
"util",
".",
"Timer",
"(",
")",
";",
"timerCache",
".",
"schedule",
"(",
"timerTask",
",",
"cacheMinutes",
"*",
"60",
"*",
"1000",
")",
";",
"}",
"}"
] |
This will set this database to start caching records until they haven't been used for
iMinutes minutes.
@param iMinutes free tables once they haven't been accessed, set to 0 to turn off cache and free cached tables.
|
[
"This",
"will",
"set",
"this",
"database",
"to",
"start",
"caching",
"records",
"until",
"they",
"haven",
"t",
"been",
"used",
"for",
"iMinutes",
"minutes",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java#L193-L219
|
151,882
|
jbundle/jbundle
|
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java
|
PhysicalDatabaseParent.startCache
|
private synchronized void startCache()
{
for (PDatabase pDatabase : m_htDBList.values())
{
for (PTable pTable : pDatabase.getTableList().values())
{
this.addTableToCache(pTable);
}
}
}
|
java
|
private synchronized void startCache()
{
for (PDatabase pDatabase : m_htDBList.values())
{
for (PTable pTable : pDatabase.getTableList().values())
{
this.addTableToCache(pTable);
}
}
}
|
[
"private",
"synchronized",
"void",
"startCache",
"(",
")",
"{",
"for",
"(",
"PDatabase",
"pDatabase",
":",
"m_htDBList",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"PTable",
"pTable",
":",
"pDatabase",
".",
"getTableList",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"this",
".",
"addTableToCache",
"(",
"pTable",
")",
";",
"}",
"}",
"}"
] |
This will set this database to start caching records by bumping the use count of all the open tables.
|
[
"This",
"will",
"set",
"this",
"database",
"to",
"start",
"caching",
"records",
"by",
"bumping",
"the",
"use",
"count",
"of",
"all",
"the",
"open",
"tables",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java#L290-L299
|
151,883
|
jbundle/jbundle
|
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java
|
PhysicalDatabaseParent.checkCache
|
private synchronized void checkCache()
{
Object[] pTables = m_setTableCacheList.toArray();
for (Object objTable : pTables)
{
PTable pTable = (PTable)objTable;
if (pTable.addPTableOwner(null) == 1)
{ // Not currently being used is a candidate for flushing from the cache.
long lTimeLastUsed = pTable.getLastUsed();
long lTimeCurrent = System.currentTimeMillis();
if ((lTimeCurrent - lTimeLastUsed) > (this.getCacheMinutes() * 60 * 1000))
{
pTable.removePTableOwner(this, true);
m_setTableCacheList.remove(pTable);
}
}
}
}
|
java
|
private synchronized void checkCache()
{
Object[] pTables = m_setTableCacheList.toArray();
for (Object objTable : pTables)
{
PTable pTable = (PTable)objTable;
if (pTable.addPTableOwner(null) == 1)
{ // Not currently being used is a candidate for flushing from the cache.
long lTimeLastUsed = pTable.getLastUsed();
long lTimeCurrent = System.currentTimeMillis();
if ((lTimeCurrent - lTimeLastUsed) > (this.getCacheMinutes() * 60 * 1000))
{
pTable.removePTableOwner(this, true);
m_setTableCacheList.remove(pTable);
}
}
}
}
|
[
"private",
"synchronized",
"void",
"checkCache",
"(",
")",
"{",
"Object",
"[",
"]",
"pTables",
"=",
"m_setTableCacheList",
".",
"toArray",
"(",
")",
";",
"for",
"(",
"Object",
"objTable",
":",
"pTables",
")",
"{",
"PTable",
"pTable",
"=",
"(",
"PTable",
")",
"objTable",
";",
"if",
"(",
"pTable",
".",
"addPTableOwner",
"(",
"null",
")",
"==",
"1",
")",
"{",
"// Not currently being used is a candidate for flushing from the cache.",
"long",
"lTimeLastUsed",
"=",
"pTable",
".",
"getLastUsed",
"(",
")",
";",
"long",
"lTimeCurrent",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"(",
"lTimeCurrent",
"-",
"lTimeLastUsed",
")",
">",
"(",
"this",
".",
"getCacheMinutes",
"(",
")",
"*",
"60",
"*",
"1000",
")",
")",
"{",
"pTable",
".",
"removePTableOwner",
"(",
"this",
",",
"true",
")",
";",
"m_setTableCacheList",
".",
"remove",
"(",
"pTable",
")",
";",
"}",
"}",
"}",
"}"
] |
Check all the cached tables and flush the old ones.
|
[
"Check",
"all",
"the",
"cached",
"tables",
"and",
"flush",
"the",
"old",
"ones",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PhysicalDatabaseParent.java#L317-L334
|
151,884
|
js-lib-com/commons
|
src/main/java/js/io/StreamHandler.java
|
StreamHandler.invokeHandler
|
public void invokeHandler(OutputStream outputStream) throws IOException
{
@SuppressWarnings("unchecked")
T t = OutputStream.class.equals(this.streamClass) ? (T)outputStream : Classes.newInstance(streamClass, outputStream);
handle(t);
t.flush();
t.close();
}
|
java
|
public void invokeHandler(OutputStream outputStream) throws IOException
{
@SuppressWarnings("unchecked")
T t = OutputStream.class.equals(this.streamClass) ? (T)outputStream : Classes.newInstance(streamClass, outputStream);
handle(t);
t.flush();
t.close();
}
|
[
"public",
"void",
"invokeHandler",
"(",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"t",
"=",
"OutputStream",
".",
"class",
".",
"equals",
"(",
"this",
".",
"streamClass",
")",
"?",
"(",
"T",
")",
"outputStream",
":",
"Classes",
".",
"newInstance",
"(",
"streamClass",
",",
"outputStream",
")",
";",
"handle",
"(",
"t",
")",
";",
"t",
".",
"flush",
"(",
")",
";",
"t",
".",
"close",
"(",
")",
";",
"}"
] |
Helper method used to invoke concrete output stream handler method. Please note that given output stream is closed
after handler invocation, just before this method return.
@param outputStream wrapped output stream instance.
@throws IOException any output stream exception is bubbled up.
|
[
"Helper",
"method",
"used",
"to",
"invoke",
"concrete",
"output",
"stream",
"handler",
"method",
".",
"Please",
"note",
"that",
"given",
"output",
"stream",
"is",
"closed",
"after",
"handler",
"invocation",
"just",
"before",
"this",
"method",
"return",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/StreamHandler.java#L128-L135
|
151,885
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java
|
ActionManager.setupStandardMenu
|
public JMenuBar setupStandardMenu(ActionListener targetAction, boolean bAddHelpMenu)
{
Application application = BaseApplet.getSharedInstance().getApplication();
ResourceBundle oldResources = application.getResourceBundle();
application.getResources(null, true);
this.setupActions(targetAction);
JMenuBar menuBar = new JMenuBar()
{
private static final long serialVersionUID = 1L;
public Dimension getMaximumSize()
{ // HACK - Not sure why menu takes up 1/2 of screen...?
return new Dimension(super.getMaximumSize().width, super.getPreferredSize().height);
}
};
menuBar.setOpaque(false);
JMenu menu;
char[] rgchItemShortcuts = new char[20];
menu = this.addMenu(menuBar,ThinMenuConstants.FILE);
this.addMenuItem(menu, ThinMenuConstants.PRINT, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.LOGON, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.LOGOUT, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.CHANGE_PASSWORD, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.CLOSE, rgchItemShortcuts);
rgchItemShortcuts = new char[20];
menu = this.addMenu(menuBar,ThinMenuConstants.EDIT);
// this.addMenuItem(menu, UNDO);
// menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.CUT, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.COPY, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.PASTE, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.PREFERENCES, rgchItemShortcuts);
if (oldResources != null)
application.setResourceBundle(oldResources);
if (bAddHelpMenu)
menu = this.addHelpMenu(menuBar);
return menuBar;
}
|
java
|
public JMenuBar setupStandardMenu(ActionListener targetAction, boolean bAddHelpMenu)
{
Application application = BaseApplet.getSharedInstance().getApplication();
ResourceBundle oldResources = application.getResourceBundle();
application.getResources(null, true);
this.setupActions(targetAction);
JMenuBar menuBar = new JMenuBar()
{
private static final long serialVersionUID = 1L;
public Dimension getMaximumSize()
{ // HACK - Not sure why menu takes up 1/2 of screen...?
return new Dimension(super.getMaximumSize().width, super.getPreferredSize().height);
}
};
menuBar.setOpaque(false);
JMenu menu;
char[] rgchItemShortcuts = new char[20];
menu = this.addMenu(menuBar,ThinMenuConstants.FILE);
this.addMenuItem(menu, ThinMenuConstants.PRINT, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.LOGON, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.LOGOUT, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.CHANGE_PASSWORD, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.CLOSE, rgchItemShortcuts);
rgchItemShortcuts = new char[20];
menu = this.addMenu(menuBar,ThinMenuConstants.EDIT);
// this.addMenuItem(menu, UNDO);
// menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.CUT, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.COPY, rgchItemShortcuts);
this.addMenuItem(menu, ThinMenuConstants.PASTE, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.PREFERENCES, rgchItemShortcuts);
if (oldResources != null)
application.setResourceBundle(oldResources);
if (bAddHelpMenu)
menu = this.addHelpMenu(menuBar);
return menuBar;
}
|
[
"public",
"JMenuBar",
"setupStandardMenu",
"(",
"ActionListener",
"targetAction",
",",
"boolean",
"bAddHelpMenu",
")",
"{",
"Application",
"application",
"=",
"BaseApplet",
".",
"getSharedInstance",
"(",
")",
".",
"getApplication",
"(",
")",
";",
"ResourceBundle",
"oldResources",
"=",
"application",
".",
"getResourceBundle",
"(",
")",
";",
"application",
".",
"getResources",
"(",
"null",
",",
"true",
")",
";",
"this",
".",
"setupActions",
"(",
"targetAction",
")",
";",
"JMenuBar",
"menuBar",
"=",
"new",
"JMenuBar",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"Dimension",
"getMaximumSize",
"(",
")",
"{",
"// HACK - Not sure why menu takes up 1/2 of screen...?",
"return",
"new",
"Dimension",
"(",
"super",
".",
"getMaximumSize",
"(",
")",
".",
"width",
",",
"super",
".",
"getPreferredSize",
"(",
")",
".",
"height",
")",
";",
"}",
"}",
";",
"menuBar",
".",
"setOpaque",
"(",
"false",
")",
";",
"JMenu",
"menu",
";",
"char",
"[",
"]",
"rgchItemShortcuts",
"=",
"new",
"char",
"[",
"20",
"]",
";",
"menu",
"=",
"this",
".",
"addMenu",
"(",
"menuBar",
",",
"ThinMenuConstants",
".",
"FILE",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"PRINT",
",",
"rgchItemShortcuts",
")",
";",
"menu",
".",
"addSeparator",
"(",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"LOGON",
",",
"rgchItemShortcuts",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"LOGOUT",
",",
"rgchItemShortcuts",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"CHANGE_PASSWORD",
",",
"rgchItemShortcuts",
")",
";",
"menu",
".",
"addSeparator",
"(",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"CLOSE",
",",
"rgchItemShortcuts",
")",
";",
"rgchItemShortcuts",
"=",
"new",
"char",
"[",
"20",
"]",
";",
"menu",
"=",
"this",
".",
"addMenu",
"(",
"menuBar",
",",
"ThinMenuConstants",
".",
"EDIT",
")",
";",
"// this.addMenuItem(menu, UNDO);",
"// menu.addSeparator();",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"CUT",
",",
"rgchItemShortcuts",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"COPY",
",",
"rgchItemShortcuts",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"PASTE",
",",
"rgchItemShortcuts",
")",
";",
"menu",
".",
"addSeparator",
"(",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"PREFERENCES",
",",
"rgchItemShortcuts",
")",
";",
"if",
"(",
"oldResources",
"!=",
"null",
")",
"application",
".",
"setResourceBundle",
"(",
"oldResources",
")",
";",
"if",
"(",
"bAddHelpMenu",
")",
"menu",
"=",
"this",
".",
"addHelpMenu",
"(",
"menuBar",
")",
";",
"return",
"menuBar",
";",
"}"
] |
Setup the standard menu items.
|
[
"Setup",
"the",
"standard",
"menu",
"items",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java#L88-L136
|
151,886
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java
|
ActionManager.addHelpMenu
|
public JMenu addHelpMenu(JMenuBar menuBar)
{
Application application = BaseApplet.getSharedInstance().getApplication();
ResourceBundle oldResources = application.getResourceBundle();
application.getResources(null, true);
char[] rgchItemShortcuts = new char[20];
JMenu menu = this.addMenu(menuBar,ThinMenuConstants.HELP_MENU);
this.addMenuItem(menu, ThinMenuConstants.ABOUT, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.HELP, rgchItemShortcuts);
if (oldResources != null)
application.setResourceBundle(oldResources);
return menu;
}
|
java
|
public JMenu addHelpMenu(JMenuBar menuBar)
{
Application application = BaseApplet.getSharedInstance().getApplication();
ResourceBundle oldResources = application.getResourceBundle();
application.getResources(null, true);
char[] rgchItemShortcuts = new char[20];
JMenu menu = this.addMenu(menuBar,ThinMenuConstants.HELP_MENU);
this.addMenuItem(menu, ThinMenuConstants.ABOUT, rgchItemShortcuts);
menu.addSeparator();
this.addMenuItem(menu, ThinMenuConstants.HELP, rgchItemShortcuts);
if (oldResources != null)
application.setResourceBundle(oldResources);
return menu;
}
|
[
"public",
"JMenu",
"addHelpMenu",
"(",
"JMenuBar",
"menuBar",
")",
"{",
"Application",
"application",
"=",
"BaseApplet",
".",
"getSharedInstance",
"(",
")",
".",
"getApplication",
"(",
")",
";",
"ResourceBundle",
"oldResources",
"=",
"application",
".",
"getResourceBundle",
"(",
")",
";",
"application",
".",
"getResources",
"(",
"null",
",",
"true",
")",
";",
"char",
"[",
"]",
"rgchItemShortcuts",
"=",
"new",
"char",
"[",
"20",
"]",
";",
"JMenu",
"menu",
"=",
"this",
".",
"addMenu",
"(",
"menuBar",
",",
"ThinMenuConstants",
".",
"HELP_MENU",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"ABOUT",
",",
"rgchItemShortcuts",
")",
";",
"menu",
".",
"addSeparator",
"(",
")",
";",
"this",
".",
"addMenuItem",
"(",
"menu",
",",
"ThinMenuConstants",
".",
"HELP",
",",
"rgchItemShortcuts",
")",
";",
"if",
"(",
"oldResources",
"!=",
"null",
")",
"application",
".",
"setResourceBundle",
"(",
"oldResources",
")",
";",
"return",
"menu",
";",
"}"
] |
Add a standard help menu to this menu bar
@param menuBar
@return
|
[
"Add",
"a",
"standard",
"help",
"menu",
"to",
"this",
"menu",
"bar"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java#L142-L159
|
151,887
|
williamwebb/alogger
|
Utilities/src/main/java/com/jug6ernaut/android/utilites/DisplayUtils.java
|
DisplayUtils.isTablet
|
public boolean isTablet(Context context) {
boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
return (xlarge || large);
}
|
java
|
public boolean isTablet(Context context) {
boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
return (xlarge || large);
}
|
[
"public",
"boolean",
"isTablet",
"(",
"Context",
"context",
")",
"{",
"boolean",
"xlarge",
"=",
"(",
"(",
"context",
".",
"getResources",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"screenLayout",
"&",
"Configuration",
".",
"SCREENLAYOUT_SIZE_MASK",
")",
"==",
"4",
")",
";",
"boolean",
"large",
"=",
"(",
"(",
"context",
".",
"getResources",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"screenLayout",
"&",
"Configuration",
".",
"SCREENLAYOUT_SIZE_MASK",
")",
"==",
"Configuration",
".",
"SCREENLAYOUT_SIZE_LARGE",
")",
";",
"return",
"(",
"xlarge",
"||",
"large",
")",
";",
"}"
] |
This method is use to determine if the current Android device is a tablet
or phone.
@param context
@return
|
[
"This",
"method",
"is",
"use",
"to",
"determine",
"if",
"the",
"current",
"Android",
"device",
"is",
"a",
"tablet",
"or",
"phone",
"."
] |
61fca49e0b8d9c3a76c40da8883ac354b240351e
|
https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/Utilities/src/main/java/com/jug6ernaut/android/utilites/DisplayUtils.java#L47-L51
|
151,888
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/dual/DualMessageReceiver.java
|
DualMessageReceiver.receiveMessage
|
public Message receiveMessage()
{
DualMessageQueue baseMessageQueue = (DualMessageQueue)this.getMessageQueue();
if (baseMessageQueue == null)
return null; // In free
return baseMessageQueue.getMessageStack().receiveMessage();
}
|
java
|
public Message receiveMessage()
{
DualMessageQueue baseMessageQueue = (DualMessageQueue)this.getMessageQueue();
if (baseMessageQueue == null)
return null; // In free
return baseMessageQueue.getMessageStack().receiveMessage();
}
|
[
"public",
"Message",
"receiveMessage",
"(",
")",
"{",
"DualMessageQueue",
"baseMessageQueue",
"=",
"(",
"DualMessageQueue",
")",
"this",
".",
"getMessageQueue",
"(",
")",
";",
"if",
"(",
"baseMessageQueue",
"==",
"null",
")",
"return",
"null",
";",
"// In free",
"return",
"baseMessageQueue",
".",
"getMessageStack",
"(",
")",
".",
"receiveMessage",
"(",
")",
";",
"}"
] |
Process the receive message call.
Do NOT receive from the remote server... DO receive from the local queue.
The worker thread handle remote receives and adds them to the local queue.
@return The next message on the queue (hangs until one is available).
|
[
"Process",
"the",
"receive",
"message",
"call",
".",
"Do",
"NOT",
"receive",
"from",
"the",
"remote",
"server",
"...",
"DO",
"receive",
"from",
"the",
"local",
"queue",
".",
"The",
"worker",
"thread",
"handle",
"remote",
"receives",
"and",
"adds",
"them",
"to",
"the",
"local",
"queue",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/dual/DualMessageReceiver.java#L80-L86
|
151,889
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java
|
AnnotationUtils.isAnnotationPresent
|
public static boolean isAnnotationPresent(Class<?> target, Class<? extends Annotation> annotation) {
Class<?> clazz = target;
if (clazz.isAnnotationPresent(annotation)) {
return true;
}
while((clazz = clazz.getSuperclass()) != null) {
if (clazz.isAnnotationPresent(annotation)) {
return true;
}
}
return false;
}
|
java
|
public static boolean isAnnotationPresent(Class<?> target, Class<? extends Annotation> annotation) {
Class<?> clazz = target;
if (clazz.isAnnotationPresent(annotation)) {
return true;
}
while((clazz = clazz.getSuperclass()) != null) {
if (clazz.isAnnotationPresent(annotation)) {
return true;
}
}
return false;
}
|
[
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"target",
";",
"if",
"(",
"clazz",
".",
"isAnnotationPresent",
"(",
"annotation",
")",
")",
"{",
"return",
"true",
";",
"}",
"while",
"(",
"(",
"clazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"clazz",
".",
"isAnnotationPresent",
"(",
"annotation",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the supplied annotation is present on the target class
or any of its super classes.
@param annotation Annotation to find.
@return true if the supplied annotation is present on the target class
or any of its super classes.
|
[
"Returns",
"true",
"if",
"the",
"supplied",
"annotation",
"is",
"present",
"on",
"the",
"target",
"class",
"or",
"any",
"of",
"its",
"super",
"classes",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java#L24-L35
|
151,890
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java
|
AnnotationUtils.isAnyAnnotationPresent
|
public static boolean isAnyAnnotationPresent(Class<?> target, Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotationClass : annotations) {
if (isAnnotationPresent(target, annotationClass)) {
return true;
}
}
return false;
}
|
java
|
public static boolean isAnyAnnotationPresent(Class<?> target, Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotationClass : annotations) {
if (isAnnotationPresent(target, annotationClass)) {
return true;
}
}
return false;
}
|
[
"public",
"static",
"boolean",
"isAnyAnnotationPresent",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"...",
"annotations",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
":",
"annotations",
")",
"{",
"if",
"(",
"isAnnotationPresent",
"(",
"target",
",",
"annotationClass",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if any of the supplied annotations is present on the target class
or any of its super classes.
@param annotations Annotations to find.
@return true if any of the supplied annotation is present on the target class
or any of its super classes.
|
[
"Returns",
"true",
"if",
"any",
"of",
"the",
"supplied",
"annotations",
"is",
"present",
"on",
"the",
"target",
"class",
"or",
"any",
"of",
"its",
"super",
"classes",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java#L46-L53
|
151,891
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java
|
AnnotationUtils.getAnnotatedParameterIndex
|
public static int getAnnotatedParameterIndex(Method method, Class<? extends Annotation> annotationClass) {
Annotation[][] annotationsForParameters = method.getParameterAnnotations();
for (int i = 0; i < annotationsForParameters.length; i++) {
Annotation[] parameterAnnotations = annotationsForParameters[i];
if (hasAnnotation(parameterAnnotations, annotationClass)) {
return i;
}
}
return -1;
}
|
java
|
public static int getAnnotatedParameterIndex(Method method, Class<? extends Annotation> annotationClass) {
Annotation[][] annotationsForParameters = method.getParameterAnnotations();
for (int i = 0; i < annotationsForParameters.length; i++) {
Annotation[] parameterAnnotations = annotationsForParameters[i];
if (hasAnnotation(parameterAnnotations, annotationClass)) {
return i;
}
}
return -1;
}
|
[
"public",
"static",
"int",
"getAnnotatedParameterIndex",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"Annotation",
"[",
"]",
"[",
"]",
"annotationsForParameters",
"=",
"method",
".",
"getParameterAnnotations",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"annotationsForParameters",
".",
"length",
";",
"i",
"++",
")",
"{",
"Annotation",
"[",
"]",
"parameterAnnotations",
"=",
"annotationsForParameters",
"[",
"i",
"]",
";",
"if",
"(",
"hasAnnotation",
"(",
"parameterAnnotations",
",",
"annotationClass",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Returns index of the first parameter with matching annotationClass, -1 if no parameter
found with the supplied annotation.
@param method Method to inspect parameters of.
@param annotationClass Annotation to look for.
@return index of the first parameter found with annotationClass, -1 if not parameter found.
|
[
"Returns",
"index",
"of",
"the",
"first",
"parameter",
"with",
"matching",
"annotationClass",
"-",
"1",
"if",
"no",
"parameter",
"found",
"with",
"the",
"supplied",
"annotation",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java#L92-L101
|
151,892
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java
|
AnnotationUtils.hasAnnotation
|
private static boolean hasAnnotation(Annotation[] parameterAnnotations,
Class<? extends Annotation> annotationClass) {
for (Annotation annotation : parameterAnnotations) {
if (annotation.annotationType().equals(annotationClass)) {
return true;
}
}
return false;
}
|
java
|
private static boolean hasAnnotation(Annotation[] parameterAnnotations,
Class<? extends Annotation> annotationClass) {
for (Annotation annotation : parameterAnnotations) {
if (annotation.annotationType().equals(annotationClass)) {
return true;
}
}
return false;
}
|
[
"private",
"static",
"boolean",
"hasAnnotation",
"(",
"Annotation",
"[",
"]",
"parameterAnnotations",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"for",
"(",
"Annotation",
"annotation",
":",
"parameterAnnotations",
")",
"{",
"if",
"(",
"annotation",
".",
"annotationType",
"(",
")",
".",
"equals",
"(",
"annotationClass",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if any annotation in parameterAnnotations matches annotationClass.
@param parameterAnnotations Annotations to inspect.
@param annotationClass Annotation to find.
@return true if any annotation in parameterAnnotations matches annotationClass, else false.
|
[
"Returns",
"true",
"if",
"any",
"annotation",
"in",
"parameterAnnotations",
"matches",
"annotationClass",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java#L111-L119
|
151,893
|
jeremiehuchet/acrachilisync
|
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionBuilder.java
|
IssueDescriptionBuilder.build
|
public String build() {
final StringBuilder description = new StringBuilder();
// append occurrences
description.append(IssueDescriptionUtils.getOccurrencesTableHeader()).append('\n');
for (final ErrorOccurrence error : occurrences) {
description.append(IssueDescriptionUtils.getOccurrencesTableLine(error));
description.append('\n');
}
// append stacktrace
description.append("\n\n");
description.append("*Stacktrace*").append('\n');
description.append("<pre class=\"javastacktrace\">");
description.append(stacktrace.trim()).append("</pre>");
// append version
description.append('\n').append(IssueDescriptionUtils.DESCRIPTION_VERSION_TAG);
return description.toString();
}
|
java
|
public String build() {
final StringBuilder description = new StringBuilder();
// append occurrences
description.append(IssueDescriptionUtils.getOccurrencesTableHeader()).append('\n');
for (final ErrorOccurrence error : occurrences) {
description.append(IssueDescriptionUtils.getOccurrencesTableLine(error));
description.append('\n');
}
// append stacktrace
description.append("\n\n");
description.append("*Stacktrace*").append('\n');
description.append("<pre class=\"javastacktrace\">");
description.append(stacktrace.trim()).append("</pre>");
// append version
description.append('\n').append(IssueDescriptionUtils.DESCRIPTION_VERSION_TAG);
return description.toString();
}
|
[
"public",
"String",
"build",
"(",
")",
"{",
"final",
"StringBuilder",
"description",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// append occurrences\r",
"description",
".",
"append",
"(",
"IssueDescriptionUtils",
".",
"getOccurrencesTableHeader",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"final",
"ErrorOccurrence",
"error",
":",
"occurrences",
")",
"{",
"description",
".",
"append",
"(",
"IssueDescriptionUtils",
".",
"getOccurrencesTableLine",
"(",
"error",
")",
")",
";",
"description",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"// append stacktrace\r",
"description",
".",
"append",
"(",
"\"\\n\\n\"",
")",
";",
"description",
".",
"append",
"(",
"\"*Stacktrace*\"",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"description",
".",
"append",
"(",
"\"<pre class=\\\"javastacktrace\\\">\"",
")",
";",
"description",
".",
"append",
"(",
"stacktrace",
".",
"trim",
"(",
")",
")",
".",
"append",
"(",
"\"</pre>\"",
")",
";",
"// append version\r",
"description",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"IssueDescriptionUtils",
".",
"DESCRIPTION_VERSION_TAG",
")",
";",
"return",
"description",
".",
"toString",
"(",
")",
";",
"}"
] |
Builds the description.
@return the issue description
@see IssueDescriptionUtils
|
[
"Builds",
"the",
"description",
"."
] |
4eadb0218623e77e0d92b5a08515eea2db51e988
|
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionBuilder.java#L68-L89
|
151,894
|
jeremiehuchet/acrachilisync
|
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionBuilder.java
|
IssueDescriptionBuilder.setOccurrences
|
public void setOccurrences(final List<ErrorOccurrence> pOccurrences) {
occurrences.clear();
for (final ErrorOccurrence error : pOccurrences) {
addOccurrence(error);
}
}
|
java
|
public void setOccurrences(final List<ErrorOccurrence> pOccurrences) {
occurrences.clear();
for (final ErrorOccurrence error : pOccurrences) {
addOccurrence(error);
}
}
|
[
"public",
"void",
"setOccurrences",
"(",
"final",
"List",
"<",
"ErrorOccurrence",
">",
"pOccurrences",
")",
"{",
"occurrences",
".",
"clear",
"(",
")",
";",
"for",
"(",
"final",
"ErrorOccurrence",
"error",
":",
"pOccurrences",
")",
"{",
"addOccurrence",
"(",
"error",
")",
";",
"}",
"}"
] |
Sets the list of occurrences for this bug.
@param pOccurrences
a list with the bug occurrence informations
@see #addOccurrence(String, Date)
|
[
"Sets",
"the",
"list",
"of",
"occurrences",
"for",
"this",
"bug",
"."
] |
4eadb0218623e77e0d92b5a08515eea2db51e988
|
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionBuilder.java#L98-L104
|
151,895
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMJson.java
|
JMJson.toJsonString
|
public static <D> String toJsonString(D dataObject) {
try {
return jsonMapper.writeValueAsString(dataObject);
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"toJsonString", dataObject);
}
}
|
java
|
public static <D> String toJsonString(D dataObject) {
try {
return jsonMapper.writeValueAsString(dataObject);
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"toJsonString", dataObject);
}
}
|
[
"public",
"static",
"<",
"D",
">",
"String",
"toJsonString",
"(",
"D",
"dataObject",
")",
"{",
"try",
"{",
"return",
"jsonMapper",
".",
"writeValueAsString",
"(",
"dataObject",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"JMExceptionManager",
".",
"handleExceptionAndReturnNull",
"(",
"log",
",",
"e",
",",
"\"toJsonString\"",
",",
"dataObject",
")",
";",
"}",
"}"
] |
To json string string.
@param <D> the type parameter
@param dataObject the data object
@return the string
|
[
"To",
"json",
"string",
"string",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L61-L68
|
151,896
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMJson.java
|
JMJson.toMapList
|
public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
}
|
java
|
public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
}
|
[
"public",
"static",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"toMapList",
"(",
"String",
"jsonMapListString",
")",
"{",
"return",
"withJsonString",
"(",
"jsonMapListString",
",",
"LIST_MAP_TYPE_REFERENCE",
")",
";",
"}"
] |
To map list list.
@param jsonMapListString the json map list string
@return the list
|
[
"To",
"map",
"list",
"list",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L190-L193
|
151,897
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMJson.java
|
JMJson.withRestOrClasspathOrFilePath
|
public static <T> T withRestOrClasspathOrFilePath(
String resourceRestUrlOrClasspathOrFilePath,
TypeReference<T> typeReference) {
return withJsonString(
JMRestfulResource.getStringWithRestOrClasspathOrFilePath(
resourceRestUrlOrClasspathOrFilePath),
typeReference);
}
|
java
|
public static <T> T withRestOrClasspathOrFilePath(
String resourceRestUrlOrClasspathOrFilePath,
TypeReference<T> typeReference) {
return withJsonString(
JMRestfulResource.getStringWithRestOrClasspathOrFilePath(
resourceRestUrlOrClasspathOrFilePath),
typeReference);
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"withRestOrClasspathOrFilePath",
"(",
"String",
"resourceRestUrlOrClasspathOrFilePath",
",",
"TypeReference",
"<",
"T",
">",
"typeReference",
")",
"{",
"return",
"withJsonString",
"(",
"JMRestfulResource",
".",
"getStringWithRestOrClasspathOrFilePath",
"(",
"resourceRestUrlOrClasspathOrFilePath",
")",
",",
"typeReference",
")",
";",
"}"
] |
With rest or classpath or file path t.
@param <T> the type parameter
@param resourceRestUrlOrClasspathOrFilePath the resource rest url or classpath or file path
@param typeReference the type reference
@return the t
|
[
"With",
"rest",
"or",
"classpath",
"or",
"file",
"path",
"t",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L315-L322
|
151,898
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMJson.java
|
JMJson.withRestOrFilePathOrClasspath
|
public static <T> T withRestOrFilePathOrClasspath(
String resourceRestOrFilePathOrClasspath,
TypeReference<T> typeReference) {
return withJsonString(
JMRestfulResource.getStringWithRestOrFilePathOrClasspath(
resourceRestOrFilePathOrClasspath),
typeReference);
}
|
java
|
public static <T> T withRestOrFilePathOrClasspath(
String resourceRestOrFilePathOrClasspath,
TypeReference<T> typeReference) {
return withJsonString(
JMRestfulResource.getStringWithRestOrFilePathOrClasspath(
resourceRestOrFilePathOrClasspath),
typeReference);
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"withRestOrFilePathOrClasspath",
"(",
"String",
"resourceRestOrFilePathOrClasspath",
",",
"TypeReference",
"<",
"T",
">",
"typeReference",
")",
"{",
"return",
"withJsonString",
"(",
"JMRestfulResource",
".",
"getStringWithRestOrFilePathOrClasspath",
"(",
"resourceRestOrFilePathOrClasspath",
")",
",",
"typeReference",
")",
";",
"}"
] |
With rest or file path or classpath t.
@param <T> the type parameter
@param resourceRestOrFilePathOrClasspath the resource rest or file path or classpath
@param typeReference the type reference
@return the t
|
[
"With",
"rest",
"or",
"file",
"path",
"or",
"classpath",
"t",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L332-L339
|
151,899
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMJson.java
|
JMJson.withClasspathOrFilePath
|
public static <T> T withClasspathOrFilePath(
String resourceClasspathOrFilePath,
TypeReference<T> typeReference) {
return withJsonString(JMResources.getStringWithClasspathOrFilePath(
resourceClasspathOrFilePath), typeReference);
}
|
java
|
public static <T> T withClasspathOrFilePath(
String resourceClasspathOrFilePath,
TypeReference<T> typeReference) {
return withJsonString(JMResources.getStringWithClasspathOrFilePath(
resourceClasspathOrFilePath), typeReference);
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"withClasspathOrFilePath",
"(",
"String",
"resourceClasspathOrFilePath",
",",
"TypeReference",
"<",
"T",
">",
"typeReference",
")",
"{",
"return",
"withJsonString",
"(",
"JMResources",
".",
"getStringWithClasspathOrFilePath",
"(",
"resourceClasspathOrFilePath",
")",
",",
"typeReference",
")",
";",
"}"
] |
With classpath or file path t.
@param <T> the type parameter
@param resourceClasspathOrFilePath the resource classpath or file path
@param typeReference the type reference
@return the t
|
[
"With",
"classpath",
"or",
"file",
"path",
"t",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L349-L354
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.