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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
samskivert/samskivert | src/main/java/com/samskivert/jdbc/jora/Table.java | Table.select | public final Cursor<T> select (Connection conn, String condition)
{
String query = "select " + listOfFields + " from " + name +
" " + condition;
return new Cursor<T>(this, conn, query);
} | java | public final Cursor<T> select (Connection conn, String condition)
{
String query = "select " + listOfFields + " from " + name +
" " + condition;
return new Cursor<T>(this, conn, query);
} | [
"public",
"final",
"Cursor",
"<",
"T",
">",
"select",
"(",
"Connection",
"conn",
",",
"String",
"condition",
")",
"{",
"String",
"query",
"=",
"\"select \"",
"+",
"listOfFields",
"+",
"\" from \"",
"+",
"name",
"+",
"\" \"",
"+",
"condition",
";",
"return"... | Select records from database table according to search condition
@param condition valid SQL condition expression started with WHERE or
empty string if all records should be fetched. | [
"Select",
"records",
"from",
"database",
"table",
"according",
"to",
"search",
"condition"
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/jora/Table.java#L99-L104 | train |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/jora/Table.java | Table.insert | public synchronized void insert (Connection conn, T obj)
throws SQLException
{
StringBuilder sql = new StringBuilder(
"insert into " + name + " (" + listOfFields + ") values (?");
for (int i = 1; i < nColumns; i++) {
sql.append(",?");
}
sql.append(")")... | java | public synchronized void insert (Connection conn, T obj)
throws SQLException
{
StringBuilder sql = new StringBuilder(
"insert into " + name + " (" + listOfFields + ") values (?");
for (int i = 1; i < nColumns; i++) {
sql.append(",?");
}
sql.append(")")... | [
"public",
"synchronized",
"void",
"insert",
"(",
"Connection",
"conn",
",",
"T",
"obj",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"insert into \"",
"+",
"name",
"+",
"\" (\"",
"+",
"listOfFields",
"+",
"\")... | Insert new record in the table. Values of inserted record fields are
taken from specified object.
@param obj object specifying values of inserted record fields | [
"Insert",
"new",
"record",
"in",
"the",
"table",
".",
"Values",
"of",
"inserted",
"record",
"fields",
"are",
"taken",
"from",
"specified",
"object",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/jora/Table.java#L206-L219 | train |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/jora/Table.java | Table.insert | public synchronized void insert (Connection conn, T[] objects)
throws SQLException
{
StringBuilder sql = new StringBuilder(
"insert into " + name + " (" + listOfFields + ") values (?");
for (int i = 1; i < nColumns; i++) {
sql.append(",?");
}
sql.appen... | java | public synchronized void insert (Connection conn, T[] objects)
throws SQLException
{
StringBuilder sql = new StringBuilder(
"insert into " + name + " (" + listOfFields + ") values (?");
for (int i = 1; i < nColumns; i++) {
sql.append(",?");
}
sql.appen... | [
"public",
"synchronized",
"void",
"insert",
"(",
"Connection",
"conn",
",",
"T",
"[",
"]",
"objects",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"insert into \"",
"+",
"name",
"+",
"\" (\"",
"+",
"listOfFiel... | Insert several new records in the table. Values of inserted records
fields are taken from objects of specified array.
@param objects array with objects specifying values of inserted record
fields | [
"Insert",
"several",
"new",
"records",
"in",
"the",
"table",
".",
"Values",
"of",
"inserted",
"records",
"fields",
"are",
"taken",
"from",
"objects",
"of",
"specified",
"array",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/jora/Table.java#L228-L244 | train |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/jora/Table.java | Table.delete | public synchronized int delete (Connection conn, T obj)
throws SQLException
{
if (primaryKeys == null) {
throw new IllegalStateException(
"No primary key for table " + name + ".");
}
int nDeleted = 0;
StringBuilder sql = new StringBuilder(
... | java | public synchronized int delete (Connection conn, T obj)
throws SQLException
{
if (primaryKeys == null) {
throw new IllegalStateException(
"No primary key for table " + name + ".");
}
int nDeleted = 0;
StringBuilder sql = new StringBuilder(
... | [
"public",
"synchronized",
"int",
"delete",
"(",
"Connection",
"conn",
",",
"T",
"obj",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"primaryKeys",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No primary key for table \"",
"+",
"name... | Delete record with specified value of primary key from the table.
@param obj object containing value of primary key. | [
"Delete",
"record",
"with",
"specified",
"value",
"of",
"primary",
"key",
"from",
"the",
"table",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/jora/Table.java#L346-L366 | train |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/jora/Table.java | Table.delete | public synchronized int delete (Connection conn, T[] objects)
throws SQLException
{
if (primaryKeys == null) {
throw new IllegalStateException(
"No primary key for table " + name + ".");
}
int nDeleted = 0;
StringBuilder sql = new StringBuilder(
... | java | public synchronized int delete (Connection conn, T[] objects)
throws SQLException
{
if (primaryKeys == null) {
throw new IllegalStateException(
"No primary key for table " + name + ".");
}
int nDeleted = 0;
StringBuilder sql = new StringBuilder(
... | [
"public",
"synchronized",
"int",
"delete",
"(",
"Connection",
"conn",
",",
"T",
"[",
"]",
"objects",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"primaryKeys",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No primary key for table \... | Delete records with specified primary keys from the table.
@param objects array of objects containing values of primary key.
@return number of objects actually deleted | [
"Delete",
"records",
"with",
"specified",
"primary",
"keys",
"from",
"the",
"table",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/jora/Table.java#L375-L402 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/QueryUtil.java | QueryUtil.restrictQueryExecution | public static boolean restrictQueryExecution(String sql) {
String[] restrictions = { "delete", "truncate", "update", "drop", "alter" };
if (sql != null) {
sql = sql.toLowerCase();
for (String restriction : restrictions) {
if (sql.startsWith(restriction)) {
return true;
}
String regex = "\\s+"... | java | public static boolean restrictQueryExecution(String sql) {
String[] restrictions = { "delete", "truncate", "update", "drop", "alter" };
if (sql != null) {
sql = sql.toLowerCase();
for (String restriction : restrictions) {
if (sql.startsWith(restriction)) {
return true;
}
String regex = "\\s+"... | [
"public",
"static",
"boolean",
"restrictQueryExecution",
"(",
"String",
"sql",
")",
"{",
"String",
"[",
"]",
"restrictions",
"=",
"{",
"\"delete\"",
",",
"\"truncate\"",
",",
"\"update\"",
",",
"\"drop\"",
",",
"\"alter\"",
"}",
";",
"if",
"(",
"sql",
"!=",
... | Restrict a query execution. Do not allow for database modifications.
@param sql
sql to execute
@return true if query is restricted | [
"Restrict",
"a",
"query",
"execution",
".",
"Do",
"not",
"allow",
"for",
"database",
"modifications",
"."
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/QueryUtil.java#L343-L360 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/QueryUtil.java | QueryUtil.isValidProcedureCall | public static boolean isValidProcedureCall(String sql, Dialect dialect) {
if (sql == null) {
return false;
}
if (dialect instanceof OracleDialect) {
return sql.split("\\?").length == 2;
} else {
return true;
}
} | java | public static boolean isValidProcedureCall(String sql, Dialect dialect) {
if (sql == null) {
return false;
}
if (dialect instanceof OracleDialect) {
return sql.split("\\?").length == 2;
} else {
return true;
}
} | [
"public",
"static",
"boolean",
"isValidProcedureCall",
"(",
"String",
"sql",
",",
"Dialect",
"dialect",
")",
"{",
"if",
"(",
"sql",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"dialect",
"instanceof",
"OracleDialect",
")",
"{",
"return"... | See if the sql contains only one '?' character
@param sql
sql to execute
@param dialect
dialect
@return true if the sql contains only one '?' character, false otherwise | [
"See",
"if",
"the",
"sql",
"contains",
"only",
"one",
"?",
"character"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/QueryUtil.java#L385-L394 | train |
brutusin/json | src/main/java/org/brutusin/json/spi/Expression.java | Expression.compile | public static Expression compile(String exp) {
if (Miscellaneous.isEmpty(exp) || exp.equals(".")) {
exp = "$";
}
Queue<String> queue = new LinkedList<String>();
List<String> tokens = parseTokens(exp);
boolean isInBracket = false;
int numInBracket = 0;
... | java | public static Expression compile(String exp) {
if (Miscellaneous.isEmpty(exp) || exp.equals(".")) {
exp = "$";
}
Queue<String> queue = new LinkedList<String>();
List<String> tokens = parseTokens(exp);
boolean isInBracket = false;
int numInBracket = 0;
... | [
"public",
"static",
"Expression",
"compile",
"(",
"String",
"exp",
")",
"{",
"if",
"(",
"Miscellaneous",
".",
"isEmpty",
"(",
"exp",
")",
"||",
"exp",
".",
"equals",
"(",
"\".\"",
")",
")",
"{",
"exp",
"=",
"\"$\"",
";",
"}",
"Queue",
"<",
"String",
... | Compiles the expression.
@param exp
@return | [
"Compiles",
"the",
"expression",
"."
] | 2827a871aea2b56302ecb79a765d75eacb53dfca | https://github.com/brutusin/json/blob/2827a871aea2b56302ecb79a765d75eacb53dfca/src/main/java/org/brutusin/json/spi/Expression.java#L71-L115 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.addDragSource | public static void addDragSource (
DragSource source, JComponent comp, boolean autoremove)
{
singleton.addSource(source, comp, autoremove);
} | java | public static void addDragSource (
DragSource source, JComponent comp, boolean autoremove)
{
singleton.addSource(source, comp, autoremove);
} | [
"public",
"static",
"void",
"addDragSource",
"(",
"DragSource",
"source",
",",
"JComponent",
"comp",
",",
"boolean",
"autoremove",
")",
"{",
"singleton",
".",
"addSource",
"(",
"source",
",",
"comp",
",",
"autoremove",
")",
";",
"}"
] | Add the specified component as a source of drags, with the DragSource
controller.
@param autoremove if true, the source will automatically be removed
from the DnD system when it is removed from the component hierarchy. | [
"Add",
"the",
"specified",
"component",
"as",
"a",
"source",
"of",
"drags",
"with",
"the",
"DragSource",
"controller",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L58-L62 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.addDropTarget | public static void addDropTarget (
DropTarget target, JComponent comp, boolean autoremove)
{
singleton.addTarget(target, comp, autoremove);
} | java | public static void addDropTarget (
DropTarget target, JComponent comp, boolean autoremove)
{
singleton.addTarget(target, comp, autoremove);
} | [
"public",
"static",
"void",
"addDropTarget",
"(",
"DropTarget",
"target",
",",
"JComponent",
"comp",
",",
"boolean",
"autoremove",
")",
"{",
"singleton",
".",
"addTarget",
"(",
"target",
",",
"comp",
",",
"autoremove",
")",
";",
"}"
] | Add the specified component as a drop target.
@param autoremove if true, the source will automatically be removed
from the DnD system when it is removed from the component hierarchy. | [
"Add",
"the",
"specified",
"component",
"as",
"a",
"drop",
"target",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L79-L83 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.addSource | protected void addSource (
DragSource source, JComponent comp, boolean autoremove)
{
_draggers.put(comp, source);
comp.addMouseListener(_sourceListener);
comp.addMouseMotionListener(_sourceListener);
if (autoremove) {
comp.addAncestorListener(_remover);
}
... | java | protected void addSource (
DragSource source, JComponent comp, boolean autoremove)
{
_draggers.put(comp, source);
comp.addMouseListener(_sourceListener);
comp.addMouseMotionListener(_sourceListener);
if (autoremove) {
comp.addAncestorListener(_remover);
}
... | [
"protected",
"void",
"addSource",
"(",
"DragSource",
"source",
",",
"JComponent",
"comp",
",",
"boolean",
"autoremove",
")",
"{",
"_draggers",
".",
"put",
"(",
"comp",
",",
"source",
")",
";",
"comp",
".",
"addMouseListener",
"(",
"_sourceListener",
")",
";"... | Add a dragsource. | [
"Add",
"a",
"dragsource",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L111-L120 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.removeSource | protected void removeSource (JComponent comp)
{
if (_sourceComp == comp) {
// reset cursors
clearComponentCursor();
_topComp.setCursor(_topCursor);
reset();
}
_draggers.remove(comp);
comp.removeMouseListener(_sourceListener);
co... | java | protected void removeSource (JComponent comp)
{
if (_sourceComp == comp) {
// reset cursors
clearComponentCursor();
_topComp.setCursor(_topCursor);
reset();
}
_draggers.remove(comp);
comp.removeMouseListener(_sourceListener);
co... | [
"protected",
"void",
"removeSource",
"(",
"JComponent",
"comp",
")",
"{",
"if",
"(",
"_sourceComp",
"==",
"comp",
")",
"{",
"// reset cursors",
"clearComponentCursor",
"(",
")",
";",
"_topComp",
".",
"setCursor",
"(",
"_topCursor",
")",
";",
"reset",
"(",
")... | Remove a dragsource. | [
"Remove",
"a",
"dragsource",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L125-L136 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.addTarget | protected void addTarget (
DropTarget target, JComponent comp, boolean autoremove)
{
_droppers.put(comp, target);
addTargetListeners(comp);
if (autoremove) {
comp.addAncestorListener(_remover);
}
} | java | protected void addTarget (
DropTarget target, JComponent comp, boolean autoremove)
{
_droppers.put(comp, target);
addTargetListeners(comp);
if (autoremove) {
comp.addAncestorListener(_remover);
}
} | [
"protected",
"void",
"addTarget",
"(",
"DropTarget",
"target",
",",
"JComponent",
"comp",
",",
"boolean",
"autoremove",
")",
"{",
"_droppers",
".",
"put",
"(",
"comp",
",",
"target",
")",
";",
"addTargetListeners",
"(",
"comp",
")",
";",
"if",
"(",
"autore... | Add a droptarget. | [
"Add",
"a",
"droptarget",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L141-L149 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.addTargetListeners | protected void addTargetListeners (Component comp)
{
comp.addMouseListener(_targetListener);
comp.addMouseMotionListener(_targetListener);
if (comp instanceof Container) { // hm, always true for JComp..
Container cont = (Container) comp;
cont.addContainerListener(_chi... | java | protected void addTargetListeners (Component comp)
{
comp.addMouseListener(_targetListener);
comp.addMouseMotionListener(_targetListener);
if (comp instanceof Container) { // hm, always true for JComp..
Container cont = (Container) comp;
cont.addContainerListener(_chi... | [
"protected",
"void",
"addTargetListeners",
"(",
"Component",
"comp",
")",
"{",
"comp",
".",
"addMouseListener",
"(",
"_targetListener",
")",
";",
"comp",
".",
"addMouseMotionListener",
"(",
"_targetListener",
")",
";",
"if",
"(",
"comp",
"instanceof",
"Container",... | Add the appropriate target listeners to this component
and all its children. | [
"Add",
"the",
"appropriate",
"target",
"listeners",
"to",
"this",
"component",
"and",
"all",
"its",
"children",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L164-L175 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.removeTargetListeners | protected void removeTargetListeners (Component comp)
{
comp.removeMouseListener(_targetListener);
comp.removeMouseMotionListener(_targetListener);
if (comp instanceof Container) { // again, always true for JComp...
Container cont = (Container) comp;
cont.removeContai... | java | protected void removeTargetListeners (Component comp)
{
comp.removeMouseListener(_targetListener);
comp.removeMouseMotionListener(_targetListener);
if (comp instanceof Container) { // again, always true for JComp...
Container cont = (Container) comp;
cont.removeContai... | [
"protected",
"void",
"removeTargetListeners",
"(",
"Component",
"comp",
")",
"{",
"comp",
".",
"removeMouseListener",
"(",
"_targetListener",
")",
";",
"comp",
".",
"removeMouseMotionListener",
"(",
"_targetListener",
")",
";",
"if",
"(",
"comp",
"instanceof",
"Co... | Remove the appropriate target listeners to this component
and all its children. | [
"Remove",
"the",
"appropriate",
"target",
"listeners",
"to",
"this",
"component",
"and",
"all",
"its",
"children",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L181-L192 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.setComponentCursor | protected void setComponentCursor (Component comp)
{
Cursor c = comp.getCursor();
if (c != _curCursor) {
assertComponentCursorCleared();
_lastComp = comp;
_oldCursor = comp.isCursorSet() ? c : null;
comp.setCursor(_curCursor);
}
} | java | protected void setComponentCursor (Component comp)
{
Cursor c = comp.getCursor();
if (c != _curCursor) {
assertComponentCursorCleared();
_lastComp = comp;
_oldCursor = comp.isCursorSet() ? c : null;
comp.setCursor(_curCursor);
}
} | [
"protected",
"void",
"setComponentCursor",
"(",
"Component",
"comp",
")",
"{",
"Cursor",
"c",
"=",
"comp",
".",
"getCursor",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"_curCursor",
")",
"{",
"assertComponentCursorCleared",
"(",
")",
";",
"_lastComp",
"=",
"comp... | Check to see if we need to do component-level cursor setting and take
care of it if needed. | [
"Check",
"to",
"see",
"if",
"we",
"need",
"to",
"do",
"component",
"-",
"level",
"cursor",
"setting",
"and",
"take",
"care",
"of",
"it",
"if",
"needed",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L198-L207 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.findAppropriateTarget | protected DropTarget findAppropriateTarget (Component comp)
{
DropTarget target;
while (comp != null) {
// here we sneakily prevent dropping on the source
target = (comp == _sourceComp) ? null : _droppers.get(comp);
if ((target != null) && comp.isEnabled() &&
... | java | protected DropTarget findAppropriateTarget (Component comp)
{
DropTarget target;
while (comp != null) {
// here we sneakily prevent dropping on the source
target = (comp == _sourceComp) ? null : _droppers.get(comp);
if ((target != null) && comp.isEnabled() &&
... | [
"protected",
"DropTarget",
"findAppropriateTarget",
"(",
"Component",
"comp",
")",
"{",
"DropTarget",
"target",
";",
"while",
"(",
"comp",
"!=",
"null",
")",
"{",
"// here we sneakily prevent dropping on the source",
"target",
"=",
"(",
"comp",
"==",
"_sourceComp",
... | Find the lowest accepting parental target to this component. | [
"Find",
"the",
"lowest",
"accepting",
"parental",
"target",
"to",
"this",
"component",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L260-L274 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.checkAutoscroll | protected void checkAutoscroll (MouseEvent exitEvent)
{
Component comp = exitEvent.getComponent();
Point p = exitEvent.getPoint();
try {
Point scr = comp.getLocationOnScreen();
p.translate(scr.x, scr.y);
} catch (IllegalComponentStateException icse) {
... | java | protected void checkAutoscroll (MouseEvent exitEvent)
{
Component comp = exitEvent.getComponent();
Point p = exitEvent.getPoint();
try {
Point scr = comp.getLocationOnScreen();
p.translate(scr.x, scr.y);
} catch (IllegalComponentStateException icse) {
... | [
"protected",
"void",
"checkAutoscroll",
"(",
"MouseEvent",
"exitEvent",
")",
"{",
"Component",
"comp",
"=",
"exitEvent",
".",
"getComponent",
"(",
")",
";",
"Point",
"p",
"=",
"exitEvent",
".",
"getPoint",
"(",
")",
";",
"try",
"{",
"Point",
"scr",
"=",
... | Check to see if we want to enter autoscrolling mode. | [
"Check",
"to",
"see",
"if",
"we",
"want",
"to",
"enter",
"autoscrolling",
"mode",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L279-L317 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.getRectOnScreen | protected Rectangle getRectOnScreen (JComponent comp)
{
Rectangle r = comp.getVisibleRect();
Point p = comp.getLocationOnScreen();
r.translate(p.x, p.y);
return r;
} | java | protected Rectangle getRectOnScreen (JComponent comp)
{
Rectangle r = comp.getVisibleRect();
Point p = comp.getLocationOnScreen();
r.translate(p.x, p.y);
return r;
} | [
"protected",
"Rectangle",
"getRectOnScreen",
"(",
"JComponent",
"comp",
")",
"{",
"Rectangle",
"r",
"=",
"comp",
".",
"getVisibleRect",
"(",
")",
";",
"Point",
"p",
"=",
"comp",
".",
"getLocationOnScreen",
"(",
")",
";",
"r",
".",
"translate",
"(",
"p",
... | Find the rectangular area that is visible in screen coordinates
for the given component. | [
"Find",
"the",
"rectangular",
"area",
"that",
"is",
"visible",
"in",
"screen",
"coordinates",
"for",
"the",
"given",
"component",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L323-L329 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/dnd/DnDManager.java | DnDManager.reset | protected void reset ()
{
_scrollTimer.stop();
_source = null;
_sourceComp = null;
_lastComp = null;
_lastTarget = null;
_data[0] = null;
_cursors[0] = null;
_cursors[1] = null;
_topComp = null;
_topCursor = null;
_curCursor = ... | java | protected void reset ()
{
_scrollTimer.stop();
_source = null;
_sourceComp = null;
_lastComp = null;
_lastTarget = null;
_data[0] = null;
_cursors[0] = null;
_cursors[1] = null;
_topComp = null;
_topCursor = null;
_curCursor = ... | [
"protected",
"void",
"reset",
"(",
")",
"{",
"_scrollTimer",
".",
"stop",
"(",
")",
";",
"_source",
"=",
"null",
";",
"_sourceComp",
"=",
"null",
";",
"_lastComp",
"=",
"null",
";",
"_lastTarget",
"=",
"null",
";",
"_data",
"[",
"0",
"]",
"=",
"null"... | Reset dnd to a starting state. | [
"Reset",
"dnd",
"to",
"a",
"starting",
"state",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/dnd/DnDManager.java#L334-L352 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.loadConvertedReport | public static Report loadConvertedReport(InputStream is) {
XStream xstream = XStreamFactory.createXStream();
InputStreamReader reader = null;
try {
reader = new InputStreamReader(is, "UTF-8");
return (Report) xstream.fromXML(reader);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStack... | java | public static Report loadConvertedReport(InputStream is) {
XStream xstream = XStreamFactory.createXStream();
InputStreamReader reader = null;
try {
reader = new InputStreamReader(is, "UTF-8");
return (Report) xstream.fromXML(reader);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStack... | [
"public",
"static",
"Report",
"loadConvertedReport",
"(",
"InputStream",
"is",
")",
"{",
"XStream",
"xstream",
"=",
"XStreamFactory",
".",
"createXStream",
"(",
")",
";",
"InputStreamReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"Input... | Create a report object from an input stream
Use this method if you know your report version does not need any
conversion from older versions, otherwise see
{@link #loadReport(InputStream)}
@param is
input stream
@return the report object created from the input stream or null if cannot
be read | [
"Create",
"a",
"report",
"object",
"from",
"an",
"input",
"stream"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L109-L120 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.loadConvertedReport | public static Report loadConvertedReport(String xml) {
XStream xstream = XStreamFactory.createXStream();
try {
return (Report) xstream.fromXML(xml);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
return null;
}
} | java | public static Report loadConvertedReport(String xml) {
XStream xstream = XStreamFactory.createXStream();
try {
return (Report) xstream.fromXML(xml);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
e.printStackTrace();
return null;
}
} | [
"public",
"static",
"Report",
"loadConvertedReport",
"(",
"String",
"xml",
")",
"{",
"XStream",
"xstream",
"=",
"XStreamFactory",
".",
"createXStream",
"(",
")",
";",
"try",
"{",
"return",
"(",
"Report",
")",
"xstream",
".",
"fromXML",
"(",
"xml",
")",
";"... | Create a report object from xml
Use this method if you know your report version does not need any
conversion from older versions, otherwise see {@link #loadReport(String)}
@param xml
xml text
@return the report object created from xml or null if cannot be read | [
"Create",
"a",
"report",
"object",
"from",
"xml"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L132-L141 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.loadReport | public static Report loadReport(String xml) throws LoadReportException {
try {
String convertedXml = ConverterChain.applyFromXml(xml);
XStream xstream = XStreamFactory.createXStream();
return (Report) xstream.fromXML(convertedXml);
} catch (ConverterException ex) {
LOG.error(ex.getMessage(), ex);
thr... | java | public static Report loadReport(String xml) throws LoadReportException {
try {
String convertedXml = ConverterChain.applyFromXml(xml);
XStream xstream = XStreamFactory.createXStream();
return (Report) xstream.fromXML(convertedXml);
} catch (ConverterException ex) {
LOG.error(ex.getMessage(), ex);
thr... | [
"public",
"static",
"Report",
"loadReport",
"(",
"String",
"xml",
")",
"throws",
"LoadReportException",
"{",
"try",
"{",
"String",
"convertedXml",
"=",
"ConverterChain",
".",
"applyFromXml",
"(",
"xml",
")",
";",
"XStream",
"xstream",
"=",
"XStreamFactory",
".",... | Create a report object from xml Do a conversion if it is needed
@since 5.2
@param xml
xml text
@return the report object created from xml or null if cannot be read
@throws LoadReportException
if report object cannot be created | [
"Create",
"a",
"report",
"object",
"from",
"xml",
"Do",
"a",
"conversion",
"if",
"it",
"is",
"needed"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L154-L163 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.loadReport | public static Report loadReport(InputStream is) throws LoadReportException {
try {
String xml = readAsString(is);
String convertedXml = ConverterChain.applyFromXml(xml);
XStream xstream = XStreamFactory.createXStream();
return (Report) xstream.fromXML(convertedXml);
} catch (Exception ex) {
LOG.error... | java | public static Report loadReport(InputStream is) throws LoadReportException {
try {
String xml = readAsString(is);
String convertedXml = ConverterChain.applyFromXml(xml);
XStream xstream = XStreamFactory.createXStream();
return (Report) xstream.fromXML(convertedXml);
} catch (Exception ex) {
LOG.error... | [
"public",
"static",
"Report",
"loadReport",
"(",
"InputStream",
"is",
")",
"throws",
"LoadReportException",
"{",
"try",
"{",
"String",
"xml",
"=",
"readAsString",
"(",
"is",
")",
";",
"String",
"convertedXml",
"=",
"ConverterChain",
".",
"applyFromXml",
"(",
"... | Create a report object from an input stream Do a conversion if it is
needed
@since 5.2
@param is
input stream
@return the report object created from the input stream or null if cannot
be read
@throws LoadReportException
if report object cannot be created | [
"Create",
"a",
"report",
"object",
"from",
"an",
"input",
"stream",
"Do",
"a",
"conversion",
"if",
"it",
"is",
"needed"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L178-L188 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.saveReport | public static void saveReport(Report report, OutputStream out) {
XStream xstream = XStreamFactory.createXStream();
xstream.toXML(report, out);
} | java | public static void saveReport(Report report, OutputStream out) {
XStream xstream = XStreamFactory.createXStream();
xstream.toXML(report, out);
} | [
"public",
"static",
"void",
"saveReport",
"(",
"Report",
"report",
",",
"OutputStream",
"out",
")",
"{",
"XStream",
"xstream",
"=",
"XStreamFactory",
".",
"createXStream",
"(",
")",
";",
"xstream",
".",
"toXML",
"(",
"report",
",",
"out",
")",
";",
"}"
] | Write a report object to an output stream
@param report
report object
@param out
output stream | [
"Write",
"a",
"report",
"object",
"to",
"an",
"output",
"stream"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L198-L201 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.saveReport | public static void saveReport(Report report, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
saveReport(report, fos);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
}... | java | public static void saveReport(Report report, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
saveReport(report, fos);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
}... | [
"public",
"static",
"void",
"saveReport",
"(",
"Report",
"report",
",",
"String",
"path",
")",
"{",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"path",
")",
";",
"saveReport",
"(",
"report",
",",
"... | Write a report object to a file at specified path
@param report
report object
@param path
file path | [
"Write",
"a",
"report",
"object",
"to",
"a",
"file",
"at",
"specified",
"path"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L211-L228 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.saveReport | public static void saveReport(String xml, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
fos.write(xml.getBytes("UTF-8"));
fos.flush();
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
... | java | public static void saveReport(String xml, String path) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(path);
fos.write(xml.getBytes("UTF-8"));
fos.flush();
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
ex.printStackTrace();
} finally {
if (fos != null) {
try {
... | [
"public",
"static",
"void",
"saveReport",
"(",
"String",
"xml",
",",
"String",
"path",
")",
"{",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"path",
")",
";",
"fos",
".",
"write",
"(",
"xml",
"."... | Write a xml text to a file at specified path
@param xml
xml text
@param path
file path | [
"Write",
"a",
"xml",
"text",
"to",
"a",
"file",
"at",
"specified",
"path"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L238-L256 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.reportToXml | public static String reportToXml(Report report) {
XStream xstream = XStreamFactory.createXStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xstream.toXML(report, bos);
return bos.toString();
} | java | public static String reportToXml(Report report) {
XStream xstream = XStreamFactory.createXStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xstream.toXML(report, bos);
return bos.toString();
} | [
"public",
"static",
"String",
"reportToXml",
"(",
"Report",
"report",
")",
"{",
"XStream",
"xstream",
"=",
"XStreamFactory",
".",
"createXStream",
"(",
")",
";",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"xstream",
".",
... | Convert a report object to xml text
@param report
report object
@return xml text | [
"Convert",
"a",
"report",
"object",
"to",
"xml",
"text"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L265-L270 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.isValid | public static byte isValid(String reportVersion) {
if (isOlderUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_OLDER;
} else if (isNewerUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_NEWER;
} else {
return REPORT_VALID;
}
} | java | public static byte isValid(String reportVersion) {
if (isOlderUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_OLDER;
} else if (isNewerUnsupportedVersion(reportVersion)) {
return REPORT_INVALID_NEWER;
} else {
return REPORT_VALID;
}
} | [
"public",
"static",
"byte",
"isValid",
"(",
"String",
"reportVersion",
")",
"{",
"if",
"(",
"isOlderUnsupportedVersion",
"(",
"reportVersion",
")",
")",
"{",
"return",
"REPORT_INVALID_OLDER",
";",
"}",
"else",
"if",
"(",
"isNewerUnsupportedVersion",
"(",
"reportVe... | Test if string version given as parameter is valid, meaning is over 2.0
and no greater than current engine version
@param reportVersion
version
@return one of REPORT_VALID, REPORT_INVALID_OLDER, REPORT_INVALID_NEWER | [
"Test",
"if",
"string",
"version",
"given",
"as",
"parameter",
"is",
"valid",
"meaning",
"is",
"over",
"2",
".",
"0",
"and",
"no",
"greater",
"than",
"current",
"engine",
"version"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L319-L327 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.isOlderUnsupportedVersion | public static boolean isOlderUnsupportedVersion(String version) {
return ((version == null) || "".equals(version) || version.startsWith("0") || version.startsWith("1"));
} | java | public static boolean isOlderUnsupportedVersion(String version) {
return ((version == null) || "".equals(version) || version.startsWith("0") || version.startsWith("1"));
} | [
"public",
"static",
"boolean",
"isOlderUnsupportedVersion",
"(",
"String",
"version",
")",
"{",
"return",
"(",
"(",
"version",
"==",
"null",
")",
"||",
"\"\"",
".",
"equals",
"(",
"version",
")",
"||",
"version",
".",
"startsWith",
"(",
"\"0\"",
")",
"||",... | Return true if version string is less than 2.0
@param version
version string
@return true if version string is less than 2.0 | [
"Return",
"true",
"if",
"version",
"string",
"is",
"less",
"than",
"2",
".",
"0"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L336-L338 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.isNewerUnsupportedVersion | public static boolean isNewerUnsupportedVersion(String version) {
if ((version == null) || "".equals(version)) {
return true;
}
String engineVersion = ReleaseInfoAdapter.getVersionNumber();
String[] ev = engineVersion.split("\\.");
String[] rv = version.split("\\.");
return ((Integer.parseInt(ev[0]) < In... | java | public static boolean isNewerUnsupportedVersion(String version) {
if ((version == null) || "".equals(version)) {
return true;
}
String engineVersion = ReleaseInfoAdapter.getVersionNumber();
String[] ev = engineVersion.split("\\.");
String[] rv = version.split("\\.");
return ((Integer.parseInt(ev[0]) < In... | [
"public",
"static",
"boolean",
"isNewerUnsupportedVersion",
"(",
"String",
"version",
")",
"{",
"if",
"(",
"(",
"version",
"==",
"null",
")",
"||",
"\"\"",
".",
"equals",
"(",
"version",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"engineVersion",... | Return true if version string is newer than version of the report engine
@param version
version string
@return true if version string is newer than version of the report engine | [
"Return",
"true",
"if",
"version",
"string",
"is",
"newer",
"than",
"version",
"of",
"the",
"report",
"engine"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L347-L356 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.compareVersions | public static int compareVersions(String v1, String v2) {
String[] v1a = v1.split("\\.");
String[] v2a = v2.split("\\.");
Integer v1M = Integer.parseInt(v1a[0]);
Integer v2M = Integer.parseInt(v2a[0]);
if (v1M < v2M) {
return -1;
} else if (v1M > v2M) {
return 1;
} else {
Integer v1min = Integer.... | java | public static int compareVersions(String v1, String v2) {
String[] v1a = v1.split("\\.");
String[] v2a = v2.split("\\.");
Integer v1M = Integer.parseInt(v1a[0]);
Integer v2M = Integer.parseInt(v2a[0]);
if (v1M < v2M) {
return -1;
} else if (v1M > v2M) {
return 1;
} else {
Integer v1min = Integer.... | [
"public",
"static",
"int",
"compareVersions",
"(",
"String",
"v1",
",",
"String",
"v2",
")",
"{",
"String",
"[",
"]",
"v1a",
"=",
"v1",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"String",
"[",
"]",
"v2a",
"=",
"v2",
".",
"split",
"(",
"\"\\\\.\"",
... | Compare two report versions strings
@param v1
first version string
@param v2
second version string
@return -1 if v1 less than v2, 0 if v1 equals v2, 1 if v1 greater than v2 | [
"Compare",
"two",
"report",
"versions",
"strings"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L367-L387 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getVersion | public static String getVersion(String reportFile) {
try {
String text = readAsString(reportFile);
return getVersionFromText(text);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} | java | public static String getVersion(String reportFile) {
try {
String text = readAsString(reportFile);
return getVersionFromText(text);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} | [
"public",
"static",
"String",
"getVersion",
"(",
"String",
"reportFile",
")",
"{",
"try",
"{",
"String",
"text",
"=",
"readAsString",
"(",
"reportFile",
")",
";",
"return",
"getVersionFromText",
"(",
"text",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
... | Get report version from report file
@param reportFile
report file
@return report version | [
"Get",
"report",
"version",
"from",
"report",
"file"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L396-L404 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getVersion | public static String getVersion(InputStream is) {
try {
String text = readAsString(is);
return getVersionFromText(text);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} | java | public static String getVersion(InputStream is) {
try {
String text = readAsString(is);
return getVersionFromText(text);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return null;
}
} | [
"public",
"static",
"String",
"getVersion",
"(",
"InputStream",
"is",
")",
"{",
"try",
"{",
"String",
"text",
"=",
"readAsString",
"(",
"is",
")",
";",
"return",
"getVersionFromText",
"(",
"text",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{"... | Get report version from input stream to read report file
@param is
input stream
@return report version | [
"Get",
"report",
"version",
"from",
"input",
"stream",
"to",
"read",
"report",
"file"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L413-L421 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.readAsString | public static String readAsString(String reportPath) throws IOException {
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new FileReader(reportPath));
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0... | java | public static String readAsString(String reportPath) throws IOException {
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new FileReader(reportPath));
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0... | [
"public",
"static",
"String",
"readAsString",
"(",
"String",
"reportPath",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"fileData",
"=",
"new",
"StringBuffer",
"(",
"1000",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"Fi... | Read a report file as string
@param reportPath
file path
@return string file content
@throws IOException
if file cannot be read | [
"Read",
"a",
"report",
"file",
"as",
"string"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L466-L476 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.readAsString | public static String readAsString(InputStream is) throws IOException {
try {
// Scanner iterates over tokens in the stream, and in this case
// we separate tokens using "beginning of the input boundary" (\A)
// thus giving us only one token for the entire contents of the
// stream
return new Scanner(is... | java | public static String readAsString(InputStream is) throws IOException {
try {
// Scanner iterates over tokens in the stream, and in this case
// we separate tokens using "beginning of the input boundary" (\A)
// thus giving us only one token for the entire contents of the
// stream
return new Scanner(is... | [
"public",
"static",
"String",
"readAsString",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"try",
"{",
"// Scanner iterates over tokens in the stream, and in this case",
"// we separate tokens using \"beginning of the input boundary\" (\\A)",
"// thus giving us only one... | Read data from input stream
@param is
input stream
@return string content read from input stream
@throws IOException
if cannot read from input stream | [
"Read",
"data",
"from",
"input",
"stream"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L487-L497 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getFileName | public static String getFileName(String filePath) {
if (filePath == null) {
return filePath;
}
int index = filePath.lastIndexOf(File.separator);
if (index == -1) {
return filePath;
}
return filePath.substring(index + 1);
} | java | public static String getFileName(String filePath) {
if (filePath == null) {
return filePath;
}
int index = filePath.lastIndexOf(File.separator);
if (index == -1) {
return filePath;
}
return filePath.substring(index + 1);
} | [
"public",
"static",
"String",
"getFileName",
"(",
"String",
"filePath",
")",
"{",
"if",
"(",
"filePath",
"==",
"null",
")",
"{",
"return",
"filePath",
";",
"}",
"int",
"index",
"=",
"filePath",
".",
"lastIndexOf",
"(",
"File",
".",
"separator",
")",
";",... | Get file name from a file path
@param filePath
file path
@return file name | [
"Get",
"file",
"name",
"from",
"a",
"file",
"path"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L506-L515 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getStaticImages | public static List<String> getStaticImages(Report report) {
List<String> images = new ArrayList<String>();
ReportLayout layout = report.getLayout();
List<Band> bands = layout.getBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.ge... | java | public static List<String> getStaticImages(Report report) {
List<String> images = new ArrayList<String>();
ReportLayout layout = report.getLayout();
List<Band> bands = layout.getBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.ge... | [
"public",
"static",
"List",
"<",
"String",
">",
"getStaticImages",
"(",
"Report",
"report",
")",
"{",
"List",
"<",
"String",
">",
"images",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"ReportLayout",
"layout",
"=",
"report",
".",
"getLayo... | Get static images used by report
@param report
report
@return a list of static images used by report | [
"Get",
"static",
"images",
"used",
"by",
"report"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L524-L543 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getSql | public static String getSql(Report report) {
String sql;
if (report.getSql() != null) {
sql = report.getSql();
} else {
sql = report.getQuery().toString();
}
return sql;
} | java | public static String getSql(Report report) {
String sql;
if (report.getSql() != null) {
sql = report.getSql();
} else {
sql = report.getQuery().toString();
}
return sql;
} | [
"public",
"static",
"String",
"getSql",
"(",
"Report",
"report",
")",
"{",
"String",
"sql",
";",
"if",
"(",
"report",
".",
"getSql",
"(",
")",
"!=",
"null",
")",
"{",
"sql",
"=",
"report",
".",
"getSql",
"(",
")",
";",
"}",
"else",
"{",
"sql",
"=... | Get sql string from report object
@param report
report
@return sql string from report object | [
"Get",
"sql",
"string",
"from",
"report",
"object"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L552-L560 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getExpressions | public static List<ExpressionBean> getExpressions(ReportLayout layout) {
List<ExpressionBean> expressions = new LinkedList<ExpressionBean>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : li... | java | public static List<ExpressionBean> getExpressions(ReportLayout layout) {
List<ExpressionBean> expressions = new LinkedList<ExpressionBean>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : li... | [
"public",
"static",
"List",
"<",
"ExpressionBean",
">",
"getExpressions",
"(",
"ReportLayout",
"layout",
")",
"{",
"List",
"<",
"ExpressionBean",
">",
"expressions",
"=",
"new",
"LinkedList",
"<",
"ExpressionBean",
">",
"(",
")",
";",
"for",
"(",
"Band",
"ba... | Get expression elements from report layout
@param layout
report layout
@return list of expression elements from report layout | [
"Get",
"expression",
"elements",
"from",
"report",
"layout"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L647-L662 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getExpressionsNames | public static List<String> getExpressionsNames(ReportLayout layout) {
List<String> expressions = new LinkedList<String>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : list) {
if (be i... | java | public static List<String> getExpressionsNames(ReportLayout layout) {
List<String> expressions = new LinkedList<String>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : list) {
if (be i... | [
"public",
"static",
"List",
"<",
"String",
">",
"getExpressionsNames",
"(",
"ReportLayout",
"layout",
")",
"{",
"List",
"<",
"String",
">",
"expressions",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Band",
"band",
":",
"layo... | Get expression names from report layout
@param layout
report layout
@return list of expression names from report layout | [
"Get",
"expression",
"names",
"from",
"report",
"layout"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L700-L716 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.isValidSqlWithMessage | public static String isValidSqlWithMessage(Connection con, String sql, List<QueryParameter> parameters) {
try {
QueryUtil qu = new QueryUtil(con, DialectUtil.getDialect(con));
Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
for (QueryParameter qp : parameters) {
params.pu... | java | public static String isValidSqlWithMessage(Connection con, String sql, List<QueryParameter> parameters) {
try {
QueryUtil qu = new QueryUtil(con, DialectUtil.getDialect(con));
Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
for (QueryParameter qp : parameters) {
params.pu... | [
"public",
"static",
"String",
"isValidSqlWithMessage",
"(",
"Connection",
"con",
",",
"String",
"sql",
",",
"List",
"<",
"QueryParameter",
">",
"parameters",
")",
"{",
"try",
"{",
"QueryUtil",
"qu",
"=",
"new",
"QueryUtil",
"(",
"con",
",",
"DialectUtil",
".... | Test if sql with parameters is valid
@param con database connection
@param sql sql
@return return message error if sql is not valid, null otherwise | [
"Test",
"if",
"sql",
"with",
"parameters",
"is",
"valid"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L761-L774 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getSubreports | public static List<Report> getSubreports(Report report) {
List<Report> subreports = new ArrayList<Report>();
List<Band> bands = report.getLayout().getDocumentBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (i... | java | public static List<Report> getSubreports(Report report) {
List<Report> subreports = new ArrayList<Report>();
List<Band> bands = report.getLayout().getDocumentBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (i... | [
"public",
"static",
"List",
"<",
"Report",
">",
"getSubreports",
"(",
"Report",
"report",
")",
"{",
"List",
"<",
"Report",
">",
"subreports",
"=",
"new",
"ArrayList",
"<",
"Report",
">",
"(",
")",
";",
"List",
"<",
"Band",
">",
"bands",
"=",
"report",
... | Get subreports for a report
@param report current report
@return list of subreports | [
"Get",
"subreports",
"for",
"a",
"report"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L781-L797 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getDetailSubreports | public static List<Report> getDetailSubreports(ReportLayout reportLayout) {
List<Report> subreports = new ArrayList<Report>();
Band band = reportLayout.getDetailBand();
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (int j = 0, size = list.size(); j... | java | public static List<Report> getDetailSubreports(ReportLayout reportLayout) {
List<Report> subreports = new ArrayList<Report>();
Band band = reportLayout.getDetailBand();
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (int j = 0, size = list.size(); j... | [
"public",
"static",
"List",
"<",
"Report",
">",
"getDetailSubreports",
"(",
"ReportLayout",
"reportLayout",
")",
"{",
"List",
"<",
"Report",
">",
"subreports",
"=",
"new",
"ArrayList",
"<",
"Report",
">",
"(",
")",
";",
"Band",
"band",
"=",
"reportLayout",
... | Get detail band subreports for a report layout
@param reportLayout current report layout
@return list of subreports from detail band | [
"Get",
"detail",
"band",
"subreports",
"for",
"a",
"report",
"layout"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L804-L818 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getDetailCharts | public static List<Chart> getDetailCharts(ReportLayout reportLayout) {
List<Chart> charts = new ArrayList<Chart>();
Band band = reportLayout.getDetailBand();
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (int j = 0, size = list.size(); j < size; j+... | java | public static List<Chart> getDetailCharts(ReportLayout reportLayout) {
List<Chart> charts = new ArrayList<Chart>();
Band band = reportLayout.getDetailBand();
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (int j = 0, size = list.size(); j < size; j+... | [
"public",
"static",
"List",
"<",
"Chart",
">",
"getDetailCharts",
"(",
"ReportLayout",
"reportLayout",
")",
"{",
"List",
"<",
"Chart",
">",
"charts",
"=",
"new",
"ArrayList",
"<",
"Chart",
">",
"(",
")",
";",
"Band",
"band",
"=",
"reportLayout",
".",
"ge... | Get detail band charts for a report layout
@param reportLayout current report layout
@return list of charts from detail band | [
"Get",
"detail",
"band",
"charts",
"for",
"a",
"report",
"layout"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L825-L839 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.getForReportLayout | private static ReportLayout getForReportLayout(Connection con, ReportLayout layout, ParametersBean pBean) throws Exception {
ReportLayout convertedLayout = ObjectCloner.silenceDeepCopy(layout);
List<Band> bands = convertedLayout.getDocumentBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowC... | java | private static ReportLayout getForReportLayout(Connection con, ReportLayout layout, ParametersBean pBean) throws Exception {
ReportLayout convertedLayout = ObjectCloner.silenceDeepCopy(layout);
List<Band> bands = convertedLayout.getDocumentBands();
for (Band band : bands) {
for (int i = 0, rows = band.getRowC... | [
"private",
"static",
"ReportLayout",
"getForReportLayout",
"(",
"Connection",
"con",
",",
"ReportLayout",
"layout",
",",
"ParametersBean",
"pBean",
")",
"throws",
"Exception",
"{",
"ReportLayout",
"convertedLayout",
"=",
"ObjectCloner",
".",
"silenceDeepCopy",
"(",
"l... | If a report layout contains a ForReportBandElement we must replace this
element with more ReportBandElements This means inserting n-1 new
columns, where n is the number of values return by sql inside
ForReportBandElement
A ForReportBandElement is interpreted only at first appearance Column
name from sql inside ForRepo... | [
"If",
"a",
"report",
"layout",
"contains",
"a",
"ForReportBandElement",
"we",
"must",
"replace",
"this",
"element",
"with",
"more",
"ReportBandElements",
"This",
"means",
"inserting",
"n",
"-",
"1",
"new",
"columns",
"where",
"n",
"is",
"the",
"number",
"of",
... | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L885-L939 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.foundFunctionInGroupHeader | public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) {
List<Band> groupHeaderBands = layout.getGroupHeaderBands();
for (Band band : groupHeaderBands) {
if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) {
return foundFunctionInBand(band);... | java | public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) {
List<Band> groupHeaderBands = layout.getGroupHeaderBands();
for (Band band : groupHeaderBands) {
if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) {
return foundFunctionInBand(band);... | [
"public",
"static",
"boolean",
"foundFunctionInGroupHeader",
"(",
"ReportLayout",
"layout",
",",
"String",
"groupName",
")",
"{",
"List",
"<",
"Band",
">",
"groupHeaderBands",
"=",
"layout",
".",
"getGroupHeaderBands",
"(",
")",
";",
"for",
"(",
"Band",
"band",
... | Test to see if a function is found in group header band
@param layout report layout
@param groupName group name
@return true if a function is found in group header band, false otherwise | [
"Test",
"to",
"see",
"if",
"a",
"function",
"is",
"found",
"in",
"group",
"header",
"band"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L1006-L1014 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.foundFunctionInAnyGroupHeader | public static boolean foundFunctionInAnyGroupHeader(ReportLayout layout) {
List<Band> groupHeaderBands = layout.getGroupHeaderBands();
for (Band band : groupHeaderBands) {
boolean found = foundFunctionInBand(band);
if (found) {
return true;
}
}
return false;
} | java | public static boolean foundFunctionInAnyGroupHeader(ReportLayout layout) {
List<Band> groupHeaderBands = layout.getGroupHeaderBands();
for (Band band : groupHeaderBands) {
boolean found = foundFunctionInBand(band);
if (found) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"foundFunctionInAnyGroupHeader",
"(",
"ReportLayout",
"layout",
")",
"{",
"List",
"<",
"Band",
">",
"groupHeaderBands",
"=",
"layout",
".",
"getGroupHeaderBands",
"(",
")",
";",
"for",
"(",
"Band",
"band",
":",
"groupHeaderBands",
... | Test to see if a function is found in any group header band
@param layout report layout
@return true if a function is found in any group header band, false otherwise | [
"Test",
"to",
"see",
"if",
"a",
"function",
"is",
"found",
"in",
"any",
"group",
"header",
"band"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L1022-L1031 | train |
samskivert/samskivert | src/main/java/com/samskivert/xml/SetPropertyFieldsRule.java | SetPropertyFieldsRule.addFieldParser | public void addFieldParser (String property, FieldParser parser)
{
if (_parsers == null) {
_parsers = new HashMap<String,FieldParser>();
}
_parsers.put(property, parser);
} | java | public void addFieldParser (String property, FieldParser parser)
{
if (_parsers == null) {
_parsers = new HashMap<String,FieldParser>();
}
_parsers.put(property, parser);
} | [
"public",
"void",
"addFieldParser",
"(",
"String",
"property",
",",
"FieldParser",
"parser",
")",
"{",
"if",
"(",
"_parsers",
"==",
"null",
")",
"{",
"_parsers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"FieldParser",
">",
"(",
")",
";",
"}",
"_parsers... | Adds a custom parser for the specified named field. | [
"Adds",
"a",
"custom",
"parser",
"for",
"the",
"specified",
"named",
"field",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/xml/SetPropertyFieldsRule.java#L52-L58 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ClassUtil.java | ClassUtil.getFields | public static Field[] getFields (Class<?> clazz)
{
ArrayList<Field> list = new ArrayList<Field>();
getFields(clazz, list);
return list.toArray(new Field[list.size()]);
} | java | public static Field[] getFields (Class<?> clazz)
{
ArrayList<Field> list = new ArrayList<Field>();
getFields(clazz, list);
return list.toArray(new Field[list.size()]);
} | [
"public",
"static",
"Field",
"[",
"]",
"getFields",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"ArrayList",
"<",
"Field",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"getFields",
"(",
"clazz",
",",
"list",
")",
";",... | Get the fields contained in the class and its superclasses. | [
"Get",
"the",
"fields",
"contained",
"in",
"the",
"class",
"and",
"its",
"superclasses",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L37-L42 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ClassUtil.java | ClassUtil.compatibleClasses | public static boolean compatibleClasses (Class<?>[] lhs, Class<?>[] rhs)
{
if (lhs.length != rhs.length) {
return false;
}
for (int i = 0; i < lhs.length; ++i) {
if (rhs[i] == null || rhs[i].equals(Void.TYPE)) {
if (lhs[i].isPrimitive()) {
... | java | public static boolean compatibleClasses (Class<?>[] lhs, Class<?>[] rhs)
{
if (lhs.length != rhs.length) {
return false;
}
for (int i = 0; i < lhs.length; ++i) {
if (rhs[i] == null || rhs[i].equals(Void.TYPE)) {
if (lhs[i].isPrimitive()) {
... | [
"public",
"static",
"boolean",
"compatibleClasses",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"lhs",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"rhs",
")",
"{",
"if",
"(",
"lhs",
".",
"length",
"!=",
"rhs",
".",
"length",
")",
"{",
"return",
"false",
";... | Tells whether instances of the classes in the 'rhs' array could be used as parameters to a
reflective method invocation whose parameter list has types denoted by the 'lhs' array.
@param lhs Class array representing the types of the formal parameters of a method.
@param rhs Class array representing the types of the act... | [
"Tells",
"whether",
"instances",
"of",
"the",
"classes",
"in",
"the",
"rhs",
"array",
"could",
"be",
"used",
"as",
"parameters",
"to",
"a",
"reflective",
"method",
"invocation",
"whose",
"parameter",
"list",
"has",
"types",
"denoted",
"by",
"the",
"lhs",
"ar... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L113-L138 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ClassUtil.java | ClassUtil.getAccessibleMethodFrom | public static Method getAccessibleMethodFrom (
Class<?> clazz, String methodName, Class<?>[] parameterTypes)
{
// Look for overridden method in the superclass.
Class<?> superclass = clazz.getSuperclass();
Method overriddenMethod = null;
if (superclass != null && classIsAcces... | java | public static Method getAccessibleMethodFrom (
Class<?> clazz, String methodName, Class<?>[] parameterTypes)
{
// Look for overridden method in the superclass.
Class<?> superclass = clazz.getSuperclass();
Method overriddenMethod = null;
if (superclass != null && classIsAcces... | [
"public",
"static",
"Method",
"getAccessibleMethodFrom",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
")",
"{",
"// Look for overridden method in the superclass.",
"Class",
"<",
"?",
... | Searches for the method with the given name and formal parameter types that is in the
nearest accessible class in the class hierarchy, starting with clazz's superclass. The
superclass and implemented interfaces of clazz are searched, then their superclasses,
etc. until a method is found. Returns null if there is no suc... | [
"Searches",
"for",
"the",
"method",
"with",
"the",
"given",
"name",
"and",
"formal",
"parameter",
"types",
"that",
"is",
"in",
"the",
"nearest",
"accessible",
"class",
"in",
"the",
"class",
"hierarchy",
"starting",
"with",
"clazz",
"s",
"superclass",
".",
"T... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L152-L205 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ClassUtil.java | ClassUtil.primitiveIsAssignableFrom | public static boolean primitiveIsAssignableFrom (Class<?> lhs, Class<?> rhs)
{
if (lhs == null || rhs == null) {
return false;
}
if (!(lhs.isPrimitive() && rhs.isPrimitive())) {
return false;
}
if (lhs.equals(rhs)) {
return true;
}
... | java | public static boolean primitiveIsAssignableFrom (Class<?> lhs, Class<?> rhs)
{
if (lhs == null || rhs == null) {
return false;
}
if (!(lhs.isPrimitive() && rhs.isPrimitive())) {
return false;
}
if (lhs.equals(rhs)) {
return true;
}
... | [
"public",
"static",
"boolean",
"primitiveIsAssignableFrom",
"(",
"Class",
"<",
"?",
">",
"lhs",
",",
"Class",
"<",
"?",
">",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
"||",
"rhs",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(... | Tells whether an instance of the primitive class represented by 'rhs' can be assigned to an
instance of the primitive class represented by 'lhs'.
@param lhs assignee class.
@param rhs assigned class.
@return true if compatible, false otherwise. If either argument is <code>null</code>, or one
of the parameters does no... | [
"Tells",
"whether",
"an",
"instance",
"of",
"the",
"primitive",
"class",
"represented",
"by",
"rhs",
"can",
"be",
"assigned",
"to",
"an",
"instance",
"of",
"the",
"primitive",
"class",
"represented",
"by",
"lhs",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L236-L252 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/chart/Star.java | Star.createStar | private void createStar() {
Point2D.Float point = start;
p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
p.moveTo(point.x, point.y);
p.lineTo(point.x + 3.0f, point.y - 1.5f); // Line from start to A
point = (Point2D.Float) p.getCurrentPoint();
p.lineTo(point.x ... | java | private void createStar() {
Point2D.Float point = start;
p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
p.moveTo(point.x, point.y);
p.lineTo(point.x + 3.0f, point.y - 1.5f); // Line from start to A
point = (Point2D.Float) p.getCurrentPoint();
p.lineTo(point.x ... | [
"private",
"void",
"createStar",
"(",
")",
"{",
"Point2D",
".",
"Float",
"point",
"=",
"start",
";",
"p",
"=",
"new",
"GeneralPath",
"(",
"GeneralPath",
".",
"WIND_NON_ZERO",
")",
";",
"p",
".",
"moveTo",
"(",
"point",
".",
"x",
",",
"point",
".",
"y... | Create the path from start | [
"Create",
"the",
"path",
"from",
"start"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/chart/Star.java#L30-L48 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/chart/Star.java | Star.atLocation | Shape atLocation(float x, float y) {
start.setLocation(x, y); // Store new start
p.reset(); // Erase current path
createStar(); // create new path
return p; ... | java | Shape atLocation(float x, float y) {
start.setLocation(x, y); // Store new start
p.reset(); // Erase current path
createStar(); // create new path
return p; ... | [
"Shape",
"atLocation",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"start",
".",
"setLocation",
"(",
"x",
",",
"y",
")",
";",
"// Store new start",
"p",
".",
"reset",
"(",
")",
";",
"// Erase current path",
"createStar",
"(",
")",
";",
"// create new... | Modify the location of this star | [
"Modify",
"the",
"location",
"of",
"this",
"star"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/chart/Star.java#L51-L56 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.add | public static int[] add (int[] list, int startIdx, int value)
{
// make sure we've got a list to work with
if (list == null) {
list = new int[DEFAULT_LIST_SIZE];
}
// search for a spot to insert yon value; assuming we'll insert
// it at the end of the list if we ... | java | public static int[] add (int[] list, int startIdx, int value)
{
// make sure we've got a list to work with
if (list == null) {
list = new int[DEFAULT_LIST_SIZE];
}
// search for a spot to insert yon value; assuming we'll insert
// it at the end of the list if we ... | [
"public",
"static",
"int",
"[",
"]",
"add",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"startIdx",
",",
"int",
"value",
")",
"{",
"// make sure we've got a list to work with",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"int",
"[",
"D... | Adds the specified value to the next empty slot in the specified
list. Begins searching for empty slots at the specified index. This
can be used to quickly add values to a list that preserves
consecutivity by calling it with the size of the list as the first
index to check.
@param list the list to which to add the val... | [
"Adds",
"the",
"specified",
"value",
"to",
"the",
"next",
"empty",
"slot",
"in",
"the",
"specified",
"list",
".",
"Begins",
"searching",
"for",
"empty",
"slots",
"at",
"the",
"specified",
"index",
".",
"This",
"can",
"be",
"used",
"to",
"quickly",
"add",
... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L79-L106 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.remove | public static int remove (int[] list, int value)
{
// nothing to remove from an empty list
if (list == null) {
return 0;
}
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
int val = list[i];
if (val ... | java | public static int remove (int[] list, int value)
{
// nothing to remove from an empty list
if (list == null) {
return 0;
}
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
int val = list[i];
if (val ... | [
"public",
"static",
"int",
"remove",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"value",
")",
"{",
"// nothing to remove from an empty list",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"int",
"llength",
"=",
"list",
".",
"length",... | Removes the first value that is equal to the supplied value. The
values after the removed value will be slid down the array one spot
to fill the place of the removed value.
@return the value that was removed from the array or zero if no
matching object was found. | [
"Removes",
"the",
"first",
"value",
"that",
"is",
"equal",
"to",
"the",
"supplied",
"value",
".",
"The",
"values",
"after",
"the",
"removed",
"value",
"will",
"be",
"slid",
"down",
"the",
"array",
"one",
"spot",
"to",
"fill",
"the",
"place",
"of",
"the",... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L218-L235 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.removeAt | public static int removeAt (int[] list, int index)
{
int llength = list.length;
if (llength <= index) {
return 0;
}
int val = list[index];
System.arraycopy(list, index+1, list, index, llength-(index+1));
list[llength-1] = 0;
return val;
} | java | public static int removeAt (int[] list, int index)
{
int llength = list.length;
if (llength <= index) {
return 0;
}
int val = list[index];
System.arraycopy(list, index+1, list, index, llength-(index+1));
list[llength-1] = 0;
return val;
} | [
"public",
"static",
"int",
"removeAt",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"index",
")",
"{",
"int",
"llength",
"=",
"list",
".",
"length",
";",
"if",
"(",
"llength",
"<=",
"index",
")",
"{",
"return",
"0",
";",
"}",
"int",
"val",
"=",
"lis... | Removes the value at the specified index. The values after the
removed value will be slid down the array one spot to fill the
place of the removed value. If a null array is supplied or one that
is not large enough to accomodate this index, zero is returned.
@return the value that was removed from the array or zero if ... | [
"Removes",
"the",
"value",
"at",
"the",
"specified",
"index",
".",
"The",
"values",
"after",
"the",
"removed",
"value",
"will",
"be",
"slid",
"down",
"the",
"array",
"one",
"spot",
"to",
"fill",
"the",
"place",
"of",
"the",
"removed",
"value",
".",
"If",... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L246-L257 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.sum | public static int sum (int[] list)
{
int total = 0, lsize = list.length;
for (int ii = 0; ii < lsize; ii++) {
total += list[ii];
}
return total;
} | java | public static int sum (int[] list)
{
int total = 0, lsize = list.length;
for (int ii = 0; ii < lsize; ii++) {
total += list[ii];
}
return total;
} | [
"public",
"static",
"int",
"sum",
"(",
"int",
"[",
"]",
"list",
")",
"{",
"int",
"total",
"=",
"0",
",",
"lsize",
"=",
"list",
".",
"length",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"lsize",
";",
"ii",
"++",
")",
"{",
"total",... | Returns the total of all of the values in the list. | [
"Returns",
"the",
"total",
"of",
"all",
"of",
"the",
"values",
"in",
"the",
"list",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L288-L295 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.accomodate | protected static int[] accomodate (int[] list, int index)
{
int size = list.length;
// expand size by powers of two until we're big enough
while (size <= index) {
size = Math.max(size * 2, DEFAULT_LIST_SIZE);
}
// create a new list and copy the contents
i... | java | protected static int[] accomodate (int[] list, int index)
{
int size = list.length;
// expand size by powers of two until we're big enough
while (size <= index) {
size = Math.max(size * 2, DEFAULT_LIST_SIZE);
}
// create a new list and copy the contents
i... | [
"protected",
"static",
"int",
"[",
"]",
"accomodate",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"index",
")",
"{",
"int",
"size",
"=",
"list",
".",
"length",
";",
"// expand size by powers of two until we're big enough",
"while",
"(",
"size",
"<=",
"index",
... | Creates a new list that will accomodate the specified index and
copies the contents of the old list to the first. | [
"Creates",
"a",
"new",
"list",
"that",
"will",
"accomodate",
"the",
"specified",
"index",
"and",
"copies",
"the",
"contents",
"of",
"the",
"old",
"list",
"to",
"the",
"first",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L465-L477 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.box | public static Integer[] box (int[] list)
{
if (list == null) {
return null;
}
Integer[] boxed = new Integer[list.length];
for (int ii = 0; ii < list.length; ii++) {
boxed[ii] = list[ii];
}
return boxed;
} | java | public static Integer[] box (int[] list)
{
if (list == null) {
return null;
}
Integer[] boxed = new Integer[list.length];
for (int ii = 0; ii < list.length; ii++) {
boxed[ii] = list[ii];
}
return boxed;
} | [
"public",
"static",
"Integer",
"[",
"]",
"box",
"(",
"int",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Integer",
"[",
"]",
"boxed",
"=",
"new",
"Integer",
"[",
"list",
".",
"length",
"]",
... | Covnerts an array of primitives to an array of objects. | [
"Covnerts",
"an",
"array",
"of",
"primitives",
"to",
"an",
"array",
"of",
"objects",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L482-L492 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/IntListUtil.java | IntListUtil.asList | public static List<Integer> asList (int[] list)
{
if (list == null) {
return null;
}
List<Integer> ilist = new ArrayList<Integer>(list.length);
for (int ii = 0; ii < list.length; ii++) {
ilist.add(list[ii]);
}
return ilist;
} | java | public static List<Integer> asList (int[] list)
{
if (list == null) {
return null;
}
List<Integer> ilist = new ArrayList<Integer>(list.length);
for (int ii = 0; ii < list.length; ii++) {
ilist.add(list[ii]);
}
return ilist;
} | [
"public",
"static",
"List",
"<",
"Integer",
">",
"asList",
"(",
"int",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"Integer",
">",
"ilist",
"=",
"new",
"ArrayList",
"<",
"Integer",... | Converts an array of primitives to a list of Integers. | [
"Converts",
"an",
"array",
"of",
"primitives",
"to",
"a",
"list",
"of",
"Integers",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L497-L507 | train |
samskivert/samskivert | src/main/java/com/samskivert/net/AttachableURLFactory.java | AttachableURLFactory.attachHandler | public static void attachHandler (
String protocol, Class<? extends URLStreamHandler> handlerClass)
{
// set up the factory.
if (_handlers == null) {
_handlers = new HashMap<String,Class<? extends URLStreamHandler>>();
// There are two ways to do this.
/... | java | public static void attachHandler (
String protocol, Class<? extends URLStreamHandler> handlerClass)
{
// set up the factory.
if (_handlers == null) {
_handlers = new HashMap<String,Class<? extends URLStreamHandler>>();
// There are two ways to do this.
/... | [
"public",
"static",
"void",
"attachHandler",
"(",
"String",
"protocol",
",",
"Class",
"<",
"?",
"extends",
"URLStreamHandler",
">",
"handlerClass",
")",
"{",
"// set up the factory.",
"if",
"(",
"_handlers",
"==",
"null",
")",
"{",
"_handlers",
"=",
"new",
"Ha... | Register a URL handler.
@param protocol the protocol to register.
@param handlerClass a Class of type java.net.URLStreamHandler | [
"Register",
"a",
"URL",
"handler",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/net/AttachableURLFactory.java#L28-L63 | train |
samskivert/samskivert | src/main/java/com/samskivert/net/AttachableURLFactory.java | AttachableURLFactory.createURLStreamHandler | public URLStreamHandler createURLStreamHandler (String protocol)
{
Class<? extends URLStreamHandler> handler = _handlers.get(protocol.toLowerCase());
if (handler != null) {
try {
return handler.newInstance();
} catch (Exception e) {
log.warning... | java | public URLStreamHandler createURLStreamHandler (String protocol)
{
Class<? extends URLStreamHandler> handler = _handlers.get(protocol.toLowerCase());
if (handler != null) {
try {
return handler.newInstance();
} catch (Exception e) {
log.warning... | [
"public",
"URLStreamHandler",
"createURLStreamHandler",
"(",
"String",
"protocol",
")",
"{",
"Class",
"<",
"?",
"extends",
"URLStreamHandler",
">",
"handler",
"=",
"_handlers",
".",
"get",
"(",
"protocol",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"... | documentation inherited from interface URLStreamHandlerFactory | [
"documentation",
"inherited",
"from",
"interface",
"URLStreamHandlerFactory"
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/net/AttachableURLFactory.java#L73-L85 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ByteEnumUtil.java | ByteEnumUtil.fromByte | public static <E extends Enum<E> & ByteEnum> E fromByte (Class<E> eclass, byte code)
{
for (E value : eclass.getEnumConstants()) {
if (value.toByte() == code) {
return value;
}
}
throw new IllegalArgumentException(eclass + " has no value with code " + ... | java | public static <E extends Enum<E> & ByteEnum> E fromByte (Class<E> eclass, byte code)
{
for (E value : eclass.getEnumConstants()) {
if (value.toByte() == code) {
return value;
}
}
throw new IllegalArgumentException(eclass + " has no value with code " + ... | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
"&",
"ByteEnum",
">",
"E",
"fromByte",
"(",
"Class",
"<",
"E",
">",
"eclass",
",",
"byte",
"code",
")",
"{",
"for",
"(",
"E",
"value",
":",
"eclass",
".",
"getEnumConstants",
"(",
")",... | Returns the enum value with the specified code in the supplied enum class.
@exception IllegalArgumentException thrown if the enum lacks a value that maps to the
supplied code. | [
"Returns",
"the",
"enum",
"value",
"with",
"the",
"specified",
"code",
"in",
"the",
"supplied",
"enum",
"class",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ByteEnumUtil.java#L22-L30 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ByteEnumUtil.java | ByteEnumUtil.setToInt | public static <E extends Enum<E> & ByteEnum> int setToInt (Set<E> set)
{
int flags = 0;
for (E value : set) {
flags |= toIntFlag(value);
}
return flags;
} | java | public static <E extends Enum<E> & ByteEnum> int setToInt (Set<E> set)
{
int flags = 0;
for (E value : set) {
flags |= toIntFlag(value);
}
return flags;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
"&",
"ByteEnum",
">",
"int",
"setToInt",
"(",
"Set",
"<",
"E",
">",
"set",
")",
"{",
"int",
"flags",
"=",
"0",
";",
"for",
"(",
"E",
"value",
":",
"set",
")",
"{",
"flags",
"|=",
... | Convert a Set of ByteEnums into an integer compactly representing the elements that are
included. | [
"Convert",
"a",
"Set",
"of",
"ByteEnums",
"into",
"an",
"integer",
"compactly",
"representing",
"the",
"elements",
"that",
"are",
"included",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ByteEnumUtil.java#L36-L43 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ByteEnumUtil.java | ByteEnumUtil.intToSet | public static <E extends Enum<E> & ByteEnum> EnumSet<E> intToSet (Class<E> eclass, int flags)
{
EnumSet<E> set = EnumSet.noneOf(eclass);
for (E value : eclass.getEnumConstants()) {
if ((flags & toIntFlag(value)) != 0) {
set.add(value);
}
}
retu... | java | public static <E extends Enum<E> & ByteEnum> EnumSet<E> intToSet (Class<E> eclass, int flags)
{
EnumSet<E> set = EnumSet.noneOf(eclass);
for (E value : eclass.getEnumConstants()) {
if ((flags & toIntFlag(value)) != 0) {
set.add(value);
}
}
retu... | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
"&",
"ByteEnum",
">",
"EnumSet",
"<",
"E",
">",
"intToSet",
"(",
"Class",
"<",
"E",
">",
"eclass",
",",
"int",
"flags",
")",
"{",
"EnumSet",
"<",
"E",
">",
"set",
"=",
"EnumSet",
"."... | Convert an int representation of ByteEnum flags into an EnumSet. | [
"Convert",
"an",
"int",
"representation",
"of",
"ByteEnum",
"flags",
"into",
"an",
"EnumSet",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ByteEnumUtil.java#L48-L57 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/Logger.java | Logger.initLogger | protected static void initLogger ()
{
// if a custom class was specified as a system property, use that
Factory factory = createConfiguredFactory();
// create and a log4j logger if the log4j configuration system property is set
try {
if (factory == null && System.getProp... | java | protected static void initLogger ()
{
// if a custom class was specified as a system property, use that
Factory factory = createConfiguredFactory();
// create and a log4j logger if the log4j configuration system property is set
try {
if (factory == null && System.getProp... | [
"protected",
"static",
"void",
"initLogger",
"(",
")",
"{",
"// if a custom class was specified as a system property, use that",
"Factory",
"factory",
"=",
"createConfiguredFactory",
"(",
")",
";",
"// create and a log4j logger if the log4j configuration system property is set",
"try... | Called at static initialization time. Selects and initializes our logging backend. | [
"Called",
"at",
"static",
"initialization",
"time",
".",
"Selects",
"and",
"initializes",
"our",
"logging",
"backend",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Logger.java#L165-L199 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/GroupLayout.java | GroupLayout.getConstraints | protected Constraints getConstraints (Component child)
{
if (_constraints != null) {
Constraints c = _constraints.get(child);
if (c != null) {
return c;
}
}
return DEFAULT_CONSTRAINTS;
} | java | protected Constraints getConstraints (Component child)
{
if (_constraints != null) {
Constraints c = _constraints.get(child);
if (c != null) {
return c;
}
}
return DEFAULT_CONSTRAINTS;
} | [
"protected",
"Constraints",
"getConstraints",
"(",
"Component",
"child",
")",
"{",
"if",
"(",
"_constraints",
"!=",
"null",
")",
"{",
"Constraints",
"c",
"=",
"_constraints",
".",
"get",
"(",
"child",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"... | Get the Constraints for the specified child component.
@return a Constraints object, never null. | [
"Get",
"the",
"Constraints",
"for",
"the",
"specified",
"child",
"component",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/GroupLayout.java#L229-L239 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/GroupLayout.java | GroupLayout.computeDimens | protected DimenInfo computeDimens (Container parent, int type) {
int count = parent.getComponentCount();
DimenInfo info = new DimenInfo();
info.dimens = new Dimension[count];
for (int i = 0; i < count; i++) {
Component child = parent.getComponent(i);
if (!child.i... | java | protected DimenInfo computeDimens (Container parent, int type) {
int count = parent.getComponentCount();
DimenInfo info = new DimenInfo();
info.dimens = new Dimension[count];
for (int i = 0; i < count; i++) {
Component child = parent.getComponent(i);
if (!child.i... | [
"protected",
"DimenInfo",
"computeDimens",
"(",
"Container",
"parent",
",",
"int",
"type",
")",
"{",
"int",
"count",
"=",
"parent",
".",
"getComponentCount",
"(",
")",
";",
"DimenInfo",
"info",
"=",
"new",
"DimenInfo",
"(",
")",
";",
"info",
".",
"dimens",... | Computes dimensions of the children widgets that are useful for the
group layout managers. | [
"Computes",
"dimensions",
"of",
"the",
"children",
"widgets",
"that",
"are",
"useful",
"for",
"the",
"group",
"layout",
"managers",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/GroupLayout.java#L245-L303 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/LazyComponent.java | LazyComponent.checkCreate | protected void checkCreate ()
{
if (_creator != null && isShowing()) {
// ideally, we would replace ourselves in our parent, but that
// doesn't seem to work in JTabbedPane
setLayout(new BorderLayout());
add(_creator.createContent(), BorderLayout.CENTER);
... | java | protected void checkCreate ()
{
if (_creator != null && isShowing()) {
// ideally, we would replace ourselves in our parent, but that
// doesn't seem to work in JTabbedPane
setLayout(new BorderLayout());
add(_creator.createContent(), BorderLayout.CENTER);
... | [
"protected",
"void",
"checkCreate",
"(",
")",
"{",
"if",
"(",
"_creator",
"!=",
"null",
"&&",
"isShowing",
"(",
")",
")",
"{",
"// ideally, we would replace ourselves in our parent, but that",
"// doesn't seem to work in JTabbedPane",
"setLayout",
"(",
"new",
"BorderLayou... | Check to see if we should now create the content. | [
"Check",
"to",
"see",
"if",
"we",
"should",
"now",
"create",
"the",
"content",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/LazyComponent.java#L59-L68 | train |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/RetryableTask.java | RetryableTask.invokeTask | public void invokeTask (Component parent, String retryMessage)
throws Exception
{
while (true) {
try {
invoke();
return;
} catch (Exception e) {
Object[] options = new Object[] {
"Retry operation", "Abort op... | java | public void invokeTask (Component parent, String retryMessage)
throws Exception
{
while (true) {
try {
invoke();
return;
} catch (Exception e) {
Object[] options = new Object[] {
"Retry operation", "Abort op... | [
"public",
"void",
"invokeTask",
"(",
"Component",
"parent",
",",
"String",
"retryMessage",
")",
"throws",
"Exception",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"invoke",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{... | Invokes the supplied task and catches any thrown exceptions. In the
event of an exception, the provided message is displayed to the
user and the are allowed to retry the task or allow it to fail. | [
"Invokes",
"the",
"supplied",
"task",
"and",
"catches",
"any",
"thrown",
"exceptions",
".",
"In",
"the",
"event",
"of",
"an",
"exception",
"the",
"provided",
"message",
"is",
"displayed",
"to",
"the",
"user",
"and",
"the",
"are",
"allowed",
"to",
"retry",
... | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/RetryableTask.java#L33-L53 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/SystemInfo.java | SystemInfo.update | public void update ()
{
// grab the various system properties
osName = System.getProperty("os.name");
osVersion = System.getProperty("os.version");
osArch = System.getProperty("os.arch");
javaVersion = System.getProperty("java.version");
javaVendor = System.getPropert... | java | public void update ()
{
// grab the various system properties
osName = System.getProperty("os.name");
osVersion = System.getProperty("os.version");
osArch = System.getProperty("os.arch");
javaVersion = System.getProperty("java.version");
javaVendor = System.getPropert... | [
"public",
"void",
"update",
"(",
")",
"{",
"// grab the various system properties",
"osName",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"osVersion",
"=",
"System",
".",
"getProperty",
"(",
"\"os.version\"",
")",
";",
"osArch",
"=",
"System... | Updates the system info record's statistics to reflect the current
state of the JVM. | [
"Updates",
"the",
"system",
"info",
"record",
"s",
"statistics",
"to",
"reflect",
"the",
"current",
"state",
"of",
"the",
"JVM",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/SystemInfo.java#L79-L113 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/DependencyGraph.java | DependencyGraph.add | public void add (T element)
{
DependencyNode<T> node = new DependencyNode<T>(element);
_nodes.put(element, node);
_orphans.add(element);
} | java | public void add (T element)
{
DependencyNode<T> node = new DependencyNode<T>(element);
_nodes.put(element, node);
_orphans.add(element);
} | [
"public",
"void",
"add",
"(",
"T",
"element",
")",
"{",
"DependencyNode",
"<",
"T",
">",
"node",
"=",
"new",
"DependencyNode",
"<",
"T",
">",
"(",
"element",
")",
";",
"_nodes",
".",
"put",
"(",
"element",
",",
"node",
")",
";",
"_orphans",
".",
"a... | Adds an element with no initial dependencies from the graph. | [
"Adds",
"an",
"element",
"with",
"no",
"initial",
"dependencies",
"from",
"the",
"graph",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DependencyGraph.java#L26-L31 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/DependencyGraph.java | DependencyGraph.remove | public void remove (T element)
{
DependencyNode<T> node = _nodes.remove(element);
_orphans.remove(element);
// Remove ourselves as a child of our parents.
for (DependencyNode<T> parent : node.parents) {
parent.children.remove(node);
}
// Remove ourselves... | java | public void remove (T element)
{
DependencyNode<T> node = _nodes.remove(element);
_orphans.remove(element);
// Remove ourselves as a child of our parents.
for (DependencyNode<T> parent : node.parents) {
parent.children.remove(node);
}
// Remove ourselves... | [
"public",
"void",
"remove",
"(",
"T",
"element",
")",
"{",
"DependencyNode",
"<",
"T",
">",
"node",
"=",
"_nodes",
".",
"remove",
"(",
"element",
")",
";",
"_orphans",
".",
"remove",
"(",
"element",
")",
";",
"// Remove ourselves as a child of our parents.",
... | Removes an element and its dependencies from the graph. | [
"Removes",
"an",
"element",
"and",
"its",
"dependencies",
"from",
"the",
"graph",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DependencyGraph.java#L36-L53 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/DependencyGraph.java | DependencyGraph.addDependency | public void addDependency (T dependant, T dependee)
{
_orphans.remove(dependant);
DependencyNode<T> dependantNode = _nodes.get(dependant);
if (dependantNode == null) {
throw new IllegalArgumentException("Unknown dependant? " + dependant);
}
DependencyNode<T> depen... | java | public void addDependency (T dependant, T dependee)
{
_orphans.remove(dependant);
DependencyNode<T> dependantNode = _nodes.get(dependant);
if (dependantNode == null) {
throw new IllegalArgumentException("Unknown dependant? " + dependant);
}
DependencyNode<T> depen... | [
"public",
"void",
"addDependency",
"(",
"T",
"dependant",
",",
"T",
"dependee",
")",
"{",
"_orphans",
".",
"remove",
"(",
"dependant",
")",
";",
"DependencyNode",
"<",
"T",
">",
"dependantNode",
"=",
"_nodes",
".",
"get",
"(",
"dependant",
")",
";",
"if"... | Records a new dependency of the dependant upon the dependee. | [
"Records",
"a",
"new",
"dependency",
"of",
"the",
"dependant",
"upon",
"the",
"dependee",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DependencyGraph.java#L85-L101 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/DependencyGraph.java | DependencyGraph.dependsOn | public boolean dependsOn (T elem1, T elem2)
{
DependencyNode<T> node1 = _nodes.get(elem1);
DependencyNode<T> node2 = _nodes.get(elem2);
List<DependencyNode<T>> nodesToCheck = new ArrayList<DependencyNode<T>>();
List<DependencyNode<T>> nodesAlreadyChecked = new ArrayList<DependencyNo... | java | public boolean dependsOn (T elem1, T elem2)
{
DependencyNode<T> node1 = _nodes.get(elem1);
DependencyNode<T> node2 = _nodes.get(elem2);
List<DependencyNode<T>> nodesToCheck = new ArrayList<DependencyNode<T>>();
List<DependencyNode<T>> nodesAlreadyChecked = new ArrayList<DependencyNo... | [
"public",
"boolean",
"dependsOn",
"(",
"T",
"elem1",
",",
"T",
"elem2",
")",
"{",
"DependencyNode",
"<",
"T",
">",
"node1",
"=",
"_nodes",
".",
"get",
"(",
"elem1",
")",
";",
"DependencyNode",
"<",
"T",
">",
"node2",
"=",
"_nodes",
".",
"get",
"(",
... | Returns whether elem1 is designated to depend on elem2. | [
"Returns",
"whether",
"elem1",
"is",
"designated",
"to",
"depend",
"on",
"elem2",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DependencyGraph.java#L106-L136 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/DependencyGraph.java | DependencyGraph.toObserverList | public ObserverList<T> toObserverList ()
{
ObserverList<T> list = ObserverList.newSafeInOrder();
while (!isEmpty()) {
list.add(removeAvailableElement());
}
return list;
} | java | public ObserverList<T> toObserverList ()
{
ObserverList<T> list = ObserverList.newSafeInOrder();
while (!isEmpty()) {
list.add(removeAvailableElement());
}
return list;
} | [
"public",
"ObserverList",
"<",
"T",
">",
"toObserverList",
"(",
")",
"{",
"ObserverList",
"<",
"T",
">",
"list",
"=",
"ObserverList",
".",
"newSafeInOrder",
"(",
")",
";",
"while",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"list",
".",
"add",
"(",
"re... | Flattens this graph into an observer list in dependencys order. Empties the graph in the
process. | [
"Flattens",
"this",
"graph",
"into",
"an",
"observer",
"list",
"in",
"dependencys",
"order",
".",
"Empties",
"the",
"graph",
"in",
"the",
"process",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DependencyGraph.java#L142-L149 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/PrefsConfig.java | PrefsConfig.remove | public void remove (String name)
{
// we treat the old value as a String, I hope that's ok!
String oldValue = getValue(name, (String) null);
_prefs.remove(name);
_propsup.firePropertyChange(name, oldValue, null);
} | java | public void remove (String name)
{
// we treat the old value as a String, I hope that's ok!
String oldValue = getValue(name, (String) null);
_prefs.remove(name);
_propsup.firePropertyChange(name, oldValue, null);
} | [
"public",
"void",
"remove",
"(",
"String",
"name",
")",
"{",
"// we treat the old value as a String, I hope that's ok!",
"String",
"oldValue",
"=",
"getValue",
"(",
"name",
",",
"(",
"String",
")",
"null",
")",
";",
"_prefs",
".",
"remove",
"(",
"name",
")",
"... | Remove any set value for the specified preference. | [
"Remove",
"any",
"set",
"value",
"for",
"the",
"specified",
"preference",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L183-L189 | train |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/HTMLUtil.java | HTMLUtil.restrictHTML | public static String restrictHTML (String src, boolean allowFormatting,
boolean allowImages, boolean allowLinks)
{
// TODO: these regexes should probably be checked to make
// sure that javascript can't live inside a link
ArrayList<String> allow = new ArrayList<String>();
if ... | java | public static String restrictHTML (String src, boolean allowFormatting,
boolean allowImages, boolean allowLinks)
{
// TODO: these regexes should probably be checked to make
// sure that javascript can't live inside a link
ArrayList<String> allow = new ArrayList<String>();
if ... | [
"public",
"static",
"String",
"restrictHTML",
"(",
"String",
"src",
",",
"boolean",
"allowFormatting",
",",
"boolean",
"allowImages",
",",
"boolean",
"allowLinks",
")",
"{",
"// TODO: these regexes should probably be checked to make",
"// sure that javascript can't live inside ... | Restrict HTML except for the specified tags.
@param allowFormatting enables <i>, <b>, <u>,
<font>, <br>, <p>, and
<hr>.
@param allowImages enabled <img ...>.
@param allowLinks enabled <a href ...>. | [
"Restrict",
"HTML",
"except",
"for",
"the",
"specified",
"tags",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/HTMLUtil.java#L160-L186 | train |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/HTMLUtil.java | HTMLUtil.restrictHTML | public static String restrictHTML (String src, String[] regexes)
{
if (StringUtil.isBlank(src)) {
return src;
}
ArrayList<String> list = new ArrayList<String>();
list.add(src);
for (String regexe : regexes) {
Pattern p = Pattern.compile(regexe, Patter... | java | public static String restrictHTML (String src, String[] regexes)
{
if (StringUtil.isBlank(src)) {
return src;
}
ArrayList<String> list = new ArrayList<String>();
list.add(src);
for (String regexe : regexes) {
Pattern p = Pattern.compile(regexe, Patter... | [
"public",
"static",
"String",
"restrictHTML",
"(",
"String",
"src",
",",
"String",
"[",
"]",
"regexes",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isBlank",
"(",
"src",
")",
")",
"{",
"return",
"src",
";",
"}",
"ArrayList",
"<",
"String",
">",
"list",
... | Restrict HTML from the specified string except for the specified
regular expressions. | [
"Restrict",
"HTML",
"from",
"the",
"specified",
"string",
"except",
"for",
"the",
"specified",
"regular",
"expressions",
"."
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/HTMLUtil.java#L192-L225 | train |
samskivert/samskivert | src/main/java/com/samskivert/util/ComplainingListener.java | ComplainingListener.requestFailed | public void requestFailed (Exception cause)
{
Object[] args = _args != null ? ArrayUtil.append(_args, cause) : new Object[] { cause };
if (_slogger != null) {
_slogger.warning(_errorText, args);
} else if (_jlogger != null) {
_jlogger.log(Level.WARNING, Logger.format(... | java | public void requestFailed (Exception cause)
{
Object[] args = _args != null ? ArrayUtil.append(_args, cause) : new Object[] { cause };
if (_slogger != null) {
_slogger.warning(_errorText, args);
} else if (_jlogger != null) {
_jlogger.log(Level.WARNING, Logger.format(... | [
"public",
"void",
"requestFailed",
"(",
"Exception",
"cause",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"_args",
"!=",
"null",
"?",
"ArrayUtil",
".",
"append",
"(",
"_args",
",",
"cause",
")",
":",
"new",
"Object",
"[",
"]",
"{",
"cause",
"}",
";",
... | from interface ResultListener | [
"from",
"interface",
"ResultListener"
] | a64d9ef42b69819bdb2c66bddac6a64caef928b6 | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ComplainingListener.java#L44-L54 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.compare | public static int compare(Date d1, Date d2) {
Calendar c1 = Calendar.getInstance();
c1.setTime(d1);
Calendar c2 = Calendar.getInstance();
c2.setTime(d2);
if (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
if (c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH)) {
... | java | public static int compare(Date d1, Date d2) {
Calendar c1 = Calendar.getInstance();
c1.setTime(d1);
Calendar c2 = Calendar.getInstance();
c2.setTime(d2);
if (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
if (c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH)) {
... | [
"public",
"static",
"int",
"compare",
"(",
"Date",
"d1",
",",
"Date",
"d2",
")",
"{",
"Calendar",
"c1",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c1",
".",
"setTime",
"(",
"d1",
")",
";",
"Calendar",
"c2",
"=",
"Calendar",
".",
"getInstanc... | Compares two dates taking into consideration only the year, month and day
@param d1 the first date
@param d2 the second date
@return a negative integer, zero, or a positive integer as
<code>d1</code> is less than, equal to, or greater than <code>d2</code>
@see java.util.Comparator
@see #after(Date, Date)
@see #before(D... | [
"Compares",
"two",
"dates",
"taking",
"into",
"consideration",
"only",
"the",
"year",
"month",
"and",
"day"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L93-L106 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getYear | public static int getYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.YEAR);
} | java | public static int getYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.YEAR);
} | [
"public",
"static",
"int",
"getYear",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",... | Get the year of the date
@param date date
@return year of the date | [
"Get",
"the",
"year",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L113-L117 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getMonth | public static int getMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.MONTH);
} | java | public static int getMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.MONTH);
} | [
"public",
"static",
"int",
"getMonth",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
";... | Get the month of the date
@param date date
@return month of the date | [
"Get",
"the",
"month",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L124-L128 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getDayOfYear | public static int getDayOfYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_YEAR);
} | java | public static int getDayOfYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_YEAR);
} | [
"public",
"static",
"int",
"getDayOfYear",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_YEAR",
... | Get the day of year of the date
@param date date
@return day of year of the date | [
"Get",
"the",
"day",
"of",
"year",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L135-L139 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getDayOfMonth | public static int getDayOfMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_MONTH);
} | java | public static int getDayOfMonth(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_MONTH);
} | [
"public",
"static",
"int",
"getDayOfMonth",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",... | Get the day of month of the date
@param date date
@return day of month of the date | [
"Get",
"the",
"day",
"of",
"month",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L146-L150 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getDayOfWeek | public static int getDayOfWeek(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_WEEK);
} | java | public static int getDayOfWeek(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_WEEK);
} | [
"public",
"static",
"int",
"getDayOfWeek",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_WEEK",
... | Get the day of week of the date
@param date date
@return day of week of the date | [
"Get",
"the",
"day",
"of",
"week",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L157-L161 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getHour | public static int getHour(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.HOUR_OF_DAY);
} | java | public static int getHour(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.HOUR_OF_DAY);
} | [
"public",
"static",
"int",
"getHour",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",... | Get the hour of the date
@param date date
@return hour of the date | [
"Get",
"the",
"hour",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L168-L172 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getMinute | public static int getMinute(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.MINUTE);
} | java | public static int getMinute(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.MINUTE);
} | [
"public",
"static",
"int",
"getMinute",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
... | Get the minute of the date
@param date date
@return minute of the date | [
"Get",
"the",
"minute",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L179-L183 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getSecond | public static int getSecond(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.SECOND);
} | java | public static int getSecond(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.SECOND);
} | [
"public",
"static",
"int",
"getSecond",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"c",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
... | Get the second of the date
@param date date
@return second of the date | [
"Get",
"the",
"second",
"of",
"the",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L190-L194 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.floor | public static Date floor(Date d) {
Calendar c = Calendar.getInstance();
c.setTime(d);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
} | java | public static Date floor(Date d) {
Calendar c = Calendar.getInstance();
c.setTime(d);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
} | [
"public",
"static",
"Date",
"floor",
"(",
"Date",
"d",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"d",
")",
";",
"c",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";... | Rounds a date to hour 0, minute 0, second 0 and millisecond 0
@param d the date
@return the rounded date | [
"Rounds",
"a",
"date",
"to",
"hour",
"0",
"minute",
"0",
"second",
"0",
"and",
"millisecond",
"0"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L201-L209 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.sameDay | public static boolean sameDay(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DAY_OF_YEAR);
... | java | public static boolean sameDay(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DAY_OF_YEAR);
... | [
"public",
"static",
"boolean",
"sameDay",
"(",
"Date",
"dateOne",
",",
"Date",
"dateTwo",
")",
"{",
"if",
"(",
"(",
"dateOne",
"==",
"null",
")",
"||",
"(",
"dateTwo",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"Calendar",
"cal",
"=",
... | Test to see if two dates are in the same day of year
@param dateOne first date
@param dateTwo second date
@return true if the two dates are in the same day of year | [
"Test",
"to",
"see",
"if",
"two",
"dates",
"are",
"in",
"the",
"same",
"day",
"of",
"year"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L232-L247 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.sameWeek | public static boolean sameWeek(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int week = cal.get(Calendar.WEEK_OF_YEAR... | java | public static boolean sameWeek(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int week = cal.get(Calendar.WEEK_OF_YEAR... | [
"public",
"static",
"boolean",
"sameWeek",
"(",
"Date",
"dateOne",
",",
"Date",
"dateTwo",
")",
"{",
"if",
"(",
"(",
"dateOne",
"==",
"null",
")",
"||",
"(",
"dateTwo",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"Calendar",
"cal",
"=",... | Test to see if two dates are in the same week
@param dateOne first date
@param dateTwo second date
@return true if the two dates are in the same week | [
"Test",
"to",
"see",
"if",
"two",
"dates",
"are",
"in",
"the",
"same",
"week"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L255-L270 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.sameMonth | public static boolean sameMonth(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
... | java | public static boolean sameMonth(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
... | [
"public",
"static",
"boolean",
"sameMonth",
"(",
"Date",
"dateOne",
",",
"Date",
"dateTwo",
")",
"{",
"if",
"(",
"(",
"dateOne",
"==",
"null",
")",
"||",
"(",
"dateTwo",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"Calendar",
"cal",
"="... | Test to see if two dates are in the same month
@param dateOne first date
@param dateTwo second date
@return true if the two dates are in the same month | [
"Test",
"to",
"see",
"if",
"two",
"dates",
"are",
"in",
"the",
"same",
"month"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L278-L293 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.sameHour | public static boolean sameHour(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
... | java | public static boolean sameHour(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
... | [
"public",
"static",
"boolean",
"sameHour",
"(",
"Date",
"dateOne",
",",
"Date",
"dateTwo",
")",
"{",
"if",
"(",
"(",
"dateOne",
"==",
"null",
")",
"||",
"(",
"dateTwo",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"Calendar",
"cal",
"=",... | Test to see if two dates are in the same hour of day
@param dateOne first date
@param dateTwo second date
@return true if the two dates are in the same hour of day | [
"Test",
"to",
"see",
"if",
"two",
"dates",
"are",
"in",
"the",
"same",
"hour",
"of",
"day"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L301-L321 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getNumberOfDays | public static int getNumberOfDays(Date first, Date second)
{
Calendar c = Calendar.getInstance();
int result = 0;
int compare = first.compareTo(second);
if (compare > 0) return 0;
if (compare == 0) return 1;
c.setTime(first);
int firstDay = c.... | java | public static int getNumberOfDays(Date first, Date second)
{
Calendar c = Calendar.getInstance();
int result = 0;
int compare = first.compareTo(second);
if (compare > 0) return 0;
if (compare == 0) return 1;
c.setTime(first);
int firstDay = c.... | [
"public",
"static",
"int",
"getNumberOfDays",
"(",
"Date",
"first",
",",
"Date",
"second",
")",
"{",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"int",
"result",
"=",
"0",
";",
"int",
"compare",
"=",
"first",
".",
"compareTo",
... | Get number of days between two dates
@param first first date
@param second second date
@return number of days if first date less than second date,
0 if first date is bigger than second date,
1 if dates are the same | [
"Get",
"number",
"of",
"days",
"between",
"two",
"dates"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L332-L373 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.getElapsedTime | public static int[] getElapsedTime(Date first, Date second) {
if (first.compareTo(second) == 1 ) {
return null;
}
int difDays = 0;
int difHours = 0;
int difMinutes = 0;
Calendar c = Calendar.getInstance();
c.setTime(first);
int h1 = c.... | java | public static int[] getElapsedTime(Date first, Date second) {
if (first.compareTo(second) == 1 ) {
return null;
}
int difDays = 0;
int difHours = 0;
int difMinutes = 0;
Calendar c = Calendar.getInstance();
c.setTime(first);
int h1 = c.... | [
"public",
"static",
"int",
"[",
"]",
"getElapsedTime",
"(",
"Date",
"first",
",",
"Date",
"second",
")",
"{",
"if",
"(",
"first",
".",
"compareTo",
"(",
"second",
")",
"==",
"1",
")",
"{",
"return",
"null",
";",
"}",
"int",
"difDays",
"=",
"0",
";"... | Get elapsedtime between two dates
@param first first date
@param second second date
@return null if first date is after second date
an integer array of three elemets ( days, hours minutes ) | [
"Get",
"elapsedtime",
"between",
"two",
"dates"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L382-L423 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.addMinutes | public static Date addMinutes(Date d, int minutes) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.add(Calendar.MINUTE, minutes);
return cal.getTime();
} | java | public static Date addMinutes(Date d, int minutes) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.add(Calendar.MINUTE, minutes);
return cal.getTime();
} | [
"public",
"static",
"Date",
"addMinutes",
"(",
"Date",
"d",
",",
"int",
"minutes",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"d",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
... | Add minutes to a date
@param d date
@param minutes minutes
@return new date | [
"Add",
"minutes",
"to",
"a",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L431-L436 | train |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.setMinutes | public static Date setMinutes(Date d, int minutes) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.set(Calendar.MINUTE, minutes);
return cal.getTime();
} | java | public static Date setMinutes(Date d, int minutes) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.set(Calendar.MINUTE, minutes);
return cal.getTime();
} | [
"public",
"static",
"Date",
"setMinutes",
"(",
"Date",
"d",
",",
"int",
"minutes",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"d",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
... | Set minutes to a date
@param d date
@param minutes minutes
@return new date | [
"Set",
"minutes",
"to",
"a",
"date"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L444-L449 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.