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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.sort | public Stream<T> sort(final Comparator<T> comparator) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
final ArrayList<T> array = ToArrayList.<T>toArrayList().call(Stream.this);
Collections.sort(array, comparator);
retur... | java | public Stream<T> sort(final Comparator<T> comparator) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
final ArrayList<T> array = ToArrayList.<T>toArrayList().call(Stream.this);
Collections.sort(array, comparator);
retur... | [
"public",
"Stream",
"<",
"T",
">",
"sort",
"(",
"final",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
... | Returns a new stream that contains all items of the current stream in sorted order.
The operator creates a list of all items internally.
@param comparator a comparator to apply.
@return a new stream that contains all items of the current stream in sorted order. | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"all",
"items",
"of",
"the",
"current",
"stream",
"in",
"sorted",
"order",
".",
"The",
"operator",
"creates",
"a",
"list",
"of",
"all",
"items",
"internally",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L502-L511 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.reverse | public Stream<T> reverse() {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
final ArrayList<T> array = ToArrayList.<T>toArrayList().call(Stream.this);
Collections.reverse(array);
return array.iterator();
}
... | java | public Stream<T> reverse() {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
final ArrayList<T> array = ToArrayList.<T>toArrayList().call(Stream.this);
Collections.reverse(array);
return array.iterator();
}
... | [
"public",
"Stream",
"<",
"T",
">",
"reverse",
"(",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"T",
">",
"array",
"... | Returns a new stream that contains all items of the current stream in reverse order.
The operator creates a list of all items internally.
@return a new stream that emits all items of the current stream in reverse order. | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"all",
"items",
"of",
"the",
"current",
"stream",
"in",
"reverse",
"order",
".",
"The",
"operator",
"creates",
"a",
"list",
"of",
"all",
"items",
"internally",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L519-L528 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.cast | public <R> Stream<R> cast(final Class<R> c) {
return map(new Func1<T, R>() {
@Override
public R call(T obj) {return c.cast(obj);}
});
} | java | public <R> Stream<R> cast(final Class<R> c) {
return map(new Func1<T, R>() {
@Override
public R call(T obj) {return c.cast(obj);}
});
} | [
"public",
"<",
"R",
">",
"Stream",
"<",
"R",
">",
"cast",
"(",
"final",
"Class",
"<",
"R",
">",
"c",
")",
"{",
"return",
"map",
"(",
"new",
"Func1",
"<",
"T",
",",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"R",
"call",
"(",
"T",
"... | Returns a stream that contains all values of the original stream that has been casted to a given class type.
@param c a class to cast into
@param <R> a type of the class
@return a stream that contains all values of the original stream that has been casted to a given class type. | [
"Returns",
"a",
"stream",
"that",
"contains",
"all",
"values",
"of",
"the",
"original",
"stream",
"that",
"has",
"been",
"casted",
"to",
"a",
"given",
"class",
"type",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L537-L542 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.every | public boolean every(Func1<? super T, Boolean> predicate) {
for (T item : this) {
if (!predicate.call(item))
return false;
}
return true;
} | java | public boolean every(Func1<? super T, Boolean> predicate) {
for (T item : this) {
if (!predicate.call(item))
return false;
}
return true;
} | [
"public",
"boolean",
"every",
"(",
"Func1",
"<",
"?",
"super",
"T",
",",
"Boolean",
">",
"predicate",
")",
"{",
"for",
"(",
"T",
"item",
":",
"this",
")",
"{",
"if",
"(",
"!",
"predicate",
".",
"call",
"(",
"item",
")",
")",
"return",
"false",
";... | Returns true if all of stream items satisfy a given condition.
@param predicate a condition to test.
@return true if all of stream items satisfy a given condition. | [
"Returns",
"true",
"if",
"all",
"of",
"stream",
"items",
"satisfy",
"a",
"given",
"condition",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L550-L556 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.onNext | public Stream<T> onNext(final Action1<? super T> action) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
@Override
... | java | public Stream<T> onNext(final Action1<? super T> action) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
@Override
... | [
"public",
"Stream",
"<",
"T",
">",
"onNext",
"(",
"final",
"Action1",
"<",
"?",
"super",
"T",
">",
"action",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
... | Executes an action for each item in the stream.
@param action an action to execute for each item in the stream. | [
"Executes",
"an",
"action",
"for",
"each",
"item",
"in",
"the",
"stream",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L657-L679 | train |
sw926/ImageFileSelector | library/src/main/java/com/sw926/imagefileselector/AppLogger.java | AppLogger.i | public static void i(String msg, Throwable thr) {
if (DEBUG)
Log.i(TAG, buildMessage(msg), thr);
} | java | public static void i(String msg, Throwable thr) {
if (DEBUG)
Log.i(TAG, buildMessage(msg), thr);
} | [
"public",
"static",
"void",
"i",
"(",
"String",
"msg",
",",
"Throwable",
"thr",
")",
"{",
"if",
"(",
"DEBUG",
")",
"Log",
".",
"i",
"(",
"TAG",
",",
"buildMessage",
"(",
"msg",
")",
",",
"thr",
")",
";",
"}"
] | Send a INFO log message and log the exception.
@param msg The message you would like logged.
@param thr An exception to log | [
"Send",
"a",
"INFO",
"log",
"message",
"and",
"log",
"the",
"exception",
"."
] | 65ca79c37d4f67286f9a51942f426691182e833d | https://github.com/sw926/ImageFileSelector/blob/65ca79c37d4f67286f9a51942f426691182e833d/library/src/main/java/com/sw926/imagefileselector/AppLogger.java#L95-L98 | train |
sw926/ImageFileSelector | library/src/main/java/com/sw926/imagefileselector/Compatibility.java | Compatibility.getDataColumn | public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor ... | java | public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor ... | [
"public",
"static",
"String",
"getDataColumn",
"(",
"Context",
"context",
",",
"Uri",
"uri",
",",
"String",
"selection",
",",
"String",
"[",
"]",
"selectionArgs",
")",
"{",
"Cursor",
"cursor",
"=",
"null",
";",
"final",
"String",
"column",
"=",
"\"_data\"",
... | Get the value of the data column for this Uri. This is useful for
MediaStore Uris, and other file-based ContentProviders.
@param context The context.
@param uri The Uri to query.
@param selection (Optional) Filter used in the query.
@param selectionArgs (Optional) Selection arguments used in the qu... | [
"Get",
"the",
"value",
"of",
"the",
"data",
"column",
"for",
"this",
"Uri",
".",
"This",
"is",
"useful",
"for",
"MediaStore",
"Uris",
"and",
"other",
"file",
"-",
"based",
"ContentProviders",
"."
] | 65ca79c37d4f67286f9a51942f426691182e833d | https://github.com/sw926/ImageFileSelector/blob/65ca79c37d4f67286f9a51942f426691182e833d/library/src/main/java/com/sw926/imagefileselector/Compatibility.java#L107-L128 | train |
EXIficient/exificient | src/main/java/com/siemens/ct/exi/main/api/stream/StAXDecoder.java | StAXDecoder.decodeEvent | protected EventType decodeEvent(EventType nextEventType)
throws EXIException, IOException {
endElementPrefix = null;
switch (nextEventType) {
/* DOCUMENT */
case START_DOCUMENT:
decoder.decodeStartDocument();
break;
case END_DOCUMENT:
decoder.decodeEndDocument();
break;
/* ATTR... | java | protected EventType decodeEvent(EventType nextEventType)
throws EXIException, IOException {
endElementPrefix = null;
switch (nextEventType) {
/* DOCUMENT */
case START_DOCUMENT:
decoder.decodeStartDocument();
break;
case END_DOCUMENT:
decoder.decodeEndDocument();
break;
/* ATTR... | [
"protected",
"EventType",
"decodeEvent",
"(",
"EventType",
"nextEventType",
")",
"throws",
"EXIException",
",",
"IOException",
"{",
"endElementPrefix",
"=",
"null",
";",
"switch",
"(",
"nextEventType",
")",
"{",
"/* DOCUMENT */",
"case",
"START_DOCUMENT",
":",
"deco... | without further attribute handling | [
"without",
"further",
"attribute",
"handling"
] | 93c7c0d63d74cfccf6ab1d5041b203745ef9ddb8 | https://github.com/EXIficient/exificient/blob/93c7c0d63d74cfccf6ab1d5041b203745ef9ddb8/src/main/java/com/siemens/ct/exi/main/api/stream/StAXDecoder.java#L239-L328 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.beginOrJoinTransaction | public static boolean beginOrJoinTransaction()
{
boolean newTransaction = false;
try {
newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
if (newTransaction) {
userTransaction.begin();
}
}
catch (Exception e) {
throw n... | java | public static boolean beginOrJoinTransaction()
{
boolean newTransaction = false;
try {
newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
if (newTransaction) {
userTransaction.begin();
}
}
catch (Exception e) {
throw n... | [
"public",
"static",
"boolean",
"beginOrJoinTransaction",
"(",
")",
"{",
"boolean",
"newTransaction",
"=",
"false",
";",
"try",
"{",
"newTransaction",
"=",
"userTransaction",
".",
"getStatus",
"(",
")",
"==",
"Status",
".",
"STATUS_NO_TRANSACTION",
";",
"if",
"("... | Start or join a transaction.
@return true if a new transaction was started (this means the caller "owns"
the commit()), false if a transaction was joined. | [
"Start",
"or",
"join",
"a",
"transaction",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L69-L83 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.commit | public static void commit()
{
try {
if (!isDone()) {
userTransaction.commit();
}
else {
LOGGER.warn("commit() called with no current transaction.");
}
}
catch (Exception e) {
throw new RuntimeException("Transaction commit failed."... | java | public static void commit()
{
try {
if (!isDone()) {
userTransaction.commit();
}
else {
LOGGER.warn("commit() called with no current transaction.");
}
}
catch (Exception e) {
throw new RuntimeException("Transaction commit failed."... | [
"public",
"static",
"void",
"commit",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isDone",
"(",
")",
")",
"{",
"userTransaction",
".",
"commit",
"(",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"warn",
"(",
"\"commit() called with no current transaction.\""... | Commit the current transaction. | [
"Commit",
"the",
"current",
"transaction",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L88-L101 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.rollback | public static void rollback()
{
try {
if (userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION) {
userTransaction.rollback();
}
else {
LOGGER.warn("Request to rollback transaction when none was in started.");
}
}
catch (Exception e)... | java | public static void rollback()
{
try {
if (userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION) {
userTransaction.rollback();
}
else {
LOGGER.warn("Request to rollback transaction when none was in started.");
}
}
catch (Exception e)... | [
"public",
"static",
"void",
"rollback",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"userTransaction",
".",
"getStatus",
"(",
")",
"!=",
"Status",
".",
"STATUS_NO_TRANSACTION",
")",
"{",
"userTransaction",
".",
"rollback",
"(",
")",
";",
"}",
"else",
"{",
"LOG... | Rollback the current transaction. | [
"Rollback",
"the",
"current",
"transaction",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L106-L119 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.suspend | public static Transaction suspend()
{
try {
Transaction suspend = transactionManager.suspend();
return suspend;
}
catch (SystemException e) {
throw new RuntimeException("Unable to suspend current transaction", e);
}
} | java | public static Transaction suspend()
{
try {
Transaction suspend = transactionManager.suspend();
return suspend;
}
catch (SystemException e) {
throw new RuntimeException("Unable to suspend current transaction", e);
}
} | [
"public",
"static",
"Transaction",
"suspend",
"(",
")",
"{",
"try",
"{",
"Transaction",
"suspend",
"=",
"transactionManager",
".",
"suspend",
"(",
")",
";",
"return",
"suspend",
";",
"}",
"catch",
"(",
"SystemException",
"e",
")",
"{",
"throw",
"new",
"Run... | Suspend the current transaction and return it to the caller.
@return the suspended Transaction | [
"Suspend",
"the",
"current",
"transaction",
"and",
"return",
"it",
"to",
"the",
"caller",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L126-L135 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java | TransactionElf.resume | public static void resume(Transaction transaction)
{
try {
transactionManager.resume(transaction);
}
catch (Exception e) {
throw new RuntimeException("Unable to resume transaction", e);
}
} | java | public static void resume(Transaction transaction)
{
try {
transactionManager.resume(transaction);
}
catch (Exception e) {
throw new RuntimeException("Unable to resume transaction", e);
}
} | [
"public",
"static",
"void",
"resume",
"(",
"Transaction",
"transaction",
")",
"{",
"try",
"{",
"transactionManager",
".",
"resume",
"(",
"transaction",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unabl... | Resume the specified transaction. If the transaction was never suspended, or was
already committed or rolled back, a RuntimeException will be thrown wrapping the
JTA originated exception.
@param transaction the Transaction to resume | [
"Resume",
"the",
"specified",
"transaction",
".",
"If",
"the",
"transaction",
"was",
"never",
"suspended",
"or",
"was",
"already",
"committed",
"or",
"rolled",
"back",
"a",
"RuntimeException",
"will",
"be",
"thrown",
"wrapping",
"the",
"JTA",
"originated",
"exce... | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/transaction/TransactionElf.java#L144-L152 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosure.java | SqlClosure.execute | public final T execute()
{
boolean txOwner = !TransactionElf.hasTransactionManager() || TransactionElf.beginOrJoinTransaction();
Connection connection = null;
try {
connection = ConnectionProxy.wrapConnection(dataSource.getConnection());
if (txOwner) {
// disable autoC... | java | public final T execute()
{
boolean txOwner = !TransactionElf.hasTransactionManager() || TransactionElf.beginOrJoinTransaction();
Connection connection = null;
try {
connection = ConnectionProxy.wrapConnection(dataSource.getConnection());
if (txOwner) {
// disable autoC... | [
"public",
"final",
"T",
"execute",
"(",
")",
"{",
"boolean",
"txOwner",
"=",
"!",
"TransactionElf",
".",
"hasTransactionManager",
"(",
")",
"||",
"TransactionElf",
".",
"beginOrJoinTransaction",
"(",
")",
";",
"Connection",
"connection",
"=",
"null",
";",
"try... | Execute the closure.
@return the template return type of the closure | [
"Execute",
"the",
"closure",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosure.java#L189-L230 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java | OrmWriter.createStatementForUpdate | private static PreparedStatement createStatementForUpdate(final Connection connection,
final Introspected introspected,
final FieldColumnInfo[] fieldColumnInfos,
... | java | private static PreparedStatement createStatementForUpdate(final Connection connection,
final Introspected introspected,
final FieldColumnInfo[] fieldColumnInfos,
... | [
"private",
"static",
"PreparedStatement",
"createStatementForUpdate",
"(",
"final",
"Connection",
"connection",
",",
"final",
"Introspected",
"introspected",
",",
"final",
"FieldColumnInfo",
"[",
"]",
"fieldColumnInfos",
",",
"final",
"Set",
"<",
"String",
">",
"exclu... | To exclude columns situative. Does not cache the statement. | [
"To",
"exclude",
"columns",
"situative",
".",
"Does",
"not",
"cache",
"the",
"statement",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java#L246-L253 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java | OrmWriter.setParamsExecute | private static <T> void setParamsExecute(final T target,
final Introspected introspected,
final FieldColumnInfo[] fcInfos,
final PreparedStatement stmt,
... | java | private static <T> void setParamsExecute(final T target,
final Introspected introspected,
final FieldColumnInfo[] fcInfos,
final PreparedStatement stmt,
... | [
"private",
"static",
"<",
"T",
">",
"void",
"setParamsExecute",
"(",
"final",
"T",
"target",
",",
"final",
"Introspected",
"introspected",
",",
"final",
"FieldColumnInfo",
"[",
"]",
"fcInfos",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"boolean",
... | You should close stmt by yourself | [
"You",
"should",
"close",
"stmt",
"by",
"yourself"
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java#L281-L301 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java | OrmWriter.setStatementParameters | private static <T> int setStatementParameters(final T item,
final Introspected introspected,
final FieldColumnInfo[] fcInfos,
final PreparedStatement stmt,
... | java | private static <T> int setStatementParameters(final T item,
final Introspected introspected,
final FieldColumnInfo[] fcInfos,
final PreparedStatement stmt,
... | [
"private",
"static",
"<",
"T",
">",
"int",
"setStatementParameters",
"(",
"final",
"T",
"item",
",",
"final",
"Introspected",
"introspected",
",",
"final",
"FieldColumnInfo",
"[",
"]",
"fcInfos",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"int",
... | Small helper to set statement parameters from given object | [
"Small",
"helper",
"to",
"set",
"statement",
"parameters",
"from",
"given",
"object"
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java#L304-L326 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java | OrmWriter.fillGeneratedId | private static <T> void fillGeneratedId(final T target,
final Introspected introspected,
final PreparedStatement stmt,
final boolean checkExistingId) throws SQLException {
if (!introspe... | java | private static <T> void fillGeneratedId(final T target,
final Introspected introspected,
final PreparedStatement stmt,
final boolean checkExistingId) throws SQLException {
if (!introspe... | [
"private",
"static",
"<",
"T",
">",
"void",
"fillGeneratedId",
"(",
"final",
"T",
"target",
",",
"final",
"Introspected",
"introspected",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"boolean",
"checkExistingId",
")",
"throws",
"SQLException",
"{",
"... | Sets auto-generated ID if not set yet | [
"Sets",
"auto",
"-",
"generated",
"ID",
"if",
"not",
"set",
"yet"
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/OrmWriter.java#L329-L350 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/Introspected.java | Introspected.set | void set(Object target, FieldColumnInfo fcInfo, Object value)
{
if (fcInfo == null) {
throw new RuntimeException("FieldColumnInfo must not be null. Type is " + target.getClass().getCanonicalName());
}
try {
final Class<?> fieldType = fcInfo.fieldType;
Class<?> columnType... | java | void set(Object target, FieldColumnInfo fcInfo, Object value)
{
if (fcInfo == null) {
throw new RuntimeException("FieldColumnInfo must not be null. Type is " + target.getClass().getCanonicalName());
}
try {
final Class<?> fieldType = fcInfo.fieldType;
Class<?> columnType... | [
"void",
"set",
"(",
"Object",
"target",
",",
"FieldColumnInfo",
"fcInfo",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"fcInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"FieldColumnInfo must not be null. Type is \"",
"+",
"target",
"."... | Set a field value of the specified target object.
@param target the target instance
@param fcInfo the {@link FieldColumnInfo} used to access the field value
@param value the value to set into the field of the target instance, possibly after applying a
{@link AttributeConverter} | [
"Set",
"a",
"field",
"value",
"of",
"the",
"specified",
"target",
"object",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/Introspected.java#L216-L267 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/Introspected.java | Introspected.isInsertableColumn | public boolean isInsertableColumn(final String columnName)
{
// Use index iteration to avoid generating an Iterator as side-effect
final FieldColumnInfo[] fcInfos = getInsertableFcInfos();
for (int i = 0; i < fcInfos.length; i++) {
if (fcInfos[i].getCaseSensitiveColumnName().equals(columnNa... | java | public boolean isInsertableColumn(final String columnName)
{
// Use index iteration to avoid generating an Iterator as side-effect
final FieldColumnInfo[] fcInfos = getInsertableFcInfos();
for (int i = 0; i < fcInfos.length; i++) {
if (fcInfos[i].getCaseSensitiveColumnName().equals(columnNa... | [
"public",
"boolean",
"isInsertableColumn",
"(",
"final",
"String",
"columnName",
")",
"{",
"// Use index iteration to avoid generating an Iterator as side-effect",
"final",
"FieldColumnInfo",
"[",
"]",
"fcInfos",
"=",
"getInsertableFcInfos",
"(",
")",
";",
"for",
"(",
"in... | Is this specified column insertable?
@param columnName Same case as in name element or property name without delimeters.
@return true if insertable, false otherwise | [
"Is",
"this",
"specified",
"column",
"insertable?"
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/Introspected.java#L403-L413 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/Introspected.java | Introspected.isUpdatableColumn | public boolean isUpdatableColumn(final String columnName)
{
// Use index iteration to avoid generating an Iterator as side-effect
final FieldColumnInfo[] fcInfos = getUpdatableFcInfos();
for (int i = 0; i < fcInfos.length; i++) {
if (fcInfos[i].getCaseSensitiveColumnName().equals(columnNam... | java | public boolean isUpdatableColumn(final String columnName)
{
// Use index iteration to avoid generating an Iterator as side-effect
final FieldColumnInfo[] fcInfos = getUpdatableFcInfos();
for (int i = 0; i < fcInfos.length; i++) {
if (fcInfos[i].getCaseSensitiveColumnName().equals(columnNam... | [
"public",
"boolean",
"isUpdatableColumn",
"(",
"final",
"String",
"columnName",
")",
"{",
"// Use index iteration to avoid generating an Iterator as side-effect",
"final",
"FieldColumnInfo",
"[",
"]",
"fcInfos",
"=",
"getUpdatableFcInfos",
"(",
")",
";",
"for",
"(",
"int"... | Is this specified column updatable?
@param columnName Same case as in name element or property name without delimeters.
@return true if updatable, false otherwise | [
"Is",
"this",
"specified",
"column",
"updatable?"
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/Introspected.java#L421-L431 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.insertListBatched | public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException
{
OrmWriter.insertListBatched(connection, iterable);
} | java | public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException
{
OrmWriter.insertListBatched(connection, iterable);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"insertListBatched",
"(",
"Connection",
"connection",
",",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"throws",
"SQLException",
"{",
"OrmWriter",
".",
"insertListBatched",
"(",
"connection",
",",
"iterable",
")",
";"... | Insert a collection of objects using JDBC batching.
@param connection a SQL connection
@param iterable a list (or other {@link Iterable} collection) of annotated objects to insert
@param <T> the class template
@throws SQLException if a {@link SQLException} occurs | [
"Insert",
"a",
"collection",
"of",
"objects",
"using",
"JDBC",
"batching",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L233-L236 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.insertObject | public static <T> T insertObject(Connection connection, T target) throws SQLException
{
return OrmWriter.insertObject(connection, target);
} | java | public static <T> T insertObject(Connection connection, T target) throws SQLException
{
return OrmWriter.insertObject(connection, target);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"insertObject",
"(",
"Connection",
"connection",
",",
"T",
"target",
")",
"throws",
"SQLException",
"{",
"return",
"OrmWriter",
".",
"insertObject",
"(",
"connection",
",",
"target",
")",
";",
"}"
] | Insert an annotated object into the database.
@param connection a SQL connection
@param target the annotated object to insert
@param <T> the class template
@return the same object that was passed in, but with possibly updated @Id field due to auto-generated keys
@throws SQLException if a {@link SQLException} occurs | [
"Insert",
"an",
"annotated",
"object",
"into",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L247-L250 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.getColumnFromProperty | public static String getColumnFromProperty(Class<?> clazz, String propertyName)
{
return Introspector.getIntrospected(clazz).getColumnNameForProperty(propertyName);
} | java | public static String getColumnFromProperty(Class<?> clazz, String propertyName)
{
return Introspector.getIntrospected(clazz).getColumnNameForProperty(propertyName);
} | [
"public",
"static",
"String",
"getColumnFromProperty",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"propertyName",
")",
"{",
"return",
"Introspector",
".",
"getIntrospected",
"(",
"clazz",
")",
".",
"getColumnNameForProperty",
"(",
"propertyName",
")",
... | Gets the column name defined for the given property for the given type.
@param clazz The type.
@param propertyName The object property name.
@return The database column name. | [
"Gets",
"the",
"column",
"name",
"defined",
"for",
"the",
"given",
"property",
"for",
"the",
"given",
"type",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L305-L308 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.getColumnsCsv | public static <T> String getColumnsCsv(Class<T> clazz, String... tablePrefix)
{
return OrmReader.getColumnsCsv(clazz, tablePrefix);
} | java | public static <T> String getColumnsCsv(Class<T> clazz, String... tablePrefix)
{
return OrmReader.getColumnsCsv(clazz, tablePrefix);
} | [
"public",
"static",
"<",
"T",
">",
"String",
"getColumnsCsv",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"...",
"tablePrefix",
")",
"{",
"return",
"OrmReader",
".",
"getColumnsCsv",
"(",
"clazz",
",",
"tablePrefix",
")",
";",
"}"
] | Get a comma separated values list of column names for the given class, suitable
for inclusion into a SQL SELECT statement.
@param clazz the annotated class
@param tablePrefix an optional table prefix to append to each column
@param <T> the class template
@return a CSV of annotated column names | [
"Get",
"a",
"comma",
"separated",
"values",
"list",
"of",
"column",
"names",
"for",
"the",
"given",
"class",
"suitable",
"for",
"inclusion",
"into",
"a",
"SQL",
"SELECT",
"statement",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L319-L322 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.refresh | public static <T> T refresh(Connection connection, T target) throws SQLException {
return OrmReader.refresh(connection, target);
} | java | public static <T> T refresh(Connection connection, T target) throws SQLException {
return OrmReader.refresh(connection, target);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"refresh",
"(",
"Connection",
"connection",
",",
"T",
"target",
")",
"throws",
"SQLException",
"{",
"return",
"OrmReader",
".",
"refresh",
"(",
"connection",
",",
"target",
")",
";",
"}"
] | To refresh all fields in case they have changed in database.
@param connection a SQL connection
@param target an annotated object with at least all @Id fields set.
@return the target object with all values updated or null if the object was not found anymore.
@throws SQLException if a {@link SQLException} occurs
@param... | [
"To",
"refresh",
"all",
"fields",
"in",
"case",
"they",
"have",
"changed",
"in",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L349-L351 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/internal/OrmBase.java | OrmBase.isIgnoredColumn | protected static boolean isIgnoredColumn(final Set<String> ignoredColumns, final String columnName) {
return ignoredColumns.stream().anyMatch(s -> s.equalsIgnoreCase(columnName));
} | java | protected static boolean isIgnoredColumn(final Set<String> ignoredColumns, final String columnName) {
return ignoredColumns.stream().anyMatch(s -> s.equalsIgnoreCase(columnName));
} | [
"protected",
"static",
"boolean",
"isIgnoredColumn",
"(",
"final",
"Set",
"<",
"String",
">",
"ignoredColumns",
",",
"final",
"String",
"columnName",
")",
"{",
"return",
"ignoredColumns",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"s",
"->",
"s",
".",
... | Case insensitive comparison. | [
"Case",
"insensitive",
"comparison",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/internal/OrmBase.java#L133-L135 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SansOrm.java | SansOrm.deinitialize | public static void deinitialize() {
SqlClosure.setDefaultDataSource(null);
TransactionElf.setUserTransaction(null);
TransactionElf.setTransactionManager(null);
} | java | public static void deinitialize() {
SqlClosure.setDefaultDataSource(null);
TransactionElf.setUserTransaction(null);
TransactionElf.setTransactionManager(null);
} | [
"public",
"static",
"void",
"deinitialize",
"(",
")",
"{",
"SqlClosure",
".",
"setDefaultDataSource",
"(",
"null",
")",
";",
"TransactionElf",
".",
"setUserTransaction",
"(",
"null",
")",
";",
"TransactionElf",
".",
"setTransactionManager",
"(",
"null",
")",
";"... | You can reset SansOrm to a fresh state if desired.
E.g. if you want to call another initializeXXX method. | [
"You",
"can",
"reset",
"SansOrm",
"to",
"a",
"fresh",
"state",
"if",
"desired",
".",
"E",
".",
"g",
".",
"if",
"you",
"want",
"to",
"call",
"another",
"initializeXXX",
"method",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SansOrm.java#L55-L59 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.getObjectById | public static <T> T getObjectById(Class<T> type, Object... ids)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectById(c, type, ids));
} | java | public static <T> T getObjectById(Class<T> type, Object... ids)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectById(c, type, ids));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getObjectById",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"ids",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"objectById",
"(",
"c",
",",
"type",
",",
... | Gets an object by ID from the database.
@param type The type of the desired object.
@param ids The ID or IDs of the object.
@param <T> The type of the object.
@return The object or {@code null} | [
"Gets",
"an",
"object",
"by",
"ID",
"from",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L43-L46 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.objectFromClause | public static <T> T objectFromClause(Class<T> type, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectFromClause(c, type, clause, args));
} | java | public static <T> T objectFromClause(Class<T> type, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.objectFromClause(c, type, clause, args));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"objectFromClause",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"clause",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"objectFromClause"... | Gets an object using a from clause.
@param type The type of the desired object.
@param clause The WHERE clause.
@param args The arguments for the WHERE clause.
@param <T> The type of the object.
@return The object or {@code null} | [
"Gets",
"an",
"object",
"using",
"a",
"from",
"clause",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L56-L59 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.insertObject | public static <T> T insertObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.insertObject(c, object));
} | java | public static <T> T insertObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.insertObject(c, object));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"insertObject",
"(",
"T",
"object",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"insertObject",
"(",
"c",
",",
"object",
")",
")",
";",
"}"
] | Inserts the given object into the database.
@param object The object to insert.
@param <T> The type of the object.
@return The inserted object populated with any generated IDs. | [
"Inserts",
"the",
"given",
"object",
"into",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L67-L70 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.updateObject | public static <T> T updateObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.updateObject(c, object));
} | java | public static <T> T updateObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.updateObject(c, object));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"updateObject",
"(",
"T",
"object",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"updateObject",
"(",
"c",
",",
"object",
")",
")",
";",
"}"
] | Updates the given object in the database.
@param object The object to update.
@param <T> The type of the object.
@return The updated object. | [
"Updates",
"the",
"given",
"object",
"in",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L78-L81 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.deleteObject | public static <T> int deleteObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.deleteObject(c, object));
} | java | public static <T> int deleteObject(T object)
{
return SqlClosure.sqlExecute(c -> OrmElf.deleteObject(c, object));
} | [
"public",
"static",
"<",
"T",
">",
"int",
"deleteObject",
"(",
"T",
"object",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"deleteObject",
"(",
"c",
",",
"object",
")",
")",
";",
"}"
] | Delete the given object in the database.
@param object the object to delete.
@param <T> The type of the object.
@return the number of rows affected. | [
"Delete",
"the",
"given",
"object",
"in",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L89-L92 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.deleteObjectById | public static <T> int deleteObjectById(Class<T> clazz, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.deleteObjectById(c, clazz, args));
} | java | public static <T> int deleteObjectById(Class<T> clazz, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.deleteObjectById(c, clazz, args));
} | [
"public",
"static",
"<",
"T",
">",
"int",
"deleteObjectById",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"deleteObjectById",
"(",
"c",
",",
"cl... | Delete an object from the database by ID.
@param clazz the class of the object to delete.
@param args the IDs of the object, in order of appearance of declaration in the target object class.
@param <T> The type of the object.
@return the number of rows affected. | [
"Delete",
"an",
"object",
"from",
"the",
"database",
"by",
"ID",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L101-L104 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.listFromClause | public static <T> List<T> listFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.listFromClause(c, clazz, clause, args));
} | java | public static <T> List<T> listFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.listFromClause(c, clazz, clause, args));
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"listFromClause",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"clause",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".... | Gets a list of objects from the database.
@param clazz The type of the desired objects.
@param clause The from or where clause.
@param args The arguments needed for the clause.
@param <T> The type of the objects.
@return The list of objects. | [
"Gets",
"a",
"list",
"of",
"objects",
"from",
"the",
"database",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L114-L117 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.countObjectsFromClause | public static <T> int countObjectsFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.countObjectsFromClause(c, clazz, clause, args));
} | java | public static <T> int countObjectsFromClause(Class<T> clazz, String clause, Object... args)
{
return SqlClosure.sqlExecute(c -> OrmElf.countObjectsFromClause(c, clazz, clause, args));
} | [
"public",
"static",
"<",
"T",
">",
"int",
"countObjectsFromClause",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"clause",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"OrmElf",
".",
"countObj... | Counts the number of rows for the given query.
@param clazz the class of the object to query.
@param clause The conditional part of a SQL where clause.
@param args The query parameters used to find the list of objects.
@param <T> the type of object to query.
@return The result count. | [
"Counts",
"the",
"number",
"of",
"rows",
"for",
"the",
"given",
"query",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L128-L131 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.executeUpdate | public static int executeUpdate(final String sql, final Object... args)
{
return SqlClosure.sqlExecute(c -> executeUpdate(c, sql, args));
} | java | public static int executeUpdate(final String sql, final Object... args)
{
return SqlClosure.sqlExecute(c -> executeUpdate(c, sql, args));
} | [
"public",
"static",
"int",
"executeUpdate",
"(",
"final",
"String",
"sql",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"return",
"SqlClosure",
".",
"sqlExecute",
"(",
"c",
"->",
"executeUpdate",
"(",
"c",
",",
"sql",
",",
"args",
")",
")",
";",
"}... | Executes an update or insert statement.
@param sql The SQL to execute.
@param args The query parameters used
@return the number of rows updated | [
"Executes",
"an",
"update",
"or",
"insert",
"statement",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L153-L156 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.getInClausePlaceholdersForCount | public static String getInClausePlaceholdersForCount(final int placeholderCount)
{
// we cant overload method name because the only item for getInClausePlaceholders can be Integer which leads to ambiguity
if (placeholderCount < 0)
{
throw new IllegalArgumentException("Placeholder count mus... | java | public static String getInClausePlaceholdersForCount(final int placeholderCount)
{
// we cant overload method name because the only item for getInClausePlaceholders can be Integer which leads to ambiguity
if (placeholderCount < 0)
{
throw new IllegalArgumentException("Placeholder count mus... | [
"public",
"static",
"String",
"getInClausePlaceholdersForCount",
"(",
"final",
"int",
"placeholderCount",
")",
"{",
"// we cant overload method name because the only item for getInClausePlaceholders can be Integer which leads to ambiguity",
"if",
"(",
"placeholderCount",
"<",
"0",
")... | Get a SQL "IN" clause for the number of items.
@param placeholderCount a count of "?" placeholders
@return a parenthetical String with {@code item.length} placeholders, eg. " (?,?,?,?) ".
@throws IllegalArgumentException if placeholderCount is negative | [
"Get",
"a",
"SQL",
"IN",
"clause",
"for",
"the",
"number",
"of",
"items",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L180-L199 | train |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosureElf.java | SqlClosureElf.executeQuery | public static ResultSet executeQuery(Connection connection, String sql, Object... args) throws SQLException
{
return OrmReader.statementToResultSet(connection.prepareStatement(sql), args);
} | java | public static ResultSet executeQuery(Connection connection, String sql, Object... args) throws SQLException
{
return OrmReader.statementToResultSet(connection.prepareStatement(sql), args);
} | [
"public",
"static",
"ResultSet",
"executeQuery",
"(",
"Connection",
"connection",
",",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"throws",
"SQLException",
"{",
"return",
"OrmReader",
".",
"statementToResultSet",
"(",
"connection",
".",
"prepareStatement",
... | Execute the specified SQL as a PreparedStatement with the specified arguments.
@param connection a Connection
@param sql the SQL statement to prepare and execute
@param args the optional arguments to execute with the query
@return a ResultSet object
@throws SQLException if a {@link SQLException} occurs | [
"Execute",
"the",
"specified",
"SQL",
"as",
"a",
"PreparedStatement",
"with",
"the",
"specified",
"arguments",
"."
] | ab22721db79c5f20c0e8483f09eda2844d596557 | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L226-L229 | train |
i-net-software/jlessc | src/com/inet/lib/less/Less.java | Less.compile | public static String compile( File lessFile, boolean compress ) throws IOException {
String lessData = new String( Files.readAllBytes( lessFile.toPath() ), StandardCharsets.UTF_8 );
return Less.compile( lessFile.toURI().toURL(), lessData, compress, new ReaderFactory() );
} | java | public static String compile( File lessFile, boolean compress ) throws IOException {
String lessData = new String( Files.readAllBytes( lessFile.toPath() ), StandardCharsets.UTF_8 );
return Less.compile( lessFile.toURI().toURL(), lessData, compress, new ReaderFactory() );
} | [
"public",
"static",
"String",
"compile",
"(",
"File",
"lessFile",
",",
"boolean",
"compress",
")",
"throws",
"IOException",
"{",
"String",
"lessData",
"=",
"new",
"String",
"(",
"Files",
".",
"readAllBytes",
"(",
"lessFile",
".",
"toPath",
"(",
")",
")",
"... | Compile the less data from a file.
@param lessFile
the less file
@param compress
true, if the CSS data should be compressed without any extra formating characters.
@return the resulting less data
@throws IOException
if an I/O error occurs reading from the less file | [
"Compile",
"the",
"less",
"data",
"from",
"a",
"file",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Less.java#L155-L158 | train |
i-net-software/jlessc | src/com/inet/lib/less/LessException.java | LessException.addPosition | void addPosition( String filename, int line, int column ) {
LessFilePosition pos = new LessFilePosition( filename, line, column );
if( !positions.contains( pos ) ) {
this.positions.add( pos );
}
} | java | void addPosition( String filename, int line, int column ) {
LessFilePosition pos = new LessFilePosition( filename, line, column );
if( !positions.contains( pos ) ) {
this.positions.add( pos );
}
} | [
"void",
"addPosition",
"(",
"String",
"filename",
",",
"int",
"line",
",",
"int",
"column",
")",
"{",
"LessFilePosition",
"pos",
"=",
"new",
"LessFilePosition",
"(",
"filename",
",",
"line",
",",
"column",
")",
";",
"if",
"(",
"!",
"positions",
".",
"con... | Add a position to the less file stacktrace
@param filename the less file, can be null if a string was parsed
@param line the line number in the less file
@param column the column in the less file | [
"Add",
"a",
"position",
"to",
"the",
"less",
"file",
"stacktrace"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessException.java#L77-L82 | train |
i-net-software/jlessc | src/com/inet/lib/less/RegExp.java | RegExp.replace | public String replace( String input, String replacement ) throws ParameterOutOfBoundsException {
// Replace \ in the replacement with \\ to escape it for Java replace.
replacement = REPLACEMENT_BACKSLASH.matcher( replacement ).replaceAll( REPLACEMENT_BACKSLASH_FOR_JAVA );
// Replace the Javascr... | java | public String replace( String input, String replacement ) throws ParameterOutOfBoundsException {
// Replace \ in the replacement with \\ to escape it for Java replace.
replacement = REPLACEMENT_BACKSLASH.matcher( replacement ).replaceAll( REPLACEMENT_BACKSLASH_FOR_JAVA );
// Replace the Javascr... | [
"public",
"String",
"replace",
"(",
"String",
"input",
",",
"String",
"replacement",
")",
"throws",
"ParameterOutOfBoundsException",
"{",
"// Replace \\ in the replacement with \\\\ to escape it for Java replace.",
"replacement",
"=",
"REPLACEMENT_BACKSLASH",
".",
"matcher",
"(... | Replace the matches in the input with the replacement.
@param input the input string
@param replacement the replacement
@return the resulting string
@throws ParameterOutOfBoundsException if Java can not replace it like Javascript | [
"Replace",
"the",
"matches",
"in",
"the",
"input",
"with",
"the",
"replacement",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/RegExp.java#L113-L132 | train |
i-net-software/jlessc | src/com/inet/lib/less/Mixin.java | Mixin.appendSubRules | void appendSubRules( String[] parentSelector, CssFormatter formatter ) {
try {
if( important ) {
formatter.incImportant();
}
for( MixinMatch match : getRules( formatter ) ) {
Rule rule = match.getRule();
formatter.addMixin( rule... | java | void appendSubRules( String[] parentSelector, CssFormatter formatter ) {
try {
if( important ) {
formatter.incImportant();
}
for( MixinMatch match : getRules( formatter ) ) {
Rule rule = match.getRule();
formatter.addMixin( rule... | [
"void",
"appendSubRules",
"(",
"String",
"[",
"]",
"parentSelector",
",",
"CssFormatter",
"formatter",
")",
"{",
"try",
"{",
"if",
"(",
"important",
")",
"{",
"formatter",
".",
"incImportant",
"(",
")",
";",
"}",
"for",
"(",
"MixinMatch",
"match",
":",
"... | Append the rules of the mixins to the formatter.
@param parentSelector the selectors of the caller
@param formatter the formatter | [
"Append",
"the",
"rules",
"of",
"the",
"mixins",
"to",
"the",
"formatter",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Mixin.java#L133-L157 | train |
i-net-software/jlessc | src/com/inet/lib/less/Mixin.java | Mixin.getRules | @Nonnull
private List<MixinMatch> getRules( CssFormatter formatter ) throws LessException {
if( mixinRules != null && stackID == formatter.stackID() ) {
return mixinRules;
}
List<Rule> rules = formatter.getMixin( name );
if( rules == null ) {
rules = mixins.ge... | java | @Nonnull
private List<MixinMatch> getRules( CssFormatter formatter ) throws LessException {
if( mixinRules != null && stackID == formatter.stackID() ) {
return mixinRules;
}
List<Rule> rules = formatter.getMixin( name );
if( rules == null ) {
rules = mixins.ge... | [
"@",
"Nonnull",
"private",
"List",
"<",
"MixinMatch",
">",
"getRules",
"(",
"CssFormatter",
"formatter",
")",
"throws",
"LessException",
"{",
"if",
"(",
"mixinRules",
"!=",
"null",
"&&",
"stackID",
"==",
"formatter",
".",
"stackID",
"(",
")",
")",
"{",
"re... | Get the rules of the mixin
@param formatter the formatter
@return the rules, can be empty if no condition matched but not null
@throws LessException if no rule match the name of the mixin. | [
"Get",
"the",
"rules",
"of",
"the",
"mixin"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Mixin.java#L165-L226 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.bubbling | private void bubbling( String[] mediaSelector, String[] blockSelector, CssFormatter formatter ) {
if( properties.size() > 0 ) {
String media = mediaSelector[0];
if( media.startsWith( "@media" ) || media.startsWith( "@supports" ) || media.startsWith( "@document" ) ) {
// c... | java | private void bubbling( String[] mediaSelector, String[] blockSelector, CssFormatter formatter ) {
if( properties.size() > 0 ) {
String media = mediaSelector[0];
if( media.startsWith( "@media" ) || media.startsWith( "@supports" ) || media.startsWith( "@document" ) ) {
// c... | [
"private",
"void",
"bubbling",
"(",
"String",
"[",
"]",
"mediaSelector",
",",
"String",
"[",
"]",
"blockSelector",
",",
"CssFormatter",
"formatter",
")",
"{",
"if",
"(",
"properties",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"media",
"=",
"... | Nested Directives are bubbling.
@param mediaSelector
the selector of the media, must start with an @
@param blockSelector
current block selector
@param formatter
current formatter | [
"Nested",
"Directives",
"are",
"bubbling",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L220-L268 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.appendMixinsTo | void appendMixinsTo( String[] parentSelector, CssFormatter formatter ) {
for( Formattable prop : properties ) {
switch( prop.getType()) {
case MIXIN:
((Mixin)prop).appendSubRules( parentSelector, formatter );
break;
case CSS_AT_... | java | void appendMixinsTo( String[] parentSelector, CssFormatter formatter ) {
for( Formattable prop : properties ) {
switch( prop.getType()) {
case MIXIN:
((Mixin)prop).appendSubRules( parentSelector, formatter );
break;
case CSS_AT_... | [
"void",
"appendMixinsTo",
"(",
"String",
"[",
"]",
"parentSelector",
",",
"CssFormatter",
"formatter",
")",
"{",
"for",
"(",
"Formattable",
"prop",
":",
"properties",
")",
"{",
"switch",
"(",
"prop",
".",
"getType",
"(",
")",
")",
"{",
"case",
"MIXIN",
"... | Append the mixins of this rule to current output.
@param parentSelector the resulting parent selector
@param formatter current formatter | [
"Append",
"the",
"mixins",
"of",
"this",
"rule",
"to",
"current",
"output",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L298-L310 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.appendPropertiesTo | void appendPropertiesTo( CssFormatter formatter ) {
if( properties.isEmpty() ) {
return;
}
formatter.addVariables( variables );
for( Formattable prop : properties ) {
switch( prop.getType() ) {
case Formattable.RULE:
Rule rule =... | java | void appendPropertiesTo( CssFormatter formatter ) {
if( properties.isEmpty() ) {
return;
}
formatter.addVariables( variables );
for( Formattable prop : properties ) {
switch( prop.getType() ) {
case Formattable.RULE:
Rule rule =... | [
"void",
"appendPropertiesTo",
"(",
"CssFormatter",
"formatter",
")",
"{",
"if",
"(",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"formatter",
".",
"addVariables",
"(",
"variables",
")",
";",
"for",
"(",
"Formattable",
"prop",
":",... | Append the properties of the rule.
@param formatter current formatter | [
"Append",
"the",
"properties",
"of",
"the",
"rule",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L317-L336 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.getMixin | List<Rule> getMixin( String name ) {
ArrayList<Rule> rules = null;
for( Rule rule : subrules ) {
for( String sel : rule.selectors ) {
if( name.equals( sel ) ) {
if( rules == null ) {
rules = new ArrayList<>();
}
... | java | List<Rule> getMixin( String name ) {
ArrayList<Rule> rules = null;
for( Rule rule : subrules ) {
for( String sel : rule.selectors ) {
if( name.equals( sel ) ) {
if( rules == null ) {
rules = new ArrayList<>();
}
... | [
"List",
"<",
"Rule",
">",
"getMixin",
"(",
"String",
"name",
")",
"{",
"ArrayList",
"<",
"Rule",
">",
"rules",
"=",
"null",
";",
"for",
"(",
"Rule",
"rule",
":",
"subrules",
")",
"{",
"for",
"(",
"String",
"sel",
":",
"rule",
".",
"selectors",
")",... | Get a nested mixin of this rule.
@param name
the name of the mixin
@return the mixin or null | [
"Get",
"a",
"nested",
"mixin",
"of",
"this",
"rule",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L464-L478 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.match | MixinMatch match( CssFormatter formatter, List<Expression> paramValues, boolean isDefault ) {
if( guard == null && formatter.containsRule( this ) ) {
return null;
}
Map<String, Expression> mixinParameters = getMixinParams( formatter, paramValues );
if( mixinParameters == NO_M... | java | MixinMatch match( CssFormatter formatter, List<Expression> paramValues, boolean isDefault ) {
if( guard == null && formatter.containsRule( this ) ) {
return null;
}
Map<String, Expression> mixinParameters = getMixinParams( formatter, paramValues );
if( mixinParameters == NO_M... | [
"MixinMatch",
"match",
"(",
"CssFormatter",
"formatter",
",",
"List",
"<",
"Expression",
">",
"paramValues",
",",
"boolean",
"isDefault",
")",
"{",
"if",
"(",
"guard",
"==",
"null",
"&&",
"formatter",
".",
"containsRule",
"(",
"this",
")",
")",
"{",
"retur... | If this mixin match the calling parameters.
@param formatter current formatter
@param paramValues calling parameters
@param isDefault the value of the keyword "default" in guard.
@return the match or null if there is no match of the parameter lists | [
"If",
"this",
"mixin",
"match",
"the",
"calling",
"parameters",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L505-L524 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.isInlineRule | boolean isInlineRule( CssFormatter formatter ) {
if( selectors.length == 1 && selectors[0].equals( "&" ) ) {
return hasOnlyInlineProperties( formatter );
}
return false;
} | java | boolean isInlineRule( CssFormatter formatter ) {
if( selectors.length == 1 && selectors[0].equals( "&" ) ) {
return hasOnlyInlineProperties( formatter );
}
return false;
} | [
"boolean",
"isInlineRule",
"(",
"CssFormatter",
"formatter",
")",
"{",
"if",
"(",
"selectors",
".",
"length",
"==",
"1",
"&&",
"selectors",
"[",
"0",
"]",
".",
"equals",
"(",
"\"&\"",
")",
")",
"{",
"return",
"hasOnlyInlineProperties",
"(",
"formatter",
")... | If there is only a special selector "&" and also all subrules have only this special selector.
@param formatter current formatter
@return true, if selector is "&" | [
"If",
"there",
"is",
"only",
"a",
"special",
"selector",
"&",
"and",
"also",
"all",
"subrules",
"have",
"only",
"this",
"special",
"selector",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L559-L564 | train |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.hasOnlyInlineProperties | boolean hasOnlyInlineProperties( CssFormatter formatter ) {
for( Formattable prop : properties ) {
if( prop instanceof Mixin ) {
return false;
}
}
for( Rule rule : subrules ) {
if( rule.isValidCSS( formatter ) && rule.isInlineRule( formatter) ... | java | boolean hasOnlyInlineProperties( CssFormatter formatter ) {
for( Formattable prop : properties ) {
if( prop instanceof Mixin ) {
return false;
}
}
for( Rule rule : subrules ) {
if( rule.isValidCSS( formatter ) && rule.isInlineRule( formatter) ... | [
"boolean",
"hasOnlyInlineProperties",
"(",
"CssFormatter",
"formatter",
")",
"{",
"for",
"(",
"Formattable",
"prop",
":",
"properties",
")",
"{",
"if",
"(",
"prop",
"instanceof",
"Mixin",
")",
"{",
"return",
"false",
";",
"}",
"}",
"for",
"(",
"Rule",
"rul... | If there are only properties that should be inlined.
@param formatter current formatter
@return true, if only inline | [
"If",
"there",
"are",
"only",
"properties",
"that",
"should",
"be",
"inlined",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L572-L585 | train |
i-net-software/jlessc | src/com/inet/lib/less/ValueExpression.java | ValueExpression.eval | public static ValueExpression eval( CssFormatter formatter, Expression expr ) {
expr = expr.unpack( formatter ); // unpack to increase the chance to find a ValueExpression
if( expr.getClass() == ValueExpression.class ) {
return (ValueExpression)expr;
}
ValueExpression valueEx... | java | public static ValueExpression eval( CssFormatter formatter, Expression expr ) {
expr = expr.unpack( formatter ); // unpack to increase the chance to find a ValueExpression
if( expr.getClass() == ValueExpression.class ) {
return (ValueExpression)expr;
}
ValueExpression valueEx... | [
"public",
"static",
"ValueExpression",
"eval",
"(",
"CssFormatter",
"formatter",
",",
"Expression",
"expr",
")",
"{",
"expr",
"=",
"expr",
".",
"unpack",
"(",
"formatter",
")",
";",
"// unpack to increase the chance to find a ValueExpression",
"if",
"(",
"expr",
"."... | Create a value expression as parameter for a mixin which not change it value in a different context.
@param formatter current formatter
@param expr current expression
@return a ValueExpression | [
"Create",
"a",
"value",
"expression",
"as",
"parameter",
"for",
"a",
"mixin",
"which",
"not",
"change",
"it",
"value",
"in",
"a",
"different",
"context",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ValueExpression.java#L99-L122 | train |
i-net-software/jlessc | src/com/inet/lib/less/VariableExpression.java | VariableExpression.getValue | Expression getValue( CssFormatter formatter ) {
String name = toString();
Expression value = formatter.getVariable( name );
if( value != null ) {
return value;
}
if( name.startsWith( "@@" ) ) {
name = name.substring( 1 );
value = formatter.getV... | java | Expression getValue( CssFormatter formatter ) {
String name = toString();
Expression value = formatter.getVariable( name );
if( value != null ) {
return value;
}
if( name.startsWith( "@@" ) ) {
name = name.substring( 1 );
value = formatter.getV... | [
"Expression",
"getValue",
"(",
"CssFormatter",
"formatter",
")",
"{",
"String",
"name",
"=",
"toString",
"(",
")",
";",
"Expression",
"value",
"=",
"formatter",
".",
"getVariable",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"retur... | Get the referencing expression
@param formatter current formatter with all variables
@return the Expression | [
"Get",
"the",
"referencing",
"expression"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/VariableExpression.java#L88-L108 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.putConvertion | private static void putConvertion( HashMap<String, Double> group, String unit, double factor ) {
UNIT_CONVERSIONS.put(unit, group );
group.put( unit, factor );
} | java | private static void putConvertion( HashMap<String, Double> group, String unit, double factor ) {
UNIT_CONVERSIONS.put(unit, group );
group.put( unit, factor );
} | [
"private",
"static",
"void",
"putConvertion",
"(",
"HashMap",
"<",
"String",
",",
"Double",
">",
"group",
",",
"String",
"unit",
",",
"double",
"factor",
")",
"{",
"UNIT_CONVERSIONS",
".",
"put",
"(",
"unit",
",",
"group",
")",
";",
"group",
".",
"put",
... | Helper for creating static unit conversions.
@param group the unit group like length, duration or angles. Units of one group can convert in another.
@param unit the unit name
@param factor the convert factor | [
"Helper",
"for",
"creating",
"static",
"unit",
"conversions",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L74-L77 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.maxOperadType | private int maxOperadType( CssFormatter formatter ) {
int dataType = operands.get( 0 ).getDataType( formatter );
for( int i = 1; i < operands.size(); i++ ) {
dataType = Math.max( dataType, operands.get( i ).getDataType( formatter ) );
}
return dataType;
} | java | private int maxOperadType( CssFormatter formatter ) {
int dataType = operands.get( 0 ).getDataType( formatter );
for( int i = 1; i < operands.size(); i++ ) {
dataType = Math.max( dataType, operands.get( i ).getDataType( formatter ) );
}
return dataType;
} | [
"private",
"int",
"maxOperadType",
"(",
"CssFormatter",
"formatter",
")",
"{",
"int",
"dataType",
"=",
"operands",
".",
"get",
"(",
"0",
")",
".",
"getDataType",
"(",
"formatter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"operands",
... | Get the highest data type of different operands
@param formatter current formatter
@return the data type | [
"Get",
"the",
"highest",
"data",
"type",
"of",
"different",
"operands"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L190-L196 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.unitFactor | static double unitFactor( String leftUnit, String rightUnit, boolean fail ) {
if( leftUnit.length() == 0 || rightUnit.length() == 0 || leftUnit.equals( rightUnit ) ) {
return 1;
}
HashMap<String, Double> leftGroup = UNIT_CONVERSIONS.get( leftUnit );
if( leftGroup != null ) {
... | java | static double unitFactor( String leftUnit, String rightUnit, boolean fail ) {
if( leftUnit.length() == 0 || rightUnit.length() == 0 || leftUnit.equals( rightUnit ) ) {
return 1;
}
HashMap<String, Double> leftGroup = UNIT_CONVERSIONS.get( leftUnit );
if( leftGroup != null ) {
... | [
"static",
"double",
"unitFactor",
"(",
"String",
"leftUnit",
",",
"String",
"rightUnit",
",",
"boolean",
"fail",
")",
"{",
"if",
"(",
"leftUnit",
".",
"length",
"(",
")",
"==",
"0",
"||",
"rightUnit",
".",
"length",
"(",
")",
"==",
"0",
"||",
"leftUnit... | Calculate the factor between 2 units.
@param leftUnit left unit
@param rightUnit right unit
@param fail true, should be fail if units incompatible; false, return 1 is incompatible
@return the factor between the 2 units.
@throws LessException if unit are incompatible and fail is true | [
"Calculate",
"the",
"factor",
"between",
"2",
"units",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L299-L314 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValue | private double doubleValue( double left, double right ) {
switch( operator ) {
case '+':
return left + right;
case '-':
return left - right;
case '*':
return left * right;
case '/':
return left / righ... | java | private double doubleValue( double left, double right ) {
switch( operator ) {
case '+':
return left + right;
case '-':
return left - right;
case '*':
return left * right;
case '/':
return left / righ... | [
"private",
"double",
"doubleValue",
"(",
"double",
"left",
",",
"double",
"right",
")",
"{",
"switch",
"(",
"operator",
")",
"{",
"case",
"'",
"'",
":",
"return",
"left",
"+",
"right",
";",
"case",
"'",
"'",
":",
"return",
"left",
"-",
"right",
";",
... | Calculate the number value of two operands if possible.
@param left the left
@param right the right
@return the result. | [
"Calculate",
"the",
"number",
"value",
"of",
"two",
"operands",
"if",
"possible",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L358-L371 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValueLeftColor | private double doubleValueLeftColor( double color, double right ) {
return rgba( doubleValue( red( color ), right ), //
doubleValue( green( color ), right ), //
doubleValue( blue( color ), right ), 1 );
} | java | private double doubleValueLeftColor( double color, double right ) {
return rgba( doubleValue( red( color ), right ), //
doubleValue( green( color ), right ), //
doubleValue( blue( color ), right ), 1 );
} | [
"private",
"double",
"doubleValueLeftColor",
"(",
"double",
"color",
",",
"double",
"right",
")",
"{",
"return",
"rgba",
"(",
"doubleValue",
"(",
"red",
"(",
"color",
")",
",",
"right",
")",
",",
"//",
"doubleValue",
"(",
"green",
"(",
"color",
")",
",",... | Calculate a color on left with a number on the right side. The calculation occur for every color channel.
@param color the color
@param right the right
@return color value as long | [
"Calculate",
"a",
"color",
"on",
"left",
"with",
"a",
"number",
"on",
"the",
"right",
"side",
".",
"The",
"calculation",
"occur",
"for",
"every",
"color",
"channel",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L380-L384 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValueRightColor | private double doubleValueRightColor( double left, double color ) {
return rgba( doubleValue( left, red( color ) ), //
doubleValue( left, green( color ) ), //
doubleValue( left, blue( color ) ), 1 );
} | java | private double doubleValueRightColor( double left, double color ) {
return rgba( doubleValue( left, red( color ) ), //
doubleValue( left, green( color ) ), //
doubleValue( left, blue( color ) ), 1 );
} | [
"private",
"double",
"doubleValueRightColor",
"(",
"double",
"left",
",",
"double",
"color",
")",
"{",
"return",
"rgba",
"(",
"doubleValue",
"(",
"left",
",",
"red",
"(",
"color",
")",
")",
",",
"//",
"doubleValue",
"(",
"left",
",",
"green",
"(",
"color... | Calculate a number on left with a color on the right side. The calculation occur for every color channel.
@param left the left
@param color the color
@return color value as long | [
"Calculate",
"a",
"number",
"on",
"left",
"with",
"a",
"color",
"on",
"the",
"right",
"side",
".",
"The",
"calculation",
"occur",
"for",
"every",
"color",
"channel",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L393-L397 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.doubleValue2Colors | private double doubleValue2Colors( double left, double right ) {
return rgba( doubleValue( red( left ), red( right ) ), //
doubleValue( green( left ), green( right ) ), //
doubleValue( blue( left ), blue( right ) ), 1 );
} | java | private double doubleValue2Colors( double left, double right ) {
return rgba( doubleValue( red( left ), red( right ) ), //
doubleValue( green( left ), green( right ) ), //
doubleValue( blue( left ), blue( right ) ), 1 );
} | [
"private",
"double",
"doubleValue2Colors",
"(",
"double",
"left",
",",
"double",
"right",
")",
"{",
"return",
"rgba",
"(",
"doubleValue",
"(",
"red",
"(",
"left",
")",
",",
"red",
"(",
"right",
")",
")",
",",
"//",
"doubleValue",
"(",
"green",
"(",
"le... | Calculate two colors. The calculation occur for every color channel.
@param left the left color
@param right the right color
@return color value as long | [
"Calculate",
"two",
"colors",
".",
"The",
"calculation",
"occur",
"for",
"every",
"color",
"channel",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L406-L410 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.normlizeQuotes | private String normlizeQuotes( String str ) {
if( str.length() > 1 && str.charAt( 0 ) == '\'' && str.charAt( str.length() - 1 ) == '\'' ) {
return '\"' + str.substring( 1, str.length() - 1 ) + '\"';
}
return str;
} | java | private String normlizeQuotes( String str ) {
if( str.length() > 1 && str.charAt( 0 ) == '\'' && str.charAt( str.length() - 1 ) == '\'' ) {
return '\"' + str.substring( 1, str.length() - 1 ) + '\"';
}
return str;
} | [
"private",
"String",
"normlizeQuotes",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
">",
"1",
"&&",
"str",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
"&&",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"(",
"... | Convert single quotes to double quotes.
@param str input
@return normalize string | [
"Convert",
"single",
"quotes",
"to",
"double",
"quotes",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L529-L534 | train |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.unit | private ArrayList<Unit> unit( CssFormatter formatter, ArrayList<Unit> list ){
for( int i = 0; i < operands.size(); i++ ) {
Expression exp = operands.get( i );
if( exp.getClass() == Operation.class ) {
Operation op = (Operation)exp;
switch( op.operator ) {
... | java | private ArrayList<Unit> unit( CssFormatter formatter, ArrayList<Unit> list ){
for( int i = 0; i < operands.size(); i++ ) {
Expression exp = operands.get( i );
if( exp.getClass() == Operation.class ) {
Operation op = (Operation)exp;
switch( op.operator ) {
... | [
"private",
"ArrayList",
"<",
"Unit",
">",
"unit",
"(",
"CssFormatter",
"formatter",
",",
"ArrayList",
"<",
"Unit",
">",
"list",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"operands",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{"... | Calculate the unit if there are different units. It use the numerator and denominator count.
@param formatter the CCS target
@param list previous result
@return null or a with with minimum one entry | [
"Calculate",
"the",
"unit",
"if",
"there",
"are",
"different",
"units",
".",
"It",
"use",
"the",
"numerator",
"and",
"denominator",
"count",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L542-L581 | train |
i-net-software/jlessc | src/com/inet/lib/less/HashMultimap.java | HashMultimap.add | void add( K key, V value ) {
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
map.put( key, rules );
}
rules.add( value );
} | java | void add( K key, V value ) {
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
map.put( key, rules );
}
rules.add( value );
} | [
"void",
"add",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"List",
"<",
"V",
">",
"rules",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"rules",
"==",
"null",
")",
"{",
"rules",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"m... | Add a value to this map. If the map previously contained a mapping for the key, then there are two values now.
@param key the key
@param value the value | [
"Add",
"a",
"value",
"to",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"then",
"there",
"are",
"two",
"values",
"now",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/HashMultimap.java#L69-L76 | train |
i-net-software/jlessc | src/com/inet/lib/less/HashMultimap.java | HashMultimap.get | List<V> get( K key ) {
List<V> result = map.get( key );
if( parent != null ) {
List<V> resultParent = parent.get( key );
if( result == null ) {
return resultParent;
} else if( resultParent == null ){
return result;
} else {
... | java | List<V> get( K key ) {
List<V> result = map.get( key );
if( parent != null ) {
List<V> resultParent = parent.get( key );
if( result == null ) {
return resultParent;
} else if( resultParent == null ){
return result;
} else {
... | [
"List",
"<",
"V",
">",
"get",
"(",
"K",
"key",
")",
"{",
"List",
"<",
"V",
">",
"result",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"List",
"<",
"V",
">",
"resultParent",
"=",
"parent",
".",
... | Get all values for the given key. If no key exists then null is return.
@param key
the key
@return the list or null | [
"Get",
"all",
"values",
"for",
"the",
"given",
"key",
".",
"If",
"no",
"key",
"exists",
"then",
"null",
"is",
"return",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/HashMultimap.java#L85-L102 | train |
i-net-software/jlessc | src/com/inet/lib/less/HashMultimap.java | HashMultimap.addAll | void addAll( HashMultimap<K, V> m ) {
if( m == this ) {
return;
}
for( Entry<K, List<V>> entry : m.map.entrySet() ) {
K key = entry.getKey();
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
... | java | void addAll( HashMultimap<K, V> m ) {
if( m == this ) {
return;
}
for( Entry<K, List<V>> entry : m.map.entrySet() ) {
K key = entry.getKey();
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
... | [
"void",
"addAll",
"(",
"HashMultimap",
"<",
"K",
",",
"V",
">",
"m",
")",
"{",
"if",
"(",
"m",
"==",
"this",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Entry",
"<",
"K",
",",
"List",
"<",
"V",
">",
">",
"entry",
":",
"m",
".",
"map",
".",
... | Add all values of the mappings from the specified map to this map.
@param m
mappings to be stored in this map | [
"Add",
"all",
"values",
"of",
"the",
"mappings",
"from",
"the",
"specified",
"map",
"to",
"this",
"map",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/HashMultimap.java#L110-L127 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.parseRewriteUrl | private int parseRewriteUrl() {
String rewrite = options.get( Less.REWRITE_URLS );
if( rewrite != null ) {
switch( rewrite.toLowerCase() ) {
case "off":
return 0;
case "local":
return 1;
case "all":
... | java | private int parseRewriteUrl() {
String rewrite = options.get( Less.REWRITE_URLS );
if( rewrite != null ) {
switch( rewrite.toLowerCase() ) {
case "off":
return 0;
case "local":
return 1;
case "all":
... | [
"private",
"int",
"parseRewriteUrl",
"(",
")",
"{",
"String",
"rewrite",
"=",
"options",
".",
"get",
"(",
"Less",
".",
"REWRITE_URLS",
")",
";",
"if",
"(",
"rewrite",
"!=",
"null",
")",
"{",
"switch",
"(",
"rewrite",
".",
"toLowerCase",
"(",
")",
")",
... | Parse the parameter rewrite URL
@return 0, 1 or 2 | [
"Parse",
"the",
"parameter",
"rewrite",
"URL"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L232-L245 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.addOutput | void addOutput() {
if( output != null ) {
outputs.addLast( output );
}
output = state.pool.get();
} | java | void addOutput() {
if( output != null ) {
outputs.addLast( output );
}
output = state.pool.get();
} | [
"void",
"addOutput",
"(",
")",
"{",
"if",
"(",
"output",
"!=",
"null",
")",
"{",
"outputs",
".",
"addLast",
"(",
"output",
")",
";",
"}",
"output",
"=",
"state",
".",
"pool",
".",
"get",
"(",
")",
";",
"}"
] | Add a new output buffer to the formatter. | [
"Add",
"a",
"new",
"output",
"buffer",
"to",
"the",
"formatter",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L274-L279 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.freeOutput | void freeOutput() {
state.pool.free( output );
output = outputs.size() > 0 ? outputs.removeLast() : null;
} | java | void freeOutput() {
state.pool.free( output );
output = outputs.size() > 0 ? outputs.removeLast() : null;
} | [
"void",
"freeOutput",
"(",
")",
"{",
"state",
".",
"pool",
".",
"free",
"(",
"output",
")",
";",
"output",
"=",
"outputs",
".",
"size",
"(",
")",
">",
"0",
"?",
"outputs",
".",
"removeLast",
"(",
")",
":",
"null",
";",
"}"
] | Release an output and delete it. | [
"Release",
"an",
"output",
"and",
"delete",
"it",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L284-L287 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.releaseOutput | String releaseOutput() {
if( output == null ) { // occur in Rule.toString()
return "";
}
String str = output.toString();
freeOutput();
return str;
} | java | String releaseOutput() {
if( output == null ) { // occur in Rule.toString()
return "";
}
String str = output.toString();
freeOutput();
return str;
} | [
"String",
"releaseOutput",
"(",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"// occur in Rule.toString()",
"return",
"\"\"",
";",
"}",
"String",
"str",
"=",
"output",
".",
"toString",
"(",
")",
";",
"freeOutput",
"(",
")",
";",
"return",
"str"... | Release an output buffer, return the content and restore the previous output.
@return the content of the current output | [
"Release",
"an",
"output",
"buffer",
"return",
"the",
"content",
"and",
"restore",
"the",
"previous",
"output",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L293-L300 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.getVariable | Expression getVariable( String name ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
Expression variable = state.stack.get( i ).getVariable( name );
if( variable != null ) {
return variable;
}
}
if( name.equals( "@arguments" ) ) {
... | java | Expression getVariable( String name ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
Expression variable = state.stack.get( i ).getVariable( name );
if( variable != null ) {
return variable;
}
}
if( name.equals( "@arguments" ) ) {
... | [
"Expression",
"getVariable",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"state",
".",
"stackIdx",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Expression",
"variable",
"=",
"state",
".",
"stack",
".",
"get",
"(",
"... | Get a variable expression from the current stack
@param name
the name of the variable starting with @
@return the expression or null if not found | [
"Get",
"a",
"variable",
"expression",
"from",
"the",
"current",
"stack"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L376-L399 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.addMixin | void addMixin( Rule mixin, Map<String, Expression> parameters, Map<String, Expression> variables ) {
int idx = state.stackIdx++;
Scope scope;
if( state.stack.size() <= idx ) {
scope = new Scope();
state.stack.add( scope );
} else {
scope = state.stack.... | java | void addMixin( Rule mixin, Map<String, Expression> parameters, Map<String, Expression> variables ) {
int idx = state.stackIdx++;
Scope scope;
if( state.stack.size() <= idx ) {
scope = new Scope();
state.stack.add( scope );
} else {
scope = state.stack.... | [
"void",
"addMixin",
"(",
"Rule",
"mixin",
",",
"Map",
"<",
"String",
",",
"Expression",
">",
"parameters",
",",
"Map",
"<",
"String",
",",
"Expression",
">",
"variables",
")",
"{",
"int",
"idx",
"=",
"state",
".",
"stackIdx",
"++",
";",
"Scope",
"scope... | Add the scope of a mixin to the stack.
@param mixin the mixin
@param parameters the calling parameters
@param variables the variables of the mixin | [
"Add",
"the",
"scope",
"of",
"a",
"mixin",
"to",
"the",
"stack",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L407-L420 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.removeMixin | void removeMixin() {
int idx = state.stackIdx - 1;
Scope current = state.stack.get( idx );
if( idx > 0 ) {
Scope previous = state.stack.get( idx - 1 );
Map<String, Expression> currentReturn = previous.returns;
Map<String, Expression> vars = current.variables;
... | java | void removeMixin() {
int idx = state.stackIdx - 1;
Scope current = state.stack.get( idx );
if( idx > 0 ) {
Scope previous = state.stack.get( idx - 1 );
Map<String, Expression> currentReturn = previous.returns;
Map<String, Expression> vars = current.variables;
... | [
"void",
"removeMixin",
"(",
")",
"{",
"int",
"idx",
"=",
"state",
".",
"stackIdx",
"-",
"1",
";",
"Scope",
"current",
"=",
"state",
".",
"stack",
".",
"get",
"(",
"idx",
")",
";",
"if",
"(",
"idx",
">",
"0",
")",
"{",
"Scope",
"previous",
"=",
... | Remove the scope of a mixin. | [
"Remove",
"the",
"scope",
"of",
"a",
"mixin",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L425-L450 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.addGuardParameters | void addGuardParameters( Map<String, Expression> parameters, boolean isDefault ) {
isGuard = true;
wasDefaultFunction = false;
guardDefault = isDefault;
if( parameters != null ) {
addMixin( null, parameters, null );
}
} | java | void addGuardParameters( Map<String, Expression> parameters, boolean isDefault ) {
isGuard = true;
wasDefaultFunction = false;
guardDefault = isDefault;
if( parameters != null ) {
addMixin( null, parameters, null );
}
} | [
"void",
"addGuardParameters",
"(",
"Map",
"<",
"String",
",",
"Expression",
">",
"parameters",
",",
"boolean",
"isDefault",
")",
"{",
"isGuard",
"=",
"true",
";",
"wasDefaultFunction",
"=",
"false",
";",
"guardDefault",
"=",
"isDefault",
";",
"if",
"(",
"par... | Add the parameters of a guard
@param parameters the parameters
@param isDefault if the default case will be evaluated, in this case the expression "default" in guard is true. | [
"Add",
"the",
"parameters",
"of",
"a",
"guard"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L478-L485 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.removeGuardParameters | void removeGuardParameters( Map<String, Expression> parameters ) {
if( parameters != null ) {
removeMixin();
}
isGuard = false;
} | java | void removeGuardParameters( Map<String, Expression> parameters ) {
if( parameters != null ) {
removeMixin();
}
isGuard = false;
} | [
"void",
"removeGuardParameters",
"(",
"Map",
"<",
"String",
",",
"Expression",
">",
"parameters",
")",
"{",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"removeMixin",
"(",
")",
";",
"}",
"isGuard",
"=",
"false",
";",
"}"
] | remove the parameters of a guard
@param parameters the parameters | [
"remove",
"the",
"parameters",
"of",
"a",
"guard"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L491-L496 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.containsRule | boolean containsRule( Rule rule ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
if( rule == state.stack.get( i ).mixin ) {
return true;
}
}
return false;
} | java | boolean containsRule( Rule rule ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
if( rule == state.stack.get( i ).mixin ) {
return true;
}
}
return false;
} | [
"boolean",
"containsRule",
"(",
"Rule",
"rule",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"state",
".",
"stackIdx",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"rule",
"==",
"state",
".",
"stack",
".",
"get",
"(",
"i",
")... | A mixin inline never it self.
@param rule the rule
@return true, if the mixin is currently formatting | [
"A",
"mixin",
"inline",
"never",
"it",
"self",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L532-L539 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.getMixin | List<Rule> getMixin( String name ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
Rule mixin = state.stack.get( i ).mixin;
if( mixin != null ) {
List<Rule> rules = mixin.getMixin( name );
if( rules != null ) {
for( int r = 0; r < ru... | java | List<Rule> getMixin( String name ) {
for( int i = state.stackIdx - 1; i >= 0; i-- ) {
Rule mixin = state.stack.get( i ).mixin;
if( mixin != null ) {
List<Rule> rules = mixin.getMixin( name );
if( rules != null ) {
for( int r = 0; r < ru... | [
"List",
"<",
"Rule",
">",
"getMixin",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"state",
".",
"stackIdx",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Rule",
"mixin",
"=",
"state",
".",
"stack",
".",
"get",
"(... | Get a nested mixin of a parent rule.
@param name
the name of the mixin
@return the mixin or null | [
"Get",
"a",
"nested",
"mixin",
"of",
"a",
"parent",
"rule",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L548-L563 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.getOutput | StringBuilder getOutput() {
if( output == null ) {
CssFormatter block = copy( null );
state.results.add( new CssPlainOutput( block.output ) );
output = block.output;
}
return output;
} | java | StringBuilder getOutput() {
if( output == null ) {
CssFormatter block = copy( null );
state.results.add( new CssPlainOutput( block.output ) );
output = block.output;
}
return output;
} | [
"StringBuilder",
"getOutput",
"(",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"CssFormatter",
"block",
"=",
"copy",
"(",
"null",
")",
";",
"state",
".",
"results",
".",
"add",
"(",
"new",
"CssPlainOutput",
"(",
"block",
".",
"output",
")",
... | Get the current output of the formatter.
@return the output. | [
"Get",
"the",
"current",
"output",
"of",
"the",
"formatter",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L578-L585 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.append | CssFormatter append( String str ) {
if( inlineMode ) {
str = UrlUtils.removeQuote( str );
}
output.append( str );
return this;
} | java | CssFormatter append( String str ) {
if( inlineMode ) {
str = UrlUtils.removeQuote( str );
}
output.append( str );
return this;
} | [
"CssFormatter",
"append",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"inlineMode",
")",
"{",
"str",
"=",
"UrlUtils",
".",
"removeQuote",
"(",
"str",
")",
";",
"}",
"output",
".",
"append",
"(",
"str",
")",
";",
"return",
"this",
";",
"}"
] | Append a string to the output. In inline mode quotes are removed.
@param str the string
@return this | [
"Append",
"a",
"string",
"to",
"the",
"output",
".",
"In",
"inline",
"mode",
"quotes",
"are",
"removed",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L610-L616 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.appendHex | void appendHex( int value, int digits ) {
if( digits > 1 ) {
appendHex( value >>> 4, digits-1 );
}
output.append( DIGITS[ value & 0xF ] );
} | java | void appendHex( int value, int digits ) {
if( digits > 1 ) {
appendHex( value >>> 4, digits-1 );
}
output.append( DIGITS[ value & 0xF ] );
} | [
"void",
"appendHex",
"(",
"int",
"value",
",",
"int",
"digits",
")",
"{",
"if",
"(",
"digits",
">",
"1",
")",
"{",
"appendHex",
"(",
"value",
">>>",
"4",
",",
"digits",
"-",
"1",
")",
";",
"}",
"output",
".",
"append",
"(",
"DIGITS",
"[",
"value"... | Append an hex value to the output.
@param value the value
@param digits the digits to write. | [
"Append",
"an",
"hex",
"value",
"to",
"the",
"output",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L641-L646 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.append | CssFormatter append( double value ) {
if( value == (int)value ) {
output.append( Integer.toString( (int)value ) );
} else {
output.append( decFormat.format( value ) );
}
return this;
} | java | CssFormatter append( double value ) {
if( value == (int)value ) {
output.append( Integer.toString( (int)value ) );
} else {
output.append( decFormat.format( value ) );
}
return this;
} | [
"CssFormatter",
"append",
"(",
"double",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"(",
"int",
")",
"value",
")",
"{",
"output",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"(",
"int",
")",
"value",
")",
")",
";",
"}",
"else",
"{",
"o... | Append a decimal number to the output.
@param value the number
@return a reference to this object | [
"Append",
"a",
"decimal",
"number",
"to",
"the",
"output",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L665-L672 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.startBlock | CssFormatter startBlock( String[] selectors ) {
final List<CssOutput> results = state.results;
if( blockDeep == 0 ) {
output = null;
CssOutput nextOutput = null;
if( results.size() > 0 && !"@font-face".equals( selectors[0] ) ) {
CssOutput cssOutput = r... | java | CssFormatter startBlock( String[] selectors ) {
final List<CssOutput> results = state.results;
if( blockDeep == 0 ) {
output = null;
CssOutput nextOutput = null;
if( results.size() > 0 && !"@font-face".equals( selectors[0] ) ) {
CssOutput cssOutput = r... | [
"CssFormatter",
"startBlock",
"(",
"String",
"[",
"]",
"selectors",
")",
"{",
"final",
"List",
"<",
"CssOutput",
">",
"results",
"=",
"state",
".",
"results",
";",
"if",
"(",
"blockDeep",
"==",
"0",
")",
"{",
"output",
"=",
"null",
";",
"CssOutput",
"n... | Start a new block with a list of selectors.
@param selectors the selectors
@return this | [
"Start",
"a",
"new",
"block",
"with",
"a",
"list",
"of",
"selectors",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L706-L759 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.startBlockImpl | void startBlockImpl( String[] selectors ) {
for( int i=0; i<selectors.length; i++ ) {
if( i > 0 ) {
output.append( ',' );
newline();
}
insets();
append( selectors[i] );
}
space();
output.append( '{' );
... | java | void startBlockImpl( String[] selectors ) {
for( int i=0; i<selectors.length; i++ ) {
if( i > 0 ) {
output.append( ',' );
newline();
}
insets();
append( selectors[i] );
}
space();
output.append( '{' );
... | [
"void",
"startBlockImpl",
"(",
"String",
"[",
"]",
"selectors",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"selectors",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"output",
".",
"append",
"(",
... | Output a new block and increment the insets.
@param selectors the selectors of the block. | [
"Output",
"a",
"new",
"block",
"and",
"increment",
"the",
"insets",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L766-L779 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.endBlock | CssFormatter endBlock() {
blockDeep--;
if( blockDeep == 0 ) {
state.pool.free( insets );
insets = null;
inlineMode = false;
} else {
if( blockDeep == 1 && currentOutput.getClass() == CssMediaOutput.class ) {
state.pool.free( insets ... | java | CssFormatter endBlock() {
blockDeep--;
if( blockDeep == 0 ) {
state.pool.free( insets );
insets = null;
inlineMode = false;
} else {
if( blockDeep == 1 && currentOutput.getClass() == CssMediaOutput.class ) {
state.pool.free( insets ... | [
"CssFormatter",
"endBlock",
"(",
")",
"{",
"blockDeep",
"--",
";",
"if",
"(",
"blockDeep",
"==",
"0",
")",
"{",
"state",
".",
"pool",
".",
"free",
"(",
"insets",
")",
";",
"insets",
"=",
"null",
";",
"inlineMode",
"=",
"false",
";",
"}",
"else",
"{... | Terminate a CSS block.
@return a reference to this object | [
"Terminate",
"a",
"CSS",
"block",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L786-L802 | train |
i-net-software/jlessc | src/com/inet/lib/less/CssFormatter.java | CssFormatter.comment | CssFormatter comment( String msg ) {
getOutput().append( insets ).append( msg ).append( '\n' );
return this;
} | java | CssFormatter comment( String msg ) {
getOutput().append( insets ).append( msg ).append( '\n' );
return this;
} | [
"CssFormatter",
"comment",
"(",
"String",
"msg",
")",
"{",
"getOutput",
"(",
")",
".",
"append",
"(",
"insets",
")",
".",
"append",
"(",
"msg",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"this",
";",
"}"
] | Write a comment. The compress formatter do nothing.
@param msg the comment including the comment markers
@return a reference to this object | [
"Write",
"a",
"comment",
".",
"The",
"compress",
"formatter",
"do",
"nothing",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L893-L896 | train |
i-net-software/jlessc | src/com/inet/lib/less/LessLookAheadReader.java | LessLookAheadReader.read | char read() {
try {
if( cachePos < cache.length() ) {
return incLineColumn( cache.charAt( cachePos++ ) );
}
int ch = readCharBlockMarker();
if( ch == -1 ) {
throw createException( "Unexpected end of Less data" );
}
... | java | char read() {
try {
if( cachePos < cache.length() ) {
return incLineColumn( cache.charAt( cachePos++ ) );
}
int ch = readCharBlockMarker();
if( ch == -1 ) {
throw createException( "Unexpected end of Less data" );
}
... | [
"char",
"read",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"cachePos",
"<",
"cache",
".",
"length",
"(",
")",
")",
"{",
"return",
"incLineColumn",
"(",
"cache",
".",
"charAt",
"(",
"cachePos",
"++",
")",
")",
";",
"}",
"int",
"ch",
"=",
"readCharBlockMa... | Read a single character from reader or from back buffer
@return a character or -1 if EOF
@throws LessException
If an I/O error occurs | [
"Read",
"a",
"single",
"character",
"from",
"reader",
"or",
"from",
"back",
"buffer"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessLookAheadReader.java#L299-L312 | train |
i-net-software/jlessc | src/com/inet/lib/less/LessLookAheadReader.java | LessLookAheadReader.skipLine | void skipLine() {
int ch;
do {
try {
ch = reader.read();
} catch( IOException ex ) {
throw new LessException( ex );
}
incLineColumn( ch );
} while( ch != '\n' && ch != -1 );
} | java | void skipLine() {
int ch;
do {
try {
ch = reader.read();
} catch( IOException ex ) {
throw new LessException( ex );
}
incLineColumn( ch );
} while( ch != '\n' && ch != -1 );
} | [
"void",
"skipLine",
"(",
")",
"{",
"int",
"ch",
";",
"do",
"{",
"try",
"{",
"ch",
"=",
"reader",
".",
"read",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"LessException",
"(",
"ex",
")",
";",
"}",
"incLineColu... | Skip all data until a newline occur or an EOF
@throws LessException if an IO error occur | [
"Skip",
"all",
"data",
"until",
"a",
"newline",
"occur",
"or",
"an",
"EOF"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessLookAheadReader.java#L331-L341 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.toHSL | static HSL toHSL( double color ) {
long argb = Double.doubleToRawLongBits( color );
double a = alpha( color );
double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 );
double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 );
double b = clamp( ((argb >> 0) & 0xFFFF) / (d... | java | static HSL toHSL( double color ) {
long argb = Double.doubleToRawLongBits( color );
double a = alpha( color );
double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 );
double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 );
double b = clamp( ((argb >> 0) & 0xFFFF) / (d... | [
"static",
"HSL",
"toHSL",
"(",
"double",
"color",
")",
"{",
"long",
"argb",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color",
")",
";",
"double",
"a",
"=",
"alpha",
"(",
"color",
")",
";",
"double",
"r",
"=",
"clamp",
"(",
"(",
"(",
"argb",
... | Create a HSL color.
@param color argb color
@return the HSL | [
"Create",
"a",
"HSL",
"color",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L51-L77 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.rgba | static double rgba( double r, double g, double b, double a ) {
return Double.longBitsToDouble( Math.round( a * 0xFFFF ) << 48 | (colorLargeDigit(r) << 32) | (colorLargeDigit(g) << 16) | colorLargeDigit(b) );
} | java | static double rgba( double r, double g, double b, double a ) {
return Double.longBitsToDouble( Math.round( a * 0xFFFF ) << 48 | (colorLargeDigit(r) << 32) | (colorLargeDigit(g) << 16) | colorLargeDigit(b) );
} | [
"static",
"double",
"rgba",
"(",
"double",
"r",
",",
"double",
"g",
",",
"double",
"b",
",",
"double",
"a",
")",
"{",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"Math",
".",
"round",
"(",
"a",
"*",
"0xFFFF",
")",
"<<",
"48",
"|",
"(",
"color... | Create a color from rgba values
@param r red in range of 0 to 255.0
@param g green in range of 0 to 255.0
@param b blue in range of 0 to 255.0
@param a alpha in range of 0.0 to 1.0
@return color value as long | [
"Create",
"a",
"color",
"from",
"rgba",
"values"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L98-L100 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.rgb | static double rgb( int r, int g, int b ) {
return Double.longBitsToDouble( Expression.ALPHA_1 | (colorLargeDigit(r) << 32) | (colorLargeDigit(g) << 16) | colorLargeDigit(b) );
} | java | static double rgb( int r, int g, int b ) {
return Double.longBitsToDouble( Expression.ALPHA_1 | (colorLargeDigit(r) << 32) | (colorLargeDigit(g) << 16) | colorLargeDigit(b) );
} | [
"static",
"double",
"rgb",
"(",
"int",
"r",
",",
"int",
"g",
",",
"int",
"b",
")",
"{",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"Expression",
".",
"ALPHA_1",
"|",
"(",
"colorLargeDigit",
"(",
"r",
")",
"<<",
"32",
")",
"|",
"(",
"colorLarge... | Create an color value.
@param r
red in range from 0 to 255
@param g
green in range from 0 to 255
@param b
blue in range from 0 to 255
@return color value as long | [
"Create",
"an",
"color",
"value",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L130-L132 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.argb | static int argb( double color ) {
long value = Double.doubleToRawLongBits( color );
int result = colorDigit( ((value >>> 48)) / 256.0 ) << 24;
result |= colorDigit( ((value >> 32) & 0xFFFF) / 256.0 ) << 16;
result |= colorDigit( ((value >> 16) & 0xFFFF) / 256.0 ) << 8;
result |... | java | static int argb( double color ) {
long value = Double.doubleToRawLongBits( color );
int result = colorDigit( ((value >>> 48)) / 256.0 ) << 24;
result |= colorDigit( ((value >> 32) & 0xFFFF) / 256.0 ) << 16;
result |= colorDigit( ((value >> 16) & 0xFFFF) / 256.0 ) << 8;
result |... | [
"static",
"int",
"argb",
"(",
"double",
"color",
")",
"{",
"long",
"value",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color",
")",
";",
"int",
"result",
"=",
"colorDigit",
"(",
"(",
"(",
"value",
">>>",
"48",
")",
")",
"/",
"256.0",
")",
"<<",... | Convert an color value as long into integer color value
@param color
color value as long
@return color value as int | [
"Convert",
"an",
"color",
"value",
"as",
"long",
"into",
"integer",
"color",
"value"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L141-L148 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.hslaHue | private static double hslaHue(double h, double m1, double m2) {
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
else if (h * 2 < 1) { return m2; }
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2F/3 - h) * 6; }
else {... | java | private static double hslaHue(double h, double m1, double m2) {
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
else if (h * 2 < 1) { return m2; }
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2F/3 - h) * 6; }
else {... | [
"private",
"static",
"double",
"hslaHue",
"(",
"double",
"h",
",",
"double",
"m1",
",",
"double",
"m2",
")",
"{",
"h",
"=",
"h",
"<",
"0",
"?",
"h",
"+",
"1",
":",
"(",
"h",
">",
"1",
"?",
"h",
"-",
"1",
":",
"h",
")",
";",
"if",
"(",
"h"... | Calculate a single color channel of the HSLA function
@param h hue value
@param m1 value 1 in range of 0.0 to 1.0
@param m2 value 2 in range of 0.0 to 1.0
@return channel value in range of 0.0 to 1.0 | [
"Calculate",
"a",
"single",
"color",
"channel",
"of",
"the",
"HSLA",
"function"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L202-L208 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.luminance | static double luminance( double color ) {
long argb = Double.doubleToRawLongBits( color );
double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
double b = ((argb) & 0xFFFF) / (double)0xFF00;
return (0.2126 * r) + (0.7152 * g) +... | java | static double luminance( double color ) {
long argb = Double.doubleToRawLongBits( color );
double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
double b = ((argb) & 0xFFFF) / (double)0xFF00;
return (0.2126 * r) + (0.7152 * g) +... | [
"static",
"double",
"luminance",
"(",
"double",
"color",
")",
"{",
"long",
"argb",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color",
")",
";",
"double",
"r",
"=",
"(",
"(",
"argb",
">>",
"32",
")",
"&",
"0xFFFF",
")",
"/",
"(",
"double",
")",
... | The less function "luminance".
@param color
a color value as long
@return a value in the range from 0.0 to 1.0 | [
"The",
"less",
"function",
"luminance",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L255-L261 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.luma | static double luma( double color ) {
long argb = Double.doubleToRawLongBits( color );
double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
double b = ((argb) & 0xFFFF) / (double)0xFF00;
r = (r <= 0.03928) ? r / 12.92 : Math.po... | java | static double luma( double color ) {
long argb = Double.doubleToRawLongBits( color );
double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
double b = ((argb) & 0xFFFF) / (double)0xFF00;
r = (r <= 0.03928) ? r / 12.92 : Math.po... | [
"static",
"double",
"luma",
"(",
"double",
"color",
")",
"{",
"long",
"argb",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color",
")",
";",
"double",
"r",
"=",
"(",
"(",
"argb",
">>",
"32",
")",
"&",
"0xFFFF",
")",
"/",
"(",
"double",
")",
"0x... | The less function "luma".
@param color
a color value as long
@return a value in the range from 0.0 to 1.0 | [
"The",
"less",
"function",
"luma",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L270-L281 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.contrast | static double contrast( double color, double dark, double light, double threshold ) {
//Figure out which is actually light and dark!
if( luma( dark ) > luma( light ) ) {
double t = light;
light = dark;
dark = t;
}
if( luma( color ) < threshold ) {
... | java | static double contrast( double color, double dark, double light, double threshold ) {
//Figure out which is actually light and dark!
if( luma( dark ) > luma( light ) ) {
double t = light;
light = dark;
dark = t;
}
if( luma( color ) < threshold ) {
... | [
"static",
"double",
"contrast",
"(",
"double",
"color",
",",
"double",
"dark",
",",
"double",
"light",
",",
"double",
"threshold",
")",
"{",
"//Figure out which is actually light and dark!",
"if",
"(",
"luma",
"(",
"dark",
")",
">",
"luma",
"(",
"light",
")",
... | The less function "contrast".
@param color
a color value as long
@param dark
a designated dark color
@param light
a designated light color
@param threshold
percentage 0-100% specifying where the transition from "dark" to "light" is
@return a color value as long | [
"The",
"less",
"function",
"contrast",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L296-L308 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.toHSV | static HSV toHSV( double color ) {
long argb = Double.doubleToRawLongBits( color );
double a = alpha( color );
double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 );
double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 );
double b = clamp( ((argb >> 0) & 0xFFFF) / (d... | java | static HSV toHSV( double color ) {
long argb = Double.doubleToRawLongBits( color );
double a = alpha( color );
double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 );
double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 );
double b = clamp( ((argb >> 0) & 0xFFFF) / (d... | [
"static",
"HSV",
"toHSV",
"(",
"double",
"color",
")",
"{",
"long",
"argb",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color",
")",
";",
"double",
"a",
"=",
"alpha",
"(",
"color",
")",
";",
"double",
"r",
"=",
"clamp",
"(",
"(",
"(",
"argb",
... | Create a HSV color.
@param color argb color
@return the HSL | [
"Create",
"a",
"HSV",
"color",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L315-L344 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.mix | static double mix( double color1, double color2, double weight ) {
long col1 = Double.doubleToRawLongBits( color1 );
long col2 = Double.doubleToRawLongBits( color2 );
int alpha1 = (int)(col1 >>> 48);
int red1 = (int)(col1 >> 32) & 0xFFFF;
int green1 = (int)(col1 >> 16) & 0xFF... | java | static double mix( double color1, double color2, double weight ) {
long col1 = Double.doubleToRawLongBits( color1 );
long col2 = Double.doubleToRawLongBits( color2 );
int alpha1 = (int)(col1 >>> 48);
int red1 = (int)(col1 >> 32) & 0xFFFF;
int green1 = (int)(col1 >> 16) & 0xFF... | [
"static",
"double",
"mix",
"(",
"double",
"color1",
",",
"double",
"color2",
",",
"double",
"weight",
")",
"{",
"long",
"col1",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color1",
")",
";",
"long",
"col2",
"=",
"Double",
".",
"doubleToRawLongBits",
"... | Calculate the mix color of 2 colors.
@param color1
first color
@param color2
second color
@param weight
balance point between the two colors in range of 0 to 1.
@return the resulting color | [
"Calculate",
"the",
"mix",
"color",
"of",
"2",
"colors",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L388-L415 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.colorBlending | private static double colorBlending( double color1, double color2, int op ) {
long argb1 = Double.doubleToRawLongBits( color1 );
long r1 = ((argb1 >> 32) & 0xFFFF);
long g1 = ((argb1 >> 16) & 0xFFFF);
long b1 = ((argb1) & 0xFFFF);
long argb2 = Double.doubleToRawLongBits( color2 ... | java | private static double colorBlending( double color1, double color2, int op ) {
long argb1 = Double.doubleToRawLongBits( color1 );
long r1 = ((argb1 >> 32) & 0xFFFF);
long g1 = ((argb1 >> 16) & 0xFFFF);
long b1 = ((argb1) & 0xFFFF);
long argb2 = Double.doubleToRawLongBits( color2 ... | [
"private",
"static",
"double",
"colorBlending",
"(",
"double",
"color1",
",",
"double",
"color2",
",",
"int",
"op",
")",
"{",
"long",
"argb1",
"=",
"Double",
".",
"doubleToRawLongBits",
"(",
"color1",
")",
";",
"long",
"r1",
"=",
"(",
"(",
"argb1",
">>",... | Color blending operation
@param color1 left color
@param color2 right color
@param op blending operation
@return argb color value | [
"Color",
"blending",
"operation"
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L524-L541 | train |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.colorBlendingDigit | private static long colorBlendingDigit( long longDigit1, long longDigit2, int op ) {
switch( op ) {
case MULTIPLY:
return longDigit1 * longDigit2 / 0xFF00;
case SCREEN:
return longDigit1 + longDigit2 - longDigit1 * longDigit2 / 0xFF00;
case OVE... | java | private static long colorBlendingDigit( long longDigit1, long longDigit2, int op ) {
switch( op ) {
case MULTIPLY:
return longDigit1 * longDigit2 / 0xFF00;
case SCREEN:
return longDigit1 + longDigit2 - longDigit1 * longDigit2 / 0xFF00;
case OVE... | [
"private",
"static",
"long",
"colorBlendingDigit",
"(",
"long",
"longDigit1",
",",
"long",
"longDigit2",
",",
"int",
"op",
")",
"{",
"switch",
"(",
"op",
")",
"{",
"case",
"MULTIPLY",
":",
"return",
"longDigit1",
"*",
"longDigit2",
"/",
"0xFF00",
";",
"cas... | Color blending operation for a single color channel.
@param longDigit1 left digit
@param longDigit2 right digit
@param op blending operation
@return resulting color digit
@throws IllegalArgumentException if the operation is unknown | [
"Color",
"blending",
"operation",
"for",
"a",
"single",
"color",
"channel",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L552-L586 | train |
i-net-software/jlessc | src/com/inet/lib/less/LessExtendMap.java | LessExtendMap.add | void add( LessExtend lessExtend, String[] mainSelector ) {
if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) {
mainSelector = lessExtend.getSelectors();
} else {
mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() );
}
St... | java | void add( LessExtend lessExtend, String[] mainSelector ) {
if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) {
mainSelector = lessExtend.getSelectors();
} else {
mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() );
}
St... | [
"void",
"add",
"(",
"LessExtend",
"lessExtend",
",",
"String",
"[",
"]",
"mainSelector",
")",
"{",
"if",
"(",
"mainSelector",
"==",
"null",
"||",
"mainSelector",
"[",
"0",
"]",
".",
"startsWith",
"(",
"\"@media\"",
")",
")",
"{",
"mainSelector",
"=",
"le... | Is calling on formatting if an extends was include.
@param lessExtend the extend
@param mainSelector the selectors in which the extend is placed. | [
"Is",
"calling",
"on",
"formatting",
"if",
"an",
"extends",
"was",
"include",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessExtendMap.java#L79-L100 | train |
i-net-software/jlessc | src/com/inet/lib/less/LessExtendMap.java | LessExtendMap.concatenateExtends | String[] concatenateExtends( String[] selectors, boolean isReference ) {
selectorList.clear();
for( String selector : selectors ) {
concatenateExtendsRecursive( selector, isReference, selector );
}
if( isReference ) {
return selectorList.toArray( new String[selec... | java | String[] concatenateExtends( String[] selectors, boolean isReference ) {
selectorList.clear();
for( String selector : selectors ) {
concatenateExtendsRecursive( selector, isReference, selector );
}
if( isReference ) {
return selectorList.toArray( new String[selec... | [
"String",
"[",
"]",
"concatenateExtends",
"(",
"String",
"[",
"]",
"selectors",
",",
"boolean",
"isReference",
")",
"{",
"selectorList",
".",
"clear",
"(",
")",
";",
"for",
"(",
"String",
"selector",
":",
"selectors",
")",
"{",
"concatenateExtendsRecursive",
... | Add to the given selectors all possible extends and return the resulting selectors.
@param selectors
current selectors
@param isReference
if the current rule is in a less file which was import with "reference" keyword
@return the selectors concatenate with extends or the original if there are no etends. | [
"Add",
"to",
"the",
"given",
"selectors",
"all",
"possible",
"extends",
"and",
"return",
"the",
"resulting",
"selectors",
"."
] | 15b13e1637f6cc2e4d72df021e23ee0ca8d5e629 | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessExtendMap.java#L111-L134 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.