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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
javactic/javactic | src/main/java/com/github/javactic/Bad.java | Bad.of | public static <G, B> Bad<G, B> of(B value) {
return new Bad<>(value);
} | java | public static <G, B> Bad<G, B> of(B value) {
return new Bad<>(value);
} | [
"public",
"static",
"<",
"G",
",",
"B",
">",
"Bad",
"<",
"G",
",",
"B",
">",
"of",
"(",
"B",
"value",
")",
"{",
"return",
"new",
"Bad",
"<>",
"(",
"value",
")",
";",
"}"
] | Creates a Bad of type B.
@param <G> the success type of the Or
@param <B> the failure type of the Or
@param value the value of the Bad
@return an instance of Bad | [
"Creates",
"a",
"Bad",
"of",
"type",
"B",
"."
] | dfa040062178c259c3067fd9b59cb4498022d8bc | https://github.com/javactic/javactic/blob/dfa040062178c259c3067fd9b59cb4498022d8bc/src/main/java/com/github/javactic/Bad.java#L63-L65 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRSigner.java | LRSigner.sign | public LREnvelope sign(LREnvelope envelope) throws LRException
{
// Bencode the document
String bencodedMessage = bencode(envelope.getSignableData());
// Clear sign the bencoded document
String clearSignedMessage = signEnvelopeData(bencodedMessage);
envelope.addSigningData(signingMethod, publicKeyLocation, clearSignedMessage);
return envelope;
} | java | public LREnvelope sign(LREnvelope envelope) throws LRException
{
// Bencode the document
String bencodedMessage = bencode(envelope.getSignableData());
// Clear sign the bencoded document
String clearSignedMessage = signEnvelopeData(bencodedMessage);
envelope.addSigningData(signingMethod, publicKeyLocation, clearSignedMessage);
return envelope;
} | [
"public",
"LREnvelope",
"sign",
"(",
"LREnvelope",
"envelope",
")",
"throws",
"LRException",
"{",
"// Bencode the document",
"String",
"bencodedMessage",
"=",
"bencode",
"(",
"envelope",
".",
"getSignableData",
"(",
")",
")",
";",
"// Clear sign the bencoded document",
... | Sign the specified envelope with this signer
@param envelope envelope to be signed
@return signed envelope
@throws LRException | [
"Sign",
"the",
"specified",
"envelope",
"with",
"this",
"signer"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRSigner.java#L92-L103 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRSigner.java | LRSigner.normalizeList | private List<Object> normalizeList(List<Object> list) {
List<Object> result = new ArrayList<Object>();
for (Object o : list) {
if (o == null) {
result.add(nullLiteral);
} else if (o instanceof Boolean) {
result.add(((Boolean) o).toString());
} else if (o instanceof List<?>) {
result.add(normalizeList((List<Object>) o));
} else if (o instanceof Map<?, ?>) {
result.add(normalizeMap((Map<String, Object>) o));
} else if (!(o instanceof Number)) {
result.add(o);
}
}
return result;
} | java | private List<Object> normalizeList(List<Object> list) {
List<Object> result = new ArrayList<Object>();
for (Object o : list) {
if (o == null) {
result.add(nullLiteral);
} else if (o instanceof Boolean) {
result.add(((Boolean) o).toString());
} else if (o instanceof List<?>) {
result.add(normalizeList((List<Object>) o));
} else if (o instanceof Map<?, ?>) {
result.add(normalizeMap((Map<String, Object>) o));
} else if (!(o instanceof Number)) {
result.add(o);
}
}
return result;
} | [
"private",
"List",
"<",
"Object",
">",
"normalizeList",
"(",
"List",
"<",
"Object",
">",
"list",
")",
"{",
"List",
"<",
"Object",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"list",
")"... | Helper for map normalization; inspects list and returns
a replacement list that has been normalized.
@param list
@return Normalized list for encoding/hashing/signing | [
"Helper",
"for",
"map",
"normalization",
";",
"inspects",
"list",
"and",
"returns",
"a",
"replacement",
"list",
"that",
"has",
"been",
"normalized",
"."
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRSigner.java#L182-L198 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRSigner.java | LRSigner.signEnvelopeData | private String signEnvelopeData(String message) throws LRException
{
// Throw an exception if any of the required fields are null
if (passPhrase == null || publicKeyLocation == null || privateKey == null)
{
throw new LRException(LRException.NULL_FIELD);
}
// Get an InputStream for the private key
InputStream privateKeyStream = getPrivateKeyStream(privateKey);
// Get an OutputStream for the result
ByteArrayOutputStream result = new ByteArrayOutputStream();
ArmoredOutputStream aOut = new ArmoredOutputStream(result);
// Get the pass phrase
char[] privateKeyPassword = passPhrase.toCharArray();
try
{
// Get the private key from the InputStream
PGPSecretKey sk = readSecretKey(privateKeyStream);
PGPPrivateKey pk = sk.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder().setProvider("BC").build(privateKeyPassword));
PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(sk.getPublicKey().getAlgorithm(), PGPUtil.SHA256).setProvider("BC"));
PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
// Clear sign the message
java.util.Iterator it = sk.getPublicKey().getUserIDs();
if (it.hasNext()) {
spGen.setSignerUserID(false, (String) it.next());
sGen.setHashedSubpackets(spGen.generate());
}
aOut.beginClearText(PGPUtil.SHA256);
sGen.init(PGPSignature.CANONICAL_TEXT_DOCUMENT, pk);
byte[] msg = message.getBytes();
sGen.update(msg,0,msg.length);
aOut.write(msg,0,msg.length);
BCPGOutputStream bOut = new BCPGOutputStream(aOut);
aOut.endClearText();
sGen.generate().encode(bOut);
aOut.close();
String strResult = result.toString("utf8");
// for whatever reason, bouncycastle is failing to put a linebreak before "-----BEGIN PGP SIGNATURE"
strResult = strResult.replaceAll("([a-z0-9])-----BEGIN PGP SIGNATURE-----", "$1\n-----BEGIN PGP SIGNATURE-----");
return strResult;
}
catch (Exception e)
{
throw new LRException(LRException.SIGNING_FAILED);
}
finally
{
try
{
if (privateKeyStream != null) {
privateKeyStream.close();
}
result.close();
}
catch (IOException e)
{
//Could not close the streams
}
}
} | java | private String signEnvelopeData(String message) throws LRException
{
// Throw an exception if any of the required fields are null
if (passPhrase == null || publicKeyLocation == null || privateKey == null)
{
throw new LRException(LRException.NULL_FIELD);
}
// Get an InputStream for the private key
InputStream privateKeyStream = getPrivateKeyStream(privateKey);
// Get an OutputStream for the result
ByteArrayOutputStream result = new ByteArrayOutputStream();
ArmoredOutputStream aOut = new ArmoredOutputStream(result);
// Get the pass phrase
char[] privateKeyPassword = passPhrase.toCharArray();
try
{
// Get the private key from the InputStream
PGPSecretKey sk = readSecretKey(privateKeyStream);
PGPPrivateKey pk = sk.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder().setProvider("BC").build(privateKeyPassword));
PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(sk.getPublicKey().getAlgorithm(), PGPUtil.SHA256).setProvider("BC"));
PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
// Clear sign the message
java.util.Iterator it = sk.getPublicKey().getUserIDs();
if (it.hasNext()) {
spGen.setSignerUserID(false, (String) it.next());
sGen.setHashedSubpackets(spGen.generate());
}
aOut.beginClearText(PGPUtil.SHA256);
sGen.init(PGPSignature.CANONICAL_TEXT_DOCUMENT, pk);
byte[] msg = message.getBytes();
sGen.update(msg,0,msg.length);
aOut.write(msg,0,msg.length);
BCPGOutputStream bOut = new BCPGOutputStream(aOut);
aOut.endClearText();
sGen.generate().encode(bOut);
aOut.close();
String strResult = result.toString("utf8");
// for whatever reason, bouncycastle is failing to put a linebreak before "-----BEGIN PGP SIGNATURE"
strResult = strResult.replaceAll("([a-z0-9])-----BEGIN PGP SIGNATURE-----", "$1\n-----BEGIN PGP SIGNATURE-----");
return strResult;
}
catch (Exception e)
{
throw new LRException(LRException.SIGNING_FAILED);
}
finally
{
try
{
if (privateKeyStream != null) {
privateKeyStream.close();
}
result.close();
}
catch (IOException e)
{
//Could not close the streams
}
}
} | [
"private",
"String",
"signEnvelopeData",
"(",
"String",
"message",
")",
"throws",
"LRException",
"{",
"// Throw an exception if any of the required fields are null",
"if",
"(",
"passPhrase",
"==",
"null",
"||",
"publicKeyLocation",
"==",
"null",
"||",
"privateKey",
"==",
... | Encodes the provided message with the private key and pass phrase set in configuration
@param message Message to encode
@return Encoded message
@throws LRException SIGNING_FAILED if the document cannot be signed, NO_KEY if the key cannot be obtained | [
"Encodes",
"the",
"provided",
"message",
"with",
"the",
"private",
"key",
"and",
"pass",
"phrase",
"set",
"in",
"configuration"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRSigner.java#L260-L328 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRSigner.java | LRSigner.readSecretKey | private PGPSecretKey readSecretKey(InputStream input) throws LRException
{
PGPSecretKeyRingCollection pgpSec;
try
{
pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input));
}
catch (Exception e)
{
throw new LRException(LRException.NO_KEY);
}
java.util.Iterator keyRingIter = pgpSec.getKeyRings();
while (keyRingIter.hasNext()) {
PGPSecretKeyRing keyRing = (PGPSecretKeyRing) keyRingIter.next();
java.util.Iterator keyIter = keyRing.getSecretKeys();
while (keyIter.hasNext()) {
PGPSecretKey key = (PGPSecretKey) keyIter.next();
if (key.isSigningKey()) {
return key;
}
}
}
throw new LRException(LRException.NO_KEY);
} | java | private PGPSecretKey readSecretKey(InputStream input) throws LRException
{
PGPSecretKeyRingCollection pgpSec;
try
{
pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input));
}
catch (Exception e)
{
throw new LRException(LRException.NO_KEY);
}
java.util.Iterator keyRingIter = pgpSec.getKeyRings();
while (keyRingIter.hasNext()) {
PGPSecretKeyRing keyRing = (PGPSecretKeyRing) keyRingIter.next();
java.util.Iterator keyIter = keyRing.getSecretKeys();
while (keyIter.hasNext()) {
PGPSecretKey key = (PGPSecretKey) keyIter.next();
if (key.isSigningKey()) {
return key;
}
}
}
throw new LRException(LRException.NO_KEY);
} | [
"private",
"PGPSecretKey",
"readSecretKey",
"(",
"InputStream",
"input",
")",
"throws",
"LRException",
"{",
"PGPSecretKeyRingCollection",
"pgpSec",
";",
"try",
"{",
"pgpSec",
"=",
"new",
"PGPSecretKeyRingCollection",
"(",
"PGPUtil",
".",
"getDecoderStream",
"(",
"inpu... | Reads private key from the provided InputStream
@param input InputStream of the private key
@return PGPSecretKey
@throws LRException NO_KEY error if the key cannot be obtained from the input stream | [
"Reads",
"private",
"key",
"from",
"the",
"provided",
"InputStream"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRSigner.java#L337-L365 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRSigner.java | LRSigner.getPrivateKeyStream | private InputStream getPrivateKeyStream(String privateKey) throws LRException
{
try
{
// If the private key matches the form of a private key string, treat it as such
if (privateKey.matches(pgpRegex))
{
return new ByteArrayInputStream(privateKey.getBytes());
}
// Otherwise, treat it as a file location on the local disk
else
{
return new FileInputStream(new File(privateKey));
}
}
catch (IOException e)
{
throw new LRException(LRException.NO_KEY_STREAM);
}
} | java | private InputStream getPrivateKeyStream(String privateKey) throws LRException
{
try
{
// If the private key matches the form of a private key string, treat it as such
if (privateKey.matches(pgpRegex))
{
return new ByteArrayInputStream(privateKey.getBytes());
}
// Otherwise, treat it as a file location on the local disk
else
{
return new FileInputStream(new File(privateKey));
}
}
catch (IOException e)
{
throw new LRException(LRException.NO_KEY_STREAM);
}
} | [
"private",
"InputStream",
"getPrivateKeyStream",
"(",
"String",
"privateKey",
")",
"throws",
"LRException",
"{",
"try",
"{",
"// If the private key matches the form of a private key string, treat it as such",
"if",
"(",
"privateKey",
".",
"matches",
"(",
"pgpRegex",
")",
")... | Converts the local location or text of a private key into an input stream
@param privateKey The local location or text of the private key for the digital signature
@return Private key stream
@throws LRException NO_KEY_STREAM if the private key cannot be turned into a stream | [
"Converts",
"the",
"local",
"location",
"or",
"text",
"of",
"a",
"private",
"key",
"into",
"an",
"input",
"stream"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRSigner.java#L374-L393 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/ReadableInput.java | ReadableInput.include | @Override
public void include(Readable in, String source) throws IOException
{
if (cursor != end)
{
release();
}
if (includeStack == null)
{
includeStack = new ArrayDeque<>();
}
includeStack.push(includeLevel);
includeLevel = new IncludeLevel(in, source);
} | java | @Override
public void include(Readable in, String source) throws IOException
{
if (cursor != end)
{
release();
}
if (includeStack == null)
{
includeStack = new ArrayDeque<>();
}
includeStack.push(includeLevel);
includeLevel = new IncludeLevel(in, source);
} | [
"@",
"Override",
"public",
"void",
"include",
"(",
"Readable",
"in",
",",
"String",
"source",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cursor",
"!=",
"end",
")",
"{",
"release",
"(",
")",
";",
"}",
"if",
"(",
"includeStack",
"==",
"null",
")",
... | Include Readable at current input. Readable is read as part of
input. When Readable ends, input continues using current input.
<p>Included reader is closed at eof
@param in
@param source
@throws IOException | [
"Include",
"Readable",
"at",
"current",
"input",
".",
"Readable",
"is",
"read",
"as",
"part",
"of",
"input",
".",
"When",
"Readable",
"ends",
"input",
"continues",
"using",
"current",
"input",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/ReadableInput.java#L165-L178 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/index/IndexDefinition.java | IndexDefinition.getChildTypes | private static Set<Type> getChildTypes(final Type _type)
throws CacheReloadException
{
final Set<Type> ret = new HashSet<Type>();
ret.add(_type);
for (final Type child : _type.getChildTypes()) {
ret.addAll(getChildTypes(child));
}
return ret;
} | java | private static Set<Type> getChildTypes(final Type _type)
throws CacheReloadException
{
final Set<Type> ret = new HashSet<Type>();
ret.add(_type);
for (final Type child : _type.getChildTypes()) {
ret.addAll(getChildTypes(child));
}
return ret;
} | [
"private",
"static",
"Set",
"<",
"Type",
">",
"getChildTypes",
"(",
"final",
"Type",
"_type",
")",
"throws",
"CacheReloadException",
"{",
"final",
"Set",
"<",
"Type",
">",
"ret",
"=",
"new",
"HashSet",
"<",
"Type",
">",
"(",
")",
";",
"ret",
".",
"add"... | Gets the type list.
@param _type the type
@return the type list
@throws CacheReloadException the cache reload exception | [
"Gets",
"the",
"type",
"list",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/IndexDefinition.java#L292-L301 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/wrapper/SQLWhere.java | SQLWhere.addCriteria | public Criteria addCriteria(final int _idx, final List<String> _sqlColNames, final Comparison _comparison,
final Set<String> _values, final boolean _escape, final Connection _connection)
{
final Criteria criteria = new Criteria()
.tableIndex(_idx)
.colNames(_sqlColNames)
.comparison(_comparison)
.values(_values)
.escape(_escape)
.connection(_connection);
sections.add(criteria);
return criteria;
} | java | public Criteria addCriteria(final int _idx, final List<String> _sqlColNames, final Comparison _comparison,
final Set<String> _values, final boolean _escape, final Connection _connection)
{
final Criteria criteria = new Criteria()
.tableIndex(_idx)
.colNames(_sqlColNames)
.comparison(_comparison)
.values(_values)
.escape(_escape)
.connection(_connection);
sections.add(criteria);
return criteria;
} | [
"public",
"Criteria",
"addCriteria",
"(",
"final",
"int",
"_idx",
",",
"final",
"List",
"<",
"String",
">",
"_sqlColNames",
",",
"final",
"Comparison",
"_comparison",
",",
"final",
"Set",
"<",
"String",
">",
"_values",
",",
"final",
"boolean",
"_escape",
","... | Adds the criteria.
@param _idx the idx
@param _sqlColNames the sql col names
@param _comparison the comparison
@param _values the values
@param _escape the escape | [
"Adds",
"the",
"criteria",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/wrapper/SQLWhere.java#L56-L68 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/wrapper/SQLWhere.java | SQLWhere.appendSQL | protected void appendSQL(final String _tablePrefix,
final StringBuilder _cmd)
{
if (sections.size() > 0) {
if (isStarted()) {
new SQLSelectPart(SQLPart.AND).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
} else {
new SQLSelectPart(SQLPart.WHERE).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
}
addSectionsSQL(_tablePrefix, _cmd, sections);
}
} | java | protected void appendSQL(final String _tablePrefix,
final StringBuilder _cmd)
{
if (sections.size() > 0) {
if (isStarted()) {
new SQLSelectPart(SQLPart.AND).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
} else {
new SQLSelectPart(SQLPart.WHERE).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
}
addSectionsSQL(_tablePrefix, _cmd, sections);
}
} | [
"protected",
"void",
"appendSQL",
"(",
"final",
"String",
"_tablePrefix",
",",
"final",
"StringBuilder",
"_cmd",
")",
"{",
"if",
"(",
"sections",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"new",
"SQLSelectPa... | Append SQL.
@param _tablePrefix the table prefix
@param _cmd the cmd | [
"Append",
"SQL",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/wrapper/SQLWhere.java#L114-L127 | train |
jvirtanen/config-extras | src/main/java/org/jvirtanen/config/Configs.java | Configs.getInetAddress | public static InetAddress getInetAddress(Config config, String path) {
try {
return InetAddress.getByName(config.getString(path));
} catch (UnknownHostException e) {
throw badValue(e, config, path);
}
} | java | public static InetAddress getInetAddress(Config config, String path) {
try {
return InetAddress.getByName(config.getString(path));
} catch (UnknownHostException e) {
throw badValue(e, config, path);
}
} | [
"public",
"static",
"InetAddress",
"getInetAddress",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"try",
"{",
"return",
"InetAddress",
".",
"getByName",
"(",
"config",
".",
"getString",
"(",
"path",
")",
")",
";",
"}",
"catch",
"(",
"UnknownHo... | Get an IP address. The configuration value can either be a hostname or
a literal IP address.
@param config a configuration object
@param path the path expression
@return an IP address
@throws ConfigException.Missing if the value is absent or null
@throws ConfigException.WrongType if the value is not convertible to
a string
@throws ConfigException.BadValue if the value cannot be translated into
an IP address | [
"Get",
"an",
"IP",
"address",
".",
"The",
"configuration",
"value",
"can",
"either",
"be",
"a",
"hostname",
"or",
"a",
"literal",
"IP",
"address",
"."
] | eba3cff680c302fe07625dc8046f0bd4a56b9fc3 | https://github.com/jvirtanen/config-extras/blob/eba3cff680c302fe07625dc8046f0bd4a56b9fc3/src/main/java/org/jvirtanen/config/Configs.java#L32-L38 | train |
jvirtanen/config-extras | src/main/java/org/jvirtanen/config/Configs.java | Configs.getNetworkInterface | public static NetworkInterface getNetworkInterface(Config config, String path) {
NetworkInterface value = getNetworkInterfaceByName(config, path);
if (value == null)
value = getNetworkInterfaceByInetAddress(config, path);
if (value == null)
throw badValue("No network interface for value '" + config.getString(path) + "'", config, path);
return value;
} | java | public static NetworkInterface getNetworkInterface(Config config, String path) {
NetworkInterface value = getNetworkInterfaceByName(config, path);
if (value == null)
value = getNetworkInterfaceByInetAddress(config, path);
if (value == null)
throw badValue("No network interface for value '" + config.getString(path) + "'", config, path);
return value;
} | [
"public",
"static",
"NetworkInterface",
"getNetworkInterface",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"NetworkInterface",
"value",
"=",
"getNetworkInterfaceByName",
"(",
"config",
",",
"path",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
... | Get a network interface. The network interface can be identified by its
name or its IP address.
@param config a configuration object
@param path the path expression
@return a network interface
@throws ConfigException.Missing if the value is absent or null
@throws ConfigException.WrongType if the value is not convertible to
a string
@throws ConfigException.BadValue if the value cannot be translated
into a network interface | [
"Get",
"a",
"network",
"interface",
".",
"The",
"network",
"interface",
"can",
"be",
"identified",
"by",
"its",
"name",
"or",
"its",
"IP",
"address",
"."
] | eba3cff680c302fe07625dc8046f0bd4a56b9fc3 | https://github.com/jvirtanen/config-extras/blob/eba3cff680c302fe07625dc8046f0bd4a56b9fc3/src/main/java/org/jvirtanen/config/Configs.java#L53-L62 | train |
jvirtanen/config-extras | src/main/java/org/jvirtanen/config/Configs.java | Configs.getPort | public static int getPort(Config config, String path) {
try {
return new InetSocketAddress(config.getInt(path)).getPort();
} catch (IllegalArgumentException e) {
throw badValue(e, config, path);
}
} | java | public static int getPort(Config config, String path) {
try {
return new InetSocketAddress(config.getInt(path)).getPort();
} catch (IllegalArgumentException e) {
throw badValue(e, config, path);
}
} | [
"public",
"static",
"int",
"getPort",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"try",
"{",
"return",
"new",
"InetSocketAddress",
"(",
"config",
".",
"getInt",
"(",
"path",
")",
")",
".",
"getPort",
"(",
")",
";",
"}",
"catch",
"(",
"... | Get a port number.
@param config a configuration object
@param path the path expression
@return a port number
@throws ConfigException.Missing if the value is absent or null
@throws ConfigException.WrongType if the value is not convertible to
an integer
@throws ConfigException.BadValue if the value is outside the port
number range | [
"Get",
"a",
"port",
"number",
"."
] | eba3cff680c302fe07625dc8046f0bd4a56b9fc3 | https://github.com/jvirtanen/config-extras/blob/eba3cff680c302fe07625dc8046f0bd4a56b9fc3/src/main/java/org/jvirtanen/config/Configs.java#L76-L82 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java | ModelAdapter.adaptEvents | public List<ChatMessageStatus> adaptEvents(List<DbOrphanedEvent> dbOrphanedEvents) {
List<ChatMessageStatus> statuses = new ArrayList<>();
Parser parser = new Parser();
for (DbOrphanedEvent event : dbOrphanedEvents) {
OrphanedEvent orphanedEvent = parser.parse(event.event(), OrphanedEvent.class);
statuses.add(ChatMessageStatus.builder().populate(orphanedEvent.getConversationId(), orphanedEvent.getMessageId(), orphanedEvent.getProfileId(),
orphanedEvent.isEventTypeRead() ? LocalMessageStatus.read : LocalMessageStatus.delivered,
DateHelper.getUTCMilliseconds(orphanedEvent.getTimestamp()), (long) orphanedEvent.getConversationEventId()).build());
}
return statuses;
} | java | public List<ChatMessageStatus> adaptEvents(List<DbOrphanedEvent> dbOrphanedEvents) {
List<ChatMessageStatus> statuses = new ArrayList<>();
Parser parser = new Parser();
for (DbOrphanedEvent event : dbOrphanedEvents) {
OrphanedEvent orphanedEvent = parser.parse(event.event(), OrphanedEvent.class);
statuses.add(ChatMessageStatus.builder().populate(orphanedEvent.getConversationId(), orphanedEvent.getMessageId(), orphanedEvent.getProfileId(),
orphanedEvent.isEventTypeRead() ? LocalMessageStatus.read : LocalMessageStatus.delivered,
DateHelper.getUTCMilliseconds(orphanedEvent.getTimestamp()), (long) orphanedEvent.getConversationEventId()).build());
}
return statuses;
} | [
"public",
"List",
"<",
"ChatMessageStatus",
">",
"adaptEvents",
"(",
"List",
"<",
"DbOrphanedEvent",
">",
"dbOrphanedEvents",
")",
"{",
"List",
"<",
"ChatMessageStatus",
">",
"statuses",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Parser",
"parser",
"=",
... | Translates Orphaned events to message statuses.
@param dbOrphanedEvents Orphaned events received when paging back message history.
@return Message statuses to be applied to appropriate messages. | [
"Translates",
"Orphaned",
"events",
"to",
"message",
"statuses",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java#L51-L64 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java | ModelAdapter.adaptMessages | public List<ChatMessage> adaptMessages(List<MessageReceived> messagesReceived) {
List<ChatMessage> chatMessages = new ArrayList<>();
if (messagesReceived != null) {
for (MessageReceived msg : messagesReceived) {
ChatMessage adaptedMessage = ChatMessage.builder().populate(msg).build();
List<ChatMessageStatus> adaptedStatuses = adaptStatuses(msg.getConversationId(), msg.getMessageId(), msg.getStatusUpdate());
for (ChatMessageStatus s : adaptedStatuses) {
adaptedMessage.addStatusUpdate(s);
}
chatMessages.add(adaptedMessage);
}
}
return chatMessages;
} | java | public List<ChatMessage> adaptMessages(List<MessageReceived> messagesReceived) {
List<ChatMessage> chatMessages = new ArrayList<>();
if (messagesReceived != null) {
for (MessageReceived msg : messagesReceived) {
ChatMessage adaptedMessage = ChatMessage.builder().populate(msg).build();
List<ChatMessageStatus> adaptedStatuses = adaptStatuses(msg.getConversationId(), msg.getMessageId(), msg.getStatusUpdate());
for (ChatMessageStatus s : adaptedStatuses) {
adaptedMessage.addStatusUpdate(s);
}
chatMessages.add(adaptedMessage);
}
}
return chatMessages;
} | [
"public",
"List",
"<",
"ChatMessage",
">",
"adaptMessages",
"(",
"List",
"<",
"MessageReceived",
">",
"messagesReceived",
")",
"{",
"List",
"<",
"ChatMessage",
">",
"chatMessages",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"messagesReceived",
... | Translates received messages through message query to chat SDK model.
@param messagesReceived Foundation message objects.
@return Chat SDK message objects. | [
"Translates",
"received",
"messages",
"through",
"message",
"query",
"to",
"chat",
"SDK",
"model",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java#L72-L89 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java | ModelAdapter.adaptStatuses | public List<ChatMessageStatus> adaptStatuses(String conversationId, String messageId, Map<String, MessageReceived.Status> statuses) {
List<ChatMessageStatus> adapted = new ArrayList<>();
for (String key : statuses.keySet()) {
MessageReceived.Status status = statuses.get(key);
adapted.add(ChatMessageStatus.builder().populate(conversationId, messageId, key, status.getStatus().compareTo(MessageStatus.delivered) == 0 ? LocalMessageStatus.delivered : LocalMessageStatus.read, DateHelper.getUTCMilliseconds(status.getTimestamp()), null).build());
}
return adapted;
} | java | public List<ChatMessageStatus> adaptStatuses(String conversationId, String messageId, Map<String, MessageReceived.Status> statuses) {
List<ChatMessageStatus> adapted = new ArrayList<>();
for (String key : statuses.keySet()) {
MessageReceived.Status status = statuses.get(key);
adapted.add(ChatMessageStatus.builder().populate(conversationId, messageId, key, status.getStatus().compareTo(MessageStatus.delivered) == 0 ? LocalMessageStatus.delivered : LocalMessageStatus.read, DateHelper.getUTCMilliseconds(status.getTimestamp()), null).build());
}
return adapted;
} | [
"public",
"List",
"<",
"ChatMessageStatus",
">",
"adaptStatuses",
"(",
"String",
"conversationId",
",",
"String",
"messageId",
",",
"Map",
"<",
"String",
",",
"MessageReceived",
".",
"Status",
">",
"statuses",
")",
"{",
"List",
"<",
"ChatMessageStatus",
">",
"... | Translates received message statuses through message query to chat SDK model.
@param conversationId Conversation unique id.
@param messageId Message unique id.
@param statuses Foundation statuses.
@return | [
"Translates",
"received",
"message",
"statuses",
"through",
"message",
"query",
"to",
"chat",
"SDK",
"model",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java#L99-L106 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java | ModelAdapter.adapt | public List<ChatParticipant> adapt(List<Participant> participants) {
List<ChatParticipant> result = new ArrayList<>();
if (participants != null && !participants.isEmpty()) {
for (Participant p : participants) {
result.add(ChatParticipant.builder().populate(p).build());
}
}
return result;
} | java | public List<ChatParticipant> adapt(List<Participant> participants) {
List<ChatParticipant> result = new ArrayList<>();
if (participants != null && !participants.isEmpty()) {
for (Participant p : participants) {
result.add(ChatParticipant.builder().populate(p).build());
}
}
return result;
} | [
"public",
"List",
"<",
"ChatParticipant",
">",
"adapt",
"(",
"List",
"<",
"Participant",
">",
"participants",
")",
"{",
"List",
"<",
"ChatParticipant",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"participants",
"!=",
"null",
... | Translates Foundation conversation participants to Chat SDK conversation participants.
@param participants Foundation conversation participants.
@return Chat SDK result. | [
"Translates",
"Foundation",
"conversation",
"participants",
"to",
"Chat",
"SDK",
"conversation",
"participants",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/model/ModelAdapter.java#L137-L145 | train |
casmi/casmi | src/main/java/casmi/graphics/color/RGBColor.java | RGBColor.setColor | private final void setColor(ColorSet colorSet) {
int[] rgb = ColorSet.getRGB(colorSet);
this.red = rgb[0] / 255.0;
this.green = rgb[1] / 255.0;
this.blue = rgb[2] / 255.0;
} | java | private final void setColor(ColorSet colorSet) {
int[] rgb = ColorSet.getRGB(colorSet);
this.red = rgb[0] / 255.0;
this.green = rgb[1] / 255.0;
this.blue = rgb[2] / 255.0;
} | [
"private",
"final",
"void",
"setColor",
"(",
"ColorSet",
"colorSet",
")",
"{",
"int",
"[",
"]",
"rgb",
"=",
"ColorSet",
".",
"getRGB",
"(",
"colorSet",
")",
";",
"this",
".",
"red",
"=",
"rgb",
"[",
"0",
"]",
"/",
"255.0",
";",
"this",
".",
"green"... | Returns the colorset's RGB values.
@param colorSet
The ColorSet.
@return
The ColorSet's RGB values. | [
"Returns",
"the",
"colorset",
"s",
"RGB",
"values",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/RGBColor.java#L178-L183 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/common/Quartz.java | Quartz.shutDown | public static void shutDown()
{
if (Quartz.QUARTZ != null && Quartz.QUARTZ.scheduler != null) {
try {
Quartz.QUARTZ.scheduler.shutdown();
} catch (final SchedulerException e) {
Quartz.LOG.error("Problems on shutdown of QuartsSheduler", e);
}
}
} | java | public static void shutDown()
{
if (Quartz.QUARTZ != null && Quartz.QUARTZ.scheduler != null) {
try {
Quartz.QUARTZ.scheduler.shutdown();
} catch (final SchedulerException e) {
Quartz.LOG.error("Problems on shutdown of QuartsSheduler", e);
}
}
} | [
"public",
"static",
"void",
"shutDown",
"(",
")",
"{",
"if",
"(",
"Quartz",
".",
"QUARTZ",
"!=",
"null",
"&&",
"Quartz",
".",
"QUARTZ",
".",
"scheduler",
"!=",
"null",
")",
"{",
"try",
"{",
"Quartz",
".",
"QUARTZ",
".",
"scheduler",
".",
"shutdown",
... | ShutDown Quartz. | [
"ShutDown",
"Quartz",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/Quartz.java#L199-L208 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/GenClassCompiler.java | GenClassCompiler.compile | public static GenClassCompiler compile(TypeElement superClass, ProcessingEnvironment env) throws IOException
{
GenClassCompiler compiler;
GrammarDef grammarDef = superClass.getAnnotation(GrammarDef.class);
if (grammarDef != null)
{
compiler = new ParserCompiler(superClass);
}
else
{
DFAMap mapDef = superClass.getAnnotation(DFAMap.class);
if (mapDef != null)
{
compiler = new MapCompiler(superClass);
}
else
{
compiler = new GenClassCompiler(superClass);
}
}
compiler.setProcessingEnvironment(env);
compiler.compile();
if (env == null)
{
System.err.println("warning! classes directory not set");
}
else
{
compiler.saveClass();
}
return compiler;
} | java | public static GenClassCompiler compile(TypeElement superClass, ProcessingEnvironment env) throws IOException
{
GenClassCompiler compiler;
GrammarDef grammarDef = superClass.getAnnotation(GrammarDef.class);
if (grammarDef != null)
{
compiler = new ParserCompiler(superClass);
}
else
{
DFAMap mapDef = superClass.getAnnotation(DFAMap.class);
if (mapDef != null)
{
compiler = new MapCompiler(superClass);
}
else
{
compiler = new GenClassCompiler(superClass);
}
}
compiler.setProcessingEnvironment(env);
compiler.compile();
if (env == null)
{
System.err.println("warning! classes directory not set");
}
else
{
compiler.saveClass();
}
return compiler;
} | [
"public",
"static",
"GenClassCompiler",
"compile",
"(",
"TypeElement",
"superClass",
",",
"ProcessingEnvironment",
"env",
")",
"throws",
"IOException",
"{",
"GenClassCompiler",
"compiler",
";",
"GrammarDef",
"grammarDef",
"=",
"superClass",
".",
"getAnnotation",
"(",
... | Compiles a subclass for annotated superClass
@param superClass Annotated class
@param env ProcessingEnvironment
@return
@throws IOException | [
"Compiles",
"a",
"subclass",
"for",
"annotated",
"superClass"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/GenClassCompiler.java#L83-L114 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/client/RestClient.java | RestClient.refreshAuthToken | private synchronized boolean refreshAuthToken(final AuthHandler handler,
final boolean forceRefresh) {
if (handler == null) {
return false;
}
AuthToken token = authToken.get();
if (!forceRefresh && token != null && token.isValid()) {
logger.fine("Auth token is already valid");
return true;
}
try {
handler.setForceRefresh(forceRefresh);
token = handler.call();
authToken.set(token);
if (token != null) {
if (token instanceof UserBearerAuthToken) {
final UserBearerAuthToken bt = (UserBearerAuthToken) token;
logger.info("Acquired auth token. Expires: "
+ bt.getExpires() + " token="
+ bt.getToken());
} else if (token instanceof ProjectBearerAuthToken) {
ProjectBearerAuthToken pt = (ProjectBearerAuthToken) token;
logger.info("Acquired proj token. Expires: " + pt.getExpires() + " token="
+ pt.getToken());
} else {
logger.info("Acquired auth token. Token valid="
+ token.isValid());
}
}
} catch (ExecutionException e) {
final Throwable cause = e.getCause();
if (cause != null) {
logger.warning("Authentication failed: " + cause.getMessage());
} else {
logger.warning("Authentication failed: " + e.getMessage());
}
} catch (Exception e) {
logger.warning("Authentication failed: " + e.getMessage());
} finally {
handler.setForceRefresh(false);
}
return true;
} | java | private synchronized boolean refreshAuthToken(final AuthHandler handler,
final boolean forceRefresh) {
if (handler == null) {
return false;
}
AuthToken token = authToken.get();
if (!forceRefresh && token != null && token.isValid()) {
logger.fine("Auth token is already valid");
return true;
}
try {
handler.setForceRefresh(forceRefresh);
token = handler.call();
authToken.set(token);
if (token != null) {
if (token instanceof UserBearerAuthToken) {
final UserBearerAuthToken bt = (UserBearerAuthToken) token;
logger.info("Acquired auth token. Expires: "
+ bt.getExpires() + " token="
+ bt.getToken());
} else if (token instanceof ProjectBearerAuthToken) {
ProjectBearerAuthToken pt = (ProjectBearerAuthToken) token;
logger.info("Acquired proj token. Expires: " + pt.getExpires() + " token="
+ pt.getToken());
} else {
logger.info("Acquired auth token. Token valid="
+ token.isValid());
}
}
} catch (ExecutionException e) {
final Throwable cause = e.getCause();
if (cause != null) {
logger.warning("Authentication failed: " + cause.getMessage());
} else {
logger.warning("Authentication failed: " + e.getMessage());
}
} catch (Exception e) {
logger.warning("Authentication failed: " + e.getMessage());
} finally {
handler.setForceRefresh(false);
}
return true;
} | [
"private",
"synchronized",
"boolean",
"refreshAuthToken",
"(",
"final",
"AuthHandler",
"handler",
",",
"final",
"boolean",
"forceRefresh",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"AuthToken",
"token",
"=",
"authToke... | Return true if caller should retry, false if give up | [
"Return",
"true",
"if",
"caller",
"should",
"retry",
"false",
"if",
"give",
"up"
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/RestClient.java#L154-L202 | train |
mistraltechnologies/smog | src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java | PropertyDescriptorLocator.getPropertyDescriptor | public PropertyDescriptor getPropertyDescriptor(String propertyName)
{
final PropertyDescriptor propertyDescriptor = findPropertyDescriptor(propertyName);
if (propertyDescriptor == null) {
throw new PropertyNotFoundException(beanClass, propertyName);
}
return propertyDescriptor;
} | java | public PropertyDescriptor getPropertyDescriptor(String propertyName)
{
final PropertyDescriptor propertyDescriptor = findPropertyDescriptor(propertyName);
if (propertyDescriptor == null) {
throw new PropertyNotFoundException(beanClass, propertyName);
}
return propertyDescriptor;
} | [
"public",
"PropertyDescriptor",
"getPropertyDescriptor",
"(",
"String",
"propertyName",
")",
"{",
"final",
"PropertyDescriptor",
"propertyDescriptor",
"=",
"findPropertyDescriptor",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyDescriptor",
"==",
"null",
")",
"{",
... | Get the property descriptor for the named property. Throws an exception if the property does not exist.
@param propertyName property name
@return the PropertyDescriptor for the named property
@throws PropertyNotFoundException if the named property does not exist on the bean
@see #findPropertyDescriptor(String) | [
"Get",
"the",
"property",
"descriptor",
"for",
"the",
"named",
"property",
".",
"Throws",
"an",
"exception",
"if",
"the",
"property",
"does",
"not",
"exist",
"."
] | bd561520f79476b96467f554daa59e51875ce027 | https://github.com/mistraltechnologies/smog/blob/bd561520f79476b96467f554daa59e51875ce027/src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java#L44-L53 | train |
mistraltechnologies/smog | src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java | PropertyDescriptorLocator.findPropertyDescriptor | public PropertyDescriptor findPropertyDescriptor(String propertyName) {
for (PropertyDescriptor property : propertyDescriptors) {
if (property.getName().equals(propertyName)) {
return property;
}
}
return null;
} | java | public PropertyDescriptor findPropertyDescriptor(String propertyName) {
for (PropertyDescriptor property : propertyDescriptors) {
if (property.getName().equals(propertyName)) {
return property;
}
}
return null;
} | [
"public",
"PropertyDescriptor",
"findPropertyDescriptor",
"(",
"String",
"propertyName",
")",
"{",
"for",
"(",
"PropertyDescriptor",
"property",
":",
"propertyDescriptors",
")",
"{",
"if",
"(",
"property",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"propertyNam... | Attempt to get the property descriptor for the named property.
@param propertyName property name
@return the PropertyDescriptor for the named property if found; otherwise null
@see #getPropertyDescriptor(String) | [
"Attempt",
"to",
"get",
"the",
"property",
"descriptor",
"for",
"the",
"named",
"property",
"."
] | bd561520f79476b96467f554daa59e51875ce027 | https://github.com/mistraltechnologies/smog/blob/bd561520f79476b96467f554daa59e51875ce027/src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java#L62-L70 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/datamodel/Classification.java | Classification.isAssigendTo | public boolean isAssigendTo(final Company _company)
throws CacheReloadException
{
final boolean ret;
if (isRoot()) {
ret = this.companies.isEmpty() ? true : this.companies.contains(_company);
} else {
ret = getParentClassification().isAssigendTo(_company);
}
return ret;
} | java | public boolean isAssigendTo(final Company _company)
throws CacheReloadException
{
final boolean ret;
if (isRoot()) {
ret = this.companies.isEmpty() ? true : this.companies.contains(_company);
} else {
ret = getParentClassification().isAssigendTo(_company);
}
return ret;
} | [
"public",
"boolean",
"isAssigendTo",
"(",
"final",
"Company",
"_company",
")",
"throws",
"CacheReloadException",
"{",
"final",
"boolean",
"ret",
";",
"if",
"(",
"isRoot",
"(",
")",
")",
"{",
"ret",
"=",
"this",
".",
"companies",
".",
"isEmpty",
"(",
")",
... | Check if the root classification of this classification is assigned to
the given company.
@see #companies
@param _company copmany that will be checked for assignment
@return true it the root classification of this classification is
assigned to the given company, else
@throws CacheReloadException on error | [
"Check",
"if",
"the",
"root",
"classification",
"of",
"this",
"classification",
"is",
"assigned",
"to",
"the",
"given",
"company",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Classification.java#L325-L335 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/ParserCompiler.java | ParserCompiler.overrideAbstractMethods | private void overrideAbstractMethods() throws IOException
{
for (final ExecutableElement method : El.getEffectiveMethods(superClass))
{
if (method.getModifiers().contains(Modifier.ABSTRACT))
{
if (
method.getAnnotation(Terminal.class) != null ||
method.getAnnotation(Rule.class) != null ||
method.getAnnotation(Rules.class) != null )
{
implementedAbstractMethods.add(method);
MethodCompiler mc = new MethodCompiler()
{
@Override
protected void implement() throws IOException
{
TypeMirror returnType = method.getReturnType();
List<? extends VariableElement> params = method.getParameters();
if (returnType.getKind() != TypeKind.VOID && params.size() == 1)
{
nameArgument(ARG, 1);
try
{
convert(ARG, returnType);
}
catch (IllegalConversionException ex)
{
throw new IOException("bad conversion with "+method, ex);
}
treturn();
}
else
{
if (returnType.getKind() == TypeKind.VOID && params.size() == 0)
{
treturn();
}
else
{
throw new IllegalArgumentException("cannot implement abstract method "+method);
}
}
}
};
subClass.overrideMethod(mc, method, Modifier.PROTECTED);
}
}
}
} | java | private void overrideAbstractMethods() throws IOException
{
for (final ExecutableElement method : El.getEffectiveMethods(superClass))
{
if (method.getModifiers().contains(Modifier.ABSTRACT))
{
if (
method.getAnnotation(Terminal.class) != null ||
method.getAnnotation(Rule.class) != null ||
method.getAnnotation(Rules.class) != null )
{
implementedAbstractMethods.add(method);
MethodCompiler mc = new MethodCompiler()
{
@Override
protected void implement() throws IOException
{
TypeMirror returnType = method.getReturnType();
List<? extends VariableElement> params = method.getParameters();
if (returnType.getKind() != TypeKind.VOID && params.size() == 1)
{
nameArgument(ARG, 1);
try
{
convert(ARG, returnType);
}
catch (IllegalConversionException ex)
{
throw new IOException("bad conversion with "+method, ex);
}
treturn();
}
else
{
if (returnType.getKind() == TypeKind.VOID && params.size() == 0)
{
treturn();
}
else
{
throw new IllegalArgumentException("cannot implement abstract method "+method);
}
}
}
};
subClass.overrideMethod(mc, method, Modifier.PROTECTED);
}
}
}
} | [
"private",
"void",
"overrideAbstractMethods",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"ExecutableElement",
"method",
":",
"El",
".",
"getEffectiveMethods",
"(",
"superClass",
")",
")",
"{",
"if",
"(",
"method",
".",
"getModifiers",
"(",
")... | Implement abstract method which have either one parameter and returning something or
void type not returning anything.
@throws IOException | [
"Implement",
"abstract",
"method",
"which",
"have",
"either",
"one",
"parameter",
"and",
"returning",
"something",
"or",
"void",
"type",
"not",
"returning",
"anything",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/ParserCompiler.java#L698-L747 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/util/cache/InfinispanCache.java | InfinispanCache.init | private void init()
{
this.container = InfinispanCache.findCacheContainer();
if (this.container == null) {
try {
this.container = new DefaultCacheManager(this.getClass().getResourceAsStream(
"/org/efaps/util/cache/infinispan-config.xml"));
if (this.container instanceof EmbeddedCacheManager) {
this.container.addListener(new CacheLogListener(InfinispanCache.LOG));
}
InfinispanCache.bindCacheContainer(this.container);
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
cache.put(InfinispanCache.COUNTERCACHE, 1);
} catch (final FactoryConfigurationError e) {
InfinispanCache.LOG.error("FactoryConfigurationError", e);
} catch (final IOException e) {
InfinispanCache.LOG.error("IOException", e);
}
} else {
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
Integer count = cache.get(InfinispanCache.COUNTERCACHE);
if (count == null) {
count = 1;
} else {
count = count + 1;
}
cache.put(InfinispanCache.COUNTERCACHE, count);
}
} | java | private void init()
{
this.container = InfinispanCache.findCacheContainer();
if (this.container == null) {
try {
this.container = new DefaultCacheManager(this.getClass().getResourceAsStream(
"/org/efaps/util/cache/infinispan-config.xml"));
if (this.container instanceof EmbeddedCacheManager) {
this.container.addListener(new CacheLogListener(InfinispanCache.LOG));
}
InfinispanCache.bindCacheContainer(this.container);
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
cache.put(InfinispanCache.COUNTERCACHE, 1);
} catch (final FactoryConfigurationError e) {
InfinispanCache.LOG.error("FactoryConfigurationError", e);
} catch (final IOException e) {
InfinispanCache.LOG.error("IOException", e);
}
} else {
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
Integer count = cache.get(InfinispanCache.COUNTERCACHE);
if (count == null) {
count = 1;
} else {
count = count + 1;
}
cache.put(InfinispanCache.COUNTERCACHE, count);
}
} | [
"private",
"void",
"init",
"(",
")",
"{",
"this",
".",
"container",
"=",
"InfinispanCache",
".",
"findCacheContainer",
"(",
")",
";",
"if",
"(",
"this",
".",
"container",
"==",
"null",
")",
"{",
"try",
"{",
"this",
".",
"container",
"=",
"new",
"Defaul... | init this instance. | [
"init",
"this",
"instance",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/util/cache/InfinispanCache.java#L84-L114 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/util/cache/InfinispanCache.java | InfinispanCache.terminate | private void terminate()
{
if (this.container != null) {
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
Integer count = cache.get(InfinispanCache.COUNTERCACHE);
if (count == null || count < 2) {
this.container.stop();
} else {
count = count - 1;
cache.put(InfinispanCache.COUNTERCACHE, count);
}
}
} | java | private void terminate()
{
if (this.container != null) {
final Cache<String, Integer> cache = this.container
.<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
Integer count = cache.get(InfinispanCache.COUNTERCACHE);
if (count == null || count < 2) {
this.container.stop();
} else {
count = count - 1;
cache.put(InfinispanCache.COUNTERCACHE, count);
}
}
} | [
"private",
"void",
"terminate",
"(",
")",
"{",
"if",
"(",
"this",
".",
"container",
"!=",
"null",
")",
"{",
"final",
"Cache",
"<",
"String",
",",
"Integer",
">",
"cache",
"=",
"this",
".",
"container",
".",
"<",
"String",
",",
"Integer",
">",
"getCac... | Terminate the manager. | [
"Terminate",
"the",
"manager",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/util/cache/InfinispanCache.java#L119-L132 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/util/cache/InfinispanCache.java | InfinispanCache.getIgnReCache | public <K, V> AdvancedCache<K, V> getIgnReCache(final String _cacheName)
{
return this.container.<K, V>getCache(_cacheName, true).getAdvancedCache()
.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.SKIP_REMOTE_LOOKUP, Flag.SKIP_CACHE_LOAD);
} | java | public <K, V> AdvancedCache<K, V> getIgnReCache(final String _cacheName)
{
return this.container.<K, V>getCache(_cacheName, true).getAdvancedCache()
.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.SKIP_REMOTE_LOOKUP, Flag.SKIP_CACHE_LOAD);
} | [
"public",
"<",
"K",
",",
"V",
">",
"AdvancedCache",
"<",
"K",
",",
"V",
">",
"getIgnReCache",
"(",
"final",
"String",
"_cacheName",
")",
"{",
"return",
"this",
".",
"container",
".",
"<",
"K",
",",
"V",
">",
"getCache",
"(",
"_cacheName",
",",
"true"... | An advanced cache that does not return the value of the previous value in
case of replacement.
@param _cacheName cache wanted
@param <K> Key
@param <V> Value
@return an AdvancedCache from Infinispan with Ignore return values | [
"An",
"advanced",
"cache",
"that",
"does",
"not",
"return",
"the",
"value",
"of",
"the",
"previous",
"value",
"in",
"case",
"of",
"replacement",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/util/cache/InfinispanCache.java#L164-L168 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/util/cache/InfinispanCache.java | InfinispanCache.initCache | public <K, V> Cache<K, V> initCache(final String _cacheName)
{
if (!exists(_cacheName)
&& ((EmbeddedCacheManager) getContainer()).getCacheConfiguration(_cacheName) == null) {
((EmbeddedCacheManager) getContainer()).defineConfiguration(_cacheName, "eFaps-Default",
new ConfigurationBuilder().build());
}
return this.container.getCache(_cacheName, true);
} | java | public <K, V> Cache<K, V> initCache(final String _cacheName)
{
if (!exists(_cacheName)
&& ((EmbeddedCacheManager) getContainer()).getCacheConfiguration(_cacheName) == null) {
((EmbeddedCacheManager) getContainer()).defineConfiguration(_cacheName, "eFaps-Default",
new ConfigurationBuilder().build());
}
return this.container.getCache(_cacheName, true);
} | [
"public",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"initCache",
"(",
"final",
"String",
"_cacheName",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
"_cacheName",
")",
"&&",
"(",
"(",
"EmbeddedCacheManager",
")",
"getContainer",
"(",
")",... | Method to init a Cache using the default definitions.
@param _cacheName cache wanted
@param <K> Key
@param <V> Value
@return a cache from Infinspan | [
"Method",
"to",
"init",
"a",
"Cache",
"using",
"the",
"default",
"definitions",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/util/cache/InfinispanCache.java#L177-L185 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/index/Index.java | Index.getFacetsConfig | public static FacetsConfig getFacetsConfig()
{
final FacetsConfig ret = new FacetsConfig();
ret.setHierarchical(Indexer.Dimension.DIMCREATED.name(), true);
return ret;
} | java | public static FacetsConfig getFacetsConfig()
{
final FacetsConfig ret = new FacetsConfig();
ret.setHierarchical(Indexer.Dimension.DIMCREATED.name(), true);
return ret;
} | [
"public",
"static",
"FacetsConfig",
"getFacetsConfig",
"(",
")",
"{",
"final",
"FacetsConfig",
"ret",
"=",
"new",
"FacetsConfig",
"(",
")",
";",
"ret",
".",
"setHierarchical",
"(",
"Indexer",
".",
"Dimension",
".",
"DIMCREATED",
".",
"name",
"(",
")",
",",
... | Gets the facets config.
@return the facets config | [
"Gets",
"the",
"facets",
"config",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/Index.java#L50-L55 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/index/Index.java | Index.getAnalyzer | public static Analyzer getAnalyzer()
throws EFapsException
{
IAnalyzerProvider provider = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXANALYZERPROVCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXANALYZERPROVCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
provider = (IAnalyzerProvider) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IAnalyzerProvider", e);
}
} else {
provider = new IAnalyzerProvider()
{
@Override
public Analyzer getAnalyzer()
{
return new StandardAnalyzer(SpanishAnalyzer.getDefaultStopSet());
}
};
}
return provider.getAnalyzer();
} | java | public static Analyzer getAnalyzer()
throws EFapsException
{
IAnalyzerProvider provider = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXANALYZERPROVCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXANALYZERPROVCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
provider = (IAnalyzerProvider) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IAnalyzerProvider", e);
}
} else {
provider = new IAnalyzerProvider()
{
@Override
public Analyzer getAnalyzer()
{
return new StandardAnalyzer(SpanishAnalyzer.getDefaultStopSet());
}
};
}
return provider.getAnalyzer();
} | [
"public",
"static",
"Analyzer",
"getAnalyzer",
"(",
")",
"throws",
"EFapsException",
"{",
"IAnalyzerProvider",
"provider",
"=",
"null",
";",
"if",
"(",
"EFapsSystemConfiguration",
".",
"get",
"(",
")",
".",
"containsAttributeValue",
"(",
"KernelSettings",
".",
"IN... | Gets the analyzer.
@return the analyzer
@throws EFapsException on error | [
"Gets",
"the",
"analyzer",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/Index.java#L63-L87 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/version/ApplicationVersion.java | ApplicationVersion.addScript | @CallMethod(pattern = "install/version/script")
public void addScript(@CallParam(pattern = "install/version/script") final String _code,
@CallParam(pattern = "install/version/script", attributeName = "type") final String _type,
@CallParam(pattern = "install/version/script", attributeName = "name") final String _name,
@CallParam(pattern = "install/version/script", attributeName = "function")
final String _function)
{
AbstractScript script = null;
if ("rhino".equalsIgnoreCase(_type)) {
script = new RhinoScript(_code, _name, _function);
} else if ("groovy".equalsIgnoreCase(_type)) {
script = new GroovyScript(_code, _name, _function);
}
if (script != null) {
this.scripts.add(script);
}
} | java | @CallMethod(pattern = "install/version/script")
public void addScript(@CallParam(pattern = "install/version/script") final String _code,
@CallParam(pattern = "install/version/script", attributeName = "type") final String _type,
@CallParam(pattern = "install/version/script", attributeName = "name") final String _name,
@CallParam(pattern = "install/version/script", attributeName = "function")
final String _function)
{
AbstractScript script = null;
if ("rhino".equalsIgnoreCase(_type)) {
script = new RhinoScript(_code, _name, _function);
} else if ("groovy".equalsIgnoreCase(_type)) {
script = new GroovyScript(_code, _name, _function);
}
if (script != null) {
this.scripts.add(script);
}
} | [
"@",
"CallMethod",
"(",
"pattern",
"=",
"\"install/version/script\"",
")",
"public",
"void",
"addScript",
"(",
"@",
"CallParam",
"(",
"pattern",
"=",
"\"install/version/script\"",
")",
"final",
"String",
"_code",
",",
"@",
"CallParam",
"(",
"pattern",
"=",
"\"in... | Adds a new Script to this version.
@param _code code of script to execute
@param _type type of the code, groovy, rhino
@param _name file name of the script
@param _function name of function which is called | [
"Adds",
"a",
"new",
"Script",
"to",
"this",
"version",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/ApplicationVersion.java#L192-L208 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/version/ApplicationVersion.java | ApplicationVersion.appendDescription | @CallMethod(pattern = "install/version/description")
public void appendDescription(@CallParam(pattern = "install/version/description") final String _desc)
{
if (_desc != null) {
this.description.append(_desc.trim()).append("\n");
}
} | java | @CallMethod(pattern = "install/version/description")
public void appendDescription(@CallParam(pattern = "install/version/description") final String _desc)
{
if (_desc != null) {
this.description.append(_desc.trim()).append("\n");
}
} | [
"@",
"CallMethod",
"(",
"pattern",
"=",
"\"install/version/description\"",
")",
"public",
"void",
"appendDescription",
"(",
"@",
"CallParam",
"(",
"pattern",
"=",
"\"install/version/description\"",
")",
"final",
"String",
"_desc",
")",
"{",
"if",
"(",
"_desc",
"!=... | Append a description for this version.
@param _desc text of description to append
@see #description | [
"Append",
"a",
"description",
"for",
"this",
"version",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/ApplicationVersion.java#L216-L222 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/version/ApplicationVersion.java | ApplicationVersion.addIgnoredStep | @CallMethod(pattern = "install/version/lifecyle/ignore")
public void addIgnoredStep(@CallParam(pattern = "install/version/lifecyle/ignore", attributeName = "step")
final String _step)
{
this.ignoredSteps.add(UpdateLifecycle.valueOf(_step.toUpperCase()));
} | java | @CallMethod(pattern = "install/version/lifecyle/ignore")
public void addIgnoredStep(@CallParam(pattern = "install/version/lifecyle/ignore", attributeName = "step")
final String _step)
{
this.ignoredSteps.add(UpdateLifecycle.valueOf(_step.toUpperCase()));
} | [
"@",
"CallMethod",
"(",
"pattern",
"=",
"\"install/version/lifecyle/ignore\"",
")",
"public",
"void",
"addIgnoredStep",
"(",
"@",
"CallParam",
"(",
"pattern",
"=",
"\"install/version/lifecyle/ignore\"",
",",
"attributeName",
"=",
"\"step\"",
")",
"final",
"String",
"_... | Appends a step which is ignored within the installation of this version.
@param _step ignored step
@see #ignoredSteps | [
"Appends",
"a",
"step",
"which",
"is",
"ignored",
"within",
"the",
"installation",
"of",
"this",
"version",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/ApplicationVersion.java#L250-L255 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/transaction/ConnectionResource.java | ConnectionResource.freeResource | @Override
protected void freeResource()
throws EFapsException
{
try {
if (!getConnection().isClosed()) {
getConnection().close();
}
} catch (final SQLException e) {
throw new EFapsException("Could not close", e);
}
} | java | @Override
protected void freeResource()
throws EFapsException
{
try {
if (!getConnection().isClosed()) {
getConnection().close();
}
} catch (final SQLException e) {
throw new EFapsException("Could not close", e);
}
} | [
"@",
"Override",
"protected",
"void",
"freeResource",
"(",
")",
"throws",
"EFapsException",
"{",
"try",
"{",
"if",
"(",
"!",
"getConnection",
"(",
")",
".",
"isClosed",
"(",
")",
")",
"{",
"getConnection",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
... | Frees the resource and gives this connection resource back to the
context object.
@throws EFapsException on error | [
"Frees",
"the",
"resource",
"and",
"gives",
"this",
"connection",
"resource",
"back",
"to",
"the",
"context",
"object",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/transaction/ConnectionResource.java#L83-L94 | train |
gpein/jcache-jee7 | src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java | CacheConfiguration.newMutable | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | java | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Configuration",
"newMutable",
"(",
"TimeUnit",
"expiryTimeUnit",
",",
"long",
"expiryDurationAmount",
")",
"{",
"return",
"new",
"MutableConfiguration",
"<",
"K",
",",
"V",
">",
"(",
")",
".",
"setExpiryPolicyFacto... | Build a new mutable javax.cache.configuration.Configuration with an expiry policy
@param expiryTimeUnit time unit
@param expiryDurationAmount amount of time to wait before global cache expiration
@param <K> Key type
@param <V> Value type
@return a new cache configuration instance | [
"Build",
"a",
"new",
"mutable",
"javax",
".",
"cache",
".",
"configuration",
".",
"Configuration",
"with",
"an",
"expiry",
"policy"
] | 492dd3bb6423cdfb064e7005952a7b79fe4cd7aa | https://github.com/gpein/jcache-jee7/blob/492dd3bb6423cdfb064e7005952a7b79fe4cd7aa/src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java#L38-L40 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/selection/Evaluator.java | Evaluator.next | public boolean next()
throws EFapsException
{
initialize(false);
boolean stepForward = true;
boolean ret = true;
while (stepForward && ret) {
ret = step(this.selection.getAllSelects());
stepForward = !this.access.hasAccess(inst());
}
return ret;
} | java | public boolean next()
throws EFapsException
{
initialize(false);
boolean stepForward = true;
boolean ret = true;
while (stepForward && ret) {
ret = step(this.selection.getAllSelects());
stepForward = !this.access.hasAccess(inst());
}
return ret;
} | [
"public",
"boolean",
"next",
"(",
")",
"throws",
"EFapsException",
"{",
"initialize",
"(",
"false",
")",
";",
"boolean",
"stepForward",
"=",
"true",
";",
"boolean",
"ret",
"=",
"true",
";",
"while",
"(",
"stepForward",
"&&",
"ret",
")",
"{",
"ret",
"=",
... | Move the evaluator to the next value.
Skips values the User does not have access to.
@return true, if successful
@throws EFapsException on Error | [
"Move",
"the",
"evaluator",
"to",
"the",
"next",
"value",
".",
"Skips",
"values",
"the",
"User",
"does",
"not",
"have",
"access",
"to",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/selection/Evaluator.java#L308-L319 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/selection/Evaluator.java | Evaluator.step | private boolean step(final Collection<Select> _selects)
{
boolean ret = !CollectionUtils.isEmpty(_selects);
for (final Select select : _selects) {
ret = ret && select.next();
}
return ret;
} | java | private boolean step(final Collection<Select> _selects)
{
boolean ret = !CollectionUtils.isEmpty(_selects);
for (final Select select : _selects) {
ret = ret && select.next();
}
return ret;
} | [
"private",
"boolean",
"step",
"(",
"final",
"Collection",
"<",
"Select",
">",
"_selects",
")",
"{",
"boolean",
"ret",
"=",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"_selects",
")",
";",
"for",
"(",
"final",
"Select",
"select",
":",
"_selects",
")",
"... | Move the selects to the next value.
@param _selects the selects
@return true, if successful | [
"Move",
"the",
"selects",
"to",
"the",
"next",
"value",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/selection/Evaluator.java#L405-L412 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/selection/Evaluator.java | Evaluator.evalAccess | private void evalAccess()
throws EFapsException
{
final List<Instance> instances = new ArrayList<>();
while (step(this.selection.getInstSelects().values())) {
for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
final Object object = entry.getValue().getCurrent();
if (object != null) {
if (object instanceof List) {
((List<?>) object).stream()
.filter(Objects::nonNull)
.forEach(e -> instances.add((Instance) e));
} else {
instances.add((Instance) object);
}
}
}
}
for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
entry.getValue().reset();
}
this.access = Access.get(AccessTypeEnums.READ.getAccessType(), instances);
} | java | private void evalAccess()
throws EFapsException
{
final List<Instance> instances = new ArrayList<>();
while (step(this.selection.getInstSelects().values())) {
for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
final Object object = entry.getValue().getCurrent();
if (object != null) {
if (object instanceof List) {
((List<?>) object).stream()
.filter(Objects::nonNull)
.forEach(e -> instances.add((Instance) e));
} else {
instances.add((Instance) object);
}
}
}
}
for (final Entry<String, Select> entry : this.selection.getInstSelects().entrySet()) {
entry.getValue().reset();
}
this.access = Access.get(AccessTypeEnums.READ.getAccessType(), instances);
} | [
"private",
"void",
"evalAccess",
"(",
")",
"throws",
"EFapsException",
"{",
"final",
"List",
"<",
"Instance",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"while",
"(",
"step",
"(",
"this",
".",
"selection",
".",
"getInstSelects",
"(",
... | Evaluate the access for the instances.
@throws EFapsException on error | [
"Evaluate",
"the",
"access",
"for",
"the",
"instances",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/selection/Evaluator.java#L419-L441 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/selection/Evaluator.java | Evaluator.getDataList | public DataList getDataList()
throws EFapsException
{
final DataList ret = new DataList();
while (next()) {
final ObjectData data = new ObjectData();
int idx = 1;
for (final Select select : this.selection.getSelects()) {
final String key = select.getAlias() == null ? String.valueOf(idx) : select.getAlias();
data.getValues().add(JSONData.getValue(key, get(select)));
idx++;
}
ret.add(data);
}
return ret;
} | java | public DataList getDataList()
throws EFapsException
{
final DataList ret = new DataList();
while (next()) {
final ObjectData data = new ObjectData();
int idx = 1;
for (final Select select : this.selection.getSelects()) {
final String key = select.getAlias() == null ? String.valueOf(idx) : select.getAlias();
data.getValues().add(JSONData.getValue(key, get(select)));
idx++;
}
ret.add(data);
}
return ret;
} | [
"public",
"DataList",
"getDataList",
"(",
")",
"throws",
"EFapsException",
"{",
"final",
"DataList",
"ret",
"=",
"new",
"DataList",
"(",
")",
";",
"while",
"(",
"next",
"(",
")",
")",
"{",
"final",
"ObjectData",
"data",
"=",
"new",
"ObjectData",
"(",
")"... | Gets the data list.
@return the data list
@throws EFapsException | [
"Gets",
"the",
"data",
"list",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/selection/Evaluator.java#L449-L464 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/util/EFapsException.java | EFapsException.makeInfo | protected String makeInfo()
{
final StringBuilder str = new StringBuilder();
if (this.className != null) {
str.append("Thrown within class ").append(this.className.getName()).append('\n');
}
if (this.id != null) {
str.append("Id of Exception is ").append(this.id).append('\n');
}
if (this.args != null && this.args.length > 0) {
str.append("Arguments are:\n");
for (Integer index = 0; index < this.args.length; index++) {
final String arg = this.args[index] == null
? "null"
: this.args[index].toString();
str.append("\targs[").append(index.toString()).append("] = '").append(arg).append("'\n");
}
}
return str.toString();
} | java | protected String makeInfo()
{
final StringBuilder str = new StringBuilder();
if (this.className != null) {
str.append("Thrown within class ").append(this.className.getName()).append('\n');
}
if (this.id != null) {
str.append("Id of Exception is ").append(this.id).append('\n');
}
if (this.args != null && this.args.length > 0) {
str.append("Arguments are:\n");
for (Integer index = 0; index < this.args.length; index++) {
final String arg = this.args[index] == null
? "null"
: this.args[index].toString();
str.append("\targs[").append(index.toString()).append("] = '").append(arg).append("'\n");
}
}
return str.toString();
} | [
"protected",
"String",
"makeInfo",
"(",
")",
"{",
"final",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"this",
".",
"className",
"!=",
"null",
")",
"{",
"str",
".",
"append",
"(",
"\"Thrown within class \"",
")",
".",
"... | Prepares a string of all information of this EFapsException. The
returned string includes information about the class which throws this
exception, the exception id and all arguments.
@return string representation about the EFapsException | [
"Prepares",
"a",
"string",
"of",
"all",
"information",
"of",
"this",
"EFapsException",
".",
"The",
"returned",
"string",
"includes",
"information",
"about",
"the",
"class",
"which",
"throws",
"this",
"exception",
"the",
"exception",
"id",
"and",
"all",
"argument... | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/util/EFapsException.java#L162-L181 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/dbproperty/DBProperties.java | DBProperties.getValueFromDB | private static String getValueFromDB(final String _key,
final String _language)
{
String ret = null;
try {
boolean closeContext = false;
if (!Context.isThreadActive()) {
Context.begin();
closeContext = true;
}
final Connection con = Context.getConnection();
final PreparedStatement stmt = con.prepareStatement(DBProperties.SQLSELECT);
stmt.setString(1, _key);
stmt.setString(2, _language);
final ResultSet resultset = stmt.executeQuery();
if (resultset.next()) {
final String defaultValue = resultset.getString(1);
final String value = resultset.getString(2);
if (value != null) {
ret = value.trim();
} else if (defaultValue != null) {
ret = defaultValue.trim();
}
} else {
final PreparedStatement stmt2 = con.prepareStatement(DBProperties.SQLSELECTDEF);
stmt2.setString(1, _key);
final ResultSet resultset2 = stmt2.executeQuery();
if (resultset2.next()) {
final String defaultValue = resultset2.getString(1);
if (defaultValue != null) {
ret = defaultValue.trim();
}
}
resultset2.close();
stmt2.close();
}
resultset.close();
stmt.close();
con.commit();
con.close();
if (closeContext) {
Context.rollback();
}
} catch (final EFapsException e) {
DBProperties.LOG.error("initialiseCache()", e);
} catch (final SQLException e) {
DBProperties.LOG.error("initialiseCache()", e);
}
return ret;
} | java | private static String getValueFromDB(final String _key,
final String _language)
{
String ret = null;
try {
boolean closeContext = false;
if (!Context.isThreadActive()) {
Context.begin();
closeContext = true;
}
final Connection con = Context.getConnection();
final PreparedStatement stmt = con.prepareStatement(DBProperties.SQLSELECT);
stmt.setString(1, _key);
stmt.setString(2, _language);
final ResultSet resultset = stmt.executeQuery();
if (resultset.next()) {
final String defaultValue = resultset.getString(1);
final String value = resultset.getString(2);
if (value != null) {
ret = value.trim();
} else if (defaultValue != null) {
ret = defaultValue.trim();
}
} else {
final PreparedStatement stmt2 = con.prepareStatement(DBProperties.SQLSELECTDEF);
stmt2.setString(1, _key);
final ResultSet resultset2 = stmt2.executeQuery();
if (resultset2.next()) {
final String defaultValue = resultset2.getString(1);
if (defaultValue != null) {
ret = defaultValue.trim();
}
}
resultset2.close();
stmt2.close();
}
resultset.close();
stmt.close();
con.commit();
con.close();
if (closeContext) {
Context.rollback();
}
} catch (final EFapsException e) {
DBProperties.LOG.error("initialiseCache()", e);
} catch (final SQLException e) {
DBProperties.LOG.error("initialiseCache()", e);
}
return ret;
} | [
"private",
"static",
"String",
"getValueFromDB",
"(",
"final",
"String",
"_key",
",",
"final",
"String",
"_language",
")",
"{",
"String",
"ret",
"=",
"null",
";",
"try",
"{",
"boolean",
"closeContext",
"=",
"false",
";",
"if",
"(",
"!",
"Context",
".",
"... | This method is initializing the cache.
@param _key key to be read.
@param _language language to search for
@return value from the database, null if not found | [
"This",
"method",
"is",
"initializing",
"the",
"cache",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/dbproperty/DBProperties.java#L312-L361 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/dbproperty/DBProperties.java | DBProperties.cacheOnStart | private static void cacheOnStart()
{
try {
boolean closeContext = false;
if (!Context.isThreadActive()) {
Context.begin();
closeContext = true;
}
Context.getThreadContext();
final Connection con = Context.getConnection();
final PreparedStatement stmtLang = con.prepareStatement(DBProperties.SQLLANG);
final ResultSet rsLang = stmtLang.executeQuery();
final Set<String> languages = new HashSet<>();
while (rsLang.next()) {
languages.add(rsLang.getString(1).trim());
}
rsLang.close();
stmtLang.close();
final Cache<String, String> cache = InfinispanCache.get().<String, String>getCache(
DBProperties.CACHENAME);
final PreparedStatement stmt = con.prepareStatement(DBProperties.SQLSELECTONSTART);
final ResultSet resultset = stmt.executeQuery();
while (resultset.next()) {
final String propKey = resultset.getString(1).trim();
final String defaultValue = resultset.getString(2);
if (defaultValue != null) {
final String value = defaultValue.trim();
for (final String lang : languages) {
final String cachKey = lang + ":" + propKey;
if (!cache.containsKey(cachKey)) {
cache.put(cachKey, value);
}
}
}
final String value = resultset.getString(3);
final String lang = resultset.getString(4);
if (value != null) {
final String cachKey = lang.trim() + ":" + propKey;
cache.put(cachKey, value.trim());
}
}
resultset.close();
stmt.close();
con.commit();
con.close();
if (closeContext) {
Context.rollback();
}
} catch (final EFapsException e) {
DBProperties.LOG.error("initialiseCache()", e);
} catch (final SQLException e) {
DBProperties.LOG.error("initialiseCache()", e);
}
} | java | private static void cacheOnStart()
{
try {
boolean closeContext = false;
if (!Context.isThreadActive()) {
Context.begin();
closeContext = true;
}
Context.getThreadContext();
final Connection con = Context.getConnection();
final PreparedStatement stmtLang = con.prepareStatement(DBProperties.SQLLANG);
final ResultSet rsLang = stmtLang.executeQuery();
final Set<String> languages = new HashSet<>();
while (rsLang.next()) {
languages.add(rsLang.getString(1).trim());
}
rsLang.close();
stmtLang.close();
final Cache<String, String> cache = InfinispanCache.get().<String, String>getCache(
DBProperties.CACHENAME);
final PreparedStatement stmt = con.prepareStatement(DBProperties.SQLSELECTONSTART);
final ResultSet resultset = stmt.executeQuery();
while (resultset.next()) {
final String propKey = resultset.getString(1).trim();
final String defaultValue = resultset.getString(2);
if (defaultValue != null) {
final String value = defaultValue.trim();
for (final String lang : languages) {
final String cachKey = lang + ":" + propKey;
if (!cache.containsKey(cachKey)) {
cache.put(cachKey, value);
}
}
}
final String value = resultset.getString(3);
final String lang = resultset.getString(4);
if (value != null) {
final String cachKey = lang.trim() + ":" + propKey;
cache.put(cachKey, value.trim());
}
}
resultset.close();
stmt.close();
con.commit();
con.close();
if (closeContext) {
Context.rollback();
}
} catch (final EFapsException e) {
DBProperties.LOG.error("initialiseCache()", e);
} catch (final SQLException e) {
DBProperties.LOG.error("initialiseCache()", e);
}
} | [
"private",
"static",
"void",
"cacheOnStart",
"(",
")",
"{",
"try",
"{",
"boolean",
"closeContext",
"=",
"false",
";",
"if",
"(",
"!",
"Context",
".",
"isThreadActive",
"(",
")",
")",
"{",
"Context",
".",
"begin",
"(",
")",
";",
"closeContext",
"=",
"tr... | Load the properties that must be cached on start. | [
"Load",
"the",
"properties",
"that",
"must",
"be",
"cached",
"on",
"start",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/dbproperty/DBProperties.java#L366-L419 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/dbproperty/DBProperties.java | DBProperties.initialize | public static void initialize()
{
if (InfinispanCache.get().exists(DBProperties.CACHENAME)) {
InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME).clear();
} else {
InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME)
.addListener(new CacheLogListener(DBProperties.LOG));
}
DBProperties.cacheOnStart();
} | java | public static void initialize()
{
if (InfinispanCache.get().exists(DBProperties.CACHENAME)) {
InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME).clear();
} else {
InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME)
.addListener(new CacheLogListener(DBProperties.LOG));
}
DBProperties.cacheOnStart();
} | [
"public",
"static",
"void",
"initialize",
"(",
")",
"{",
"if",
"(",
"InfinispanCache",
".",
"get",
"(",
")",
".",
"exists",
"(",
"DBProperties",
".",
"CACHENAME",
")",
")",
"{",
"InfinispanCache",
".",
"get",
"(",
")",
".",
"<",
"String",
",",
"String"... | Initialize the Cache be calling it. Used from runtime level. | [
"Initialize",
"the",
"Cache",
"be",
"calling",
"it",
".",
"Used",
"from",
"runtime",
"level",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/dbproperty/DBProperties.java#L424-L433 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/message/MessageStatusHolder.java | MessageStatusHolder.getReadCount | public static int getReadCount(final Long _userId)
{
int ret = 0;
if (MessageStatusHolder.CACHE.userID2Read.containsKey(_userId)) {
ret = MessageStatusHolder.CACHE.userID2Read.get(_userId);
}
return ret;
} | java | public static int getReadCount(final Long _userId)
{
int ret = 0;
if (MessageStatusHolder.CACHE.userID2Read.containsKey(_userId)) {
ret = MessageStatusHolder.CACHE.userID2Read.get(_userId);
}
return ret;
} | [
"public",
"static",
"int",
"getReadCount",
"(",
"final",
"Long",
"_userId",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"MessageStatusHolder",
".",
"CACHE",
".",
"userID2Read",
".",
"containsKey",
"(",
"_userId",
")",
")",
"{",
"ret",
"=",
"Message... | Count of read messages.
@param _userId user id the count is wanted for
@return count of read messages | [
"Count",
"of",
"read",
"messages",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/message/MessageStatusHolder.java#L89-L96 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/message/MessageStatusHolder.java | MessageStatusHolder.getUnReadCount | public static int getUnReadCount(final Long _userId)
{
int ret = 0;
if (MessageStatusHolder.CACHE.userID2UnRead.containsKey(_userId)) {
ret = MessageStatusHolder.CACHE.userID2UnRead.get(_userId);
}
return ret;
} | java | public static int getUnReadCount(final Long _userId)
{
int ret = 0;
if (MessageStatusHolder.CACHE.userID2UnRead.containsKey(_userId)) {
ret = MessageStatusHolder.CACHE.userID2UnRead.get(_userId);
}
return ret;
} | [
"public",
"static",
"int",
"getUnReadCount",
"(",
"final",
"Long",
"_userId",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"MessageStatusHolder",
".",
"CACHE",
".",
"userID2UnRead",
".",
"containsKey",
"(",
"_userId",
")",
")",
"{",
"ret",
"=",
"Mes... | Count of unread messages.
@param _userId user id the count is wanted for
@return count of unread messages | [
"Count",
"of",
"unread",
"messages",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/message/MessageStatusHolder.java#L113-L120 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Bezier.java | Bezier.setNode | public void setNode(int number, Vector3D v) {
setNode(number, v.getX(), v.getY(), v.getZ());
} | java | public void setNode(int number, Vector3D v) {
setNode(number, v.getX(), v.getY(), v.getZ());
} | [
"public",
"void",
"setNode",
"(",
"int",
"number",
",",
"Vector3D",
"v",
")",
"{",
"setNode",
"(",
"number",
",",
"v",
".",
"getX",
"(",
")",
",",
"v",
".",
"getY",
"(",
")",
",",
"v",
".",
"getZ",
"(",
")",
")",
";",
"}"
] | Sets coordinate of nodes of this Bezier.
@param number The number of a node. The node whose number is 0 or 3 is a anchor point, and
the node whose number is 1 or 2 is a control point.
@param v The coordinates of this node. | [
"Sets",
"coordinate",
"of",
"nodes",
"of",
"this",
"Bezier",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Bezier.java#L179-L181 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Bezier.java | Bezier.setAnchorColor | public void setAnchorColor(int index, Color color) {
if (index <= 0) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.startColor = color;
} else if (index >= 1) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
}
} | java | public void setAnchorColor(int index, Color color) {
if (index <= 0) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.startColor = color;
} else if (index >= 1) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
}
} | [
"public",
"void",
"setAnchorColor",
"(",
"int",
"index",
",",
"Color",
"color",
")",
"{",
"if",
"(",
"index",
"<=",
"0",
")",
"{",
"if",
"(",
"startColor",
"==",
"null",
")",
"{",
"startColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"... | Sets the color of the anchor point for gradation.
@param index The index of anchors. The index of the start anchor point is 0, the index of the
end anchor point is 1.
@param color The color of the anchor point. | [
"Sets",
"the",
"color",
"of",
"the",
"anchor",
"point",
"for",
"gradation",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Bezier.java#L282-L296 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Text.java | Text.getWidth | public final double getWidth(int line) {
if (strArray.length == 0) return 0.0;
try {
return textRenderer.getBounds(strArray[line]).getWidth();
} catch (GLException e) {
reset = true;
}
return 0.0;
} | java | public final double getWidth(int line) {
if (strArray.length == 0) return 0.0;
try {
return textRenderer.getBounds(strArray[line]).getWidth();
} catch (GLException e) {
reset = true;
}
return 0.0;
} | [
"public",
"final",
"double",
"getWidth",
"(",
"int",
"line",
")",
"{",
"if",
"(",
"strArray",
".",
"length",
"==",
"0",
")",
"return",
"0.0",
";",
"try",
"{",
"return",
"textRenderer",
".",
"getBounds",
"(",
"strArray",
"[",
"line",
"]",
")",
".",
"g... | Returns letter's width of the current font at its current size and line.
@param line The number of lines.
@return The letter's width.
@throws GLException If the textRenderer is not valid; calls the reset method and creates a
new textRenderer. | [
"Returns",
"letter",
"s",
"width",
"of",
"the",
"current",
"font",
"at",
"its",
"current",
"size",
"and",
"line",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Text.java#L311-L321 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Text.java | Text.setFont | public final void setFont(Font font) {
this.font = font;
textRenderer = new TextRenderer(font.getAWTFont(), true, true);
} | java | public final void setFont(Font font) {
this.font = font;
textRenderer = new TextRenderer(font.getAWTFont(), true, true);
} | [
"public",
"final",
"void",
"setFont",
"(",
"Font",
"font",
")",
"{",
"this",
".",
"font",
"=",
"font",
";",
"textRenderer",
"=",
"new",
"TextRenderer",
"(",
"font",
".",
"getAWTFont",
"(",
")",
",",
"true",
",",
"true",
")",
";",
"}"
] | Sets the Font of this Text.
@param font The Font of the Text. | [
"Sets",
"the",
"Font",
"of",
"this",
"Text",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Text.java#L454-L457 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/access/user/Evaluation.java | Evaluation.getPermissionSet | public static PermissionSet getPermissionSet(final Instance _instance)
throws EFapsException
{
Evaluation.LOG.debug("Evaluation PermissionSet for {}", _instance);
final Key accessKey = Key.get4Instance(_instance);
final PermissionSet ret = AccessCache.getPermissionCache().get(accessKey);
Evaluation.LOG.debug("Evaluated PermissionSet {}", ret);
return ret;
} | java | public static PermissionSet getPermissionSet(final Instance _instance)
throws EFapsException
{
Evaluation.LOG.debug("Evaluation PermissionSet for {}", _instance);
final Key accessKey = Key.get4Instance(_instance);
final PermissionSet ret = AccessCache.getPermissionCache().get(accessKey);
Evaluation.LOG.debug("Evaluated PermissionSet {}", ret);
return ret;
} | [
"public",
"static",
"PermissionSet",
"getPermissionSet",
"(",
"final",
"Instance",
"_instance",
")",
"throws",
"EFapsException",
"{",
"Evaluation",
".",
"LOG",
".",
"debug",
"(",
"\"Evaluation PermissionSet for {}\"",
",",
"_instance",
")",
";",
"final",
"Key",
"acc... | Gets the permissions.
@param _instance the instance
@return the permissions
@throws EFapsException on error | [
"Gets",
"the",
"permissions",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/access/user/Evaluation.java#L68-L76 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/access/user/Evaluation.java | Evaluation.getPermissionSet | public static PermissionSet getPermissionSet(final Instance _instance,
final boolean _evaluate)
throws EFapsException
{
Evaluation.LOG.debug("Retrieving PermissionSet for {}", _instance);
final Key accessKey = Key.get4Instance(_instance);
final PermissionSet ret;
if (AccessCache.getPermissionCache().containsKey(accessKey)) {
ret = AccessCache.getPermissionCache().get(accessKey);
} else if (_evaluate) {
ret = new PermissionSet().setPersonId(accessKey.getPersonId()).setCompanyId(accessKey.getCompanyId())
.setTypeId(accessKey.getTypeId());
Evaluation.eval(ret);
AccessCache.getPermissionCache().put(accessKey, ret);
} else {
ret = null;
}
Evaluation.LOG.debug("Retrieved PermissionSet {}", ret);
return ret;
} | java | public static PermissionSet getPermissionSet(final Instance _instance,
final boolean _evaluate)
throws EFapsException
{
Evaluation.LOG.debug("Retrieving PermissionSet for {}", _instance);
final Key accessKey = Key.get4Instance(_instance);
final PermissionSet ret;
if (AccessCache.getPermissionCache().containsKey(accessKey)) {
ret = AccessCache.getPermissionCache().get(accessKey);
} else if (_evaluate) {
ret = new PermissionSet().setPersonId(accessKey.getPersonId()).setCompanyId(accessKey.getCompanyId())
.setTypeId(accessKey.getTypeId());
Evaluation.eval(ret);
AccessCache.getPermissionCache().put(accessKey, ret);
} else {
ret = null;
}
Evaluation.LOG.debug("Retrieved PermissionSet {}", ret);
return ret;
} | [
"public",
"static",
"PermissionSet",
"getPermissionSet",
"(",
"final",
"Instance",
"_instance",
",",
"final",
"boolean",
"_evaluate",
")",
"throws",
"EFapsException",
"{",
"Evaluation",
".",
"LOG",
".",
"debug",
"(",
"\"Retrieving PermissionSet for {}\"",
",",
"_insta... | Gets the PermissionSet.
@param _instance the instance
@param _evaluate the evaluate
@return the PermissionSet
@throws EFapsException on error | [
"Gets",
"the",
"PermissionSet",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/access/user/Evaluation.java#L86-L105 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/access/user/Evaluation.java | Evaluation.getStatus | public static Status getStatus(final Instance _instance)
throws EFapsException
{
Evaluation.LOG.debug("Retrieving Status for {}", _instance);
long statusId = 0;
if (_instance.getType().isCheckStatus()) {
final Cache<String, Long> cache = AccessCache.getStatusCache();
if (cache.containsKey(_instance.getKey())) {
statusId = cache.get(_instance.getKey());
} else {
final PrintQuery print = new PrintQuery(_instance);
print.addAttribute(_instance.getType().getStatusAttribute());
print.executeWithoutAccessCheck();
final Long statusIdTmp = print.getAttribute(_instance.getType().getStatusAttribute());
statusId = statusIdTmp == null ? 0 : statusIdTmp;
cache.put(_instance.getKey(), statusId);
}
}
final Status ret = statusId > 0 ? Status.get(statusId) : null;
Evaluation.LOG.debug("Retrieve Status: {}", ret);
return ret;
} | java | public static Status getStatus(final Instance _instance)
throws EFapsException
{
Evaluation.LOG.debug("Retrieving Status for {}", _instance);
long statusId = 0;
if (_instance.getType().isCheckStatus()) {
final Cache<String, Long> cache = AccessCache.getStatusCache();
if (cache.containsKey(_instance.getKey())) {
statusId = cache.get(_instance.getKey());
} else {
final PrintQuery print = new PrintQuery(_instance);
print.addAttribute(_instance.getType().getStatusAttribute());
print.executeWithoutAccessCheck();
final Long statusIdTmp = print.getAttribute(_instance.getType().getStatusAttribute());
statusId = statusIdTmp == null ? 0 : statusIdTmp;
cache.put(_instance.getKey(), statusId);
}
}
final Status ret = statusId > 0 ? Status.get(statusId) : null;
Evaluation.LOG.debug("Retrieve Status: {}", ret);
return ret;
} | [
"public",
"static",
"Status",
"getStatus",
"(",
"final",
"Instance",
"_instance",
")",
"throws",
"EFapsException",
"{",
"Evaluation",
".",
"LOG",
".",
"debug",
"(",
"\"Retrieving Status for {}\"",
",",
"_instance",
")",
";",
"long",
"statusId",
"=",
"0",
";",
... | Gets the status.
@param _instance the instance
@return the status
@throws EFapsException on error | [
"Gets",
"the",
"status",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/access/user/Evaluation.java#L170-L191 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/access/user/Evaluation.java | Evaluation.evalStatus | public static void evalStatus(final Collection<Instance> _instances)
throws EFapsException
{
Evaluation.LOG.debug("Evaluating Status for {}", _instances);
if (CollectionUtils.isNotEmpty(_instances)) {
final Cache<String, Long> cache = AccessCache.getStatusCache();
final List<Instance> instances = _instances.stream().filter(inst -> !cache.containsKey(inst.getKey()))
.collect(Collectors.toList());
if (!instances.isEmpty()) {
final Attribute attr = instances.get(0).getType().getStatusAttribute();
final MultiPrintQuery multi = new MultiPrintQuery(instances);
multi.addAttribute(attr);
multi.executeWithoutAccessCheck();
while (multi.next()) {
final Long statusId = multi.getAttribute(attr);
cache.put(multi.getCurrentInstance().getKey(), statusId == null ? 0 : statusId);
}
}
}
} | java | public static void evalStatus(final Collection<Instance> _instances)
throws EFapsException
{
Evaluation.LOG.debug("Evaluating Status for {}", _instances);
if (CollectionUtils.isNotEmpty(_instances)) {
final Cache<String, Long> cache = AccessCache.getStatusCache();
final List<Instance> instances = _instances.stream().filter(inst -> !cache.containsKey(inst.getKey()))
.collect(Collectors.toList());
if (!instances.isEmpty()) {
final Attribute attr = instances.get(0).getType().getStatusAttribute();
final MultiPrintQuery multi = new MultiPrintQuery(instances);
multi.addAttribute(attr);
multi.executeWithoutAccessCheck();
while (multi.next()) {
final Long statusId = multi.getAttribute(attr);
cache.put(multi.getCurrentInstance().getKey(), statusId == null ? 0 : statusId);
}
}
}
} | [
"public",
"static",
"void",
"evalStatus",
"(",
"final",
"Collection",
"<",
"Instance",
">",
"_instances",
")",
"throws",
"EFapsException",
"{",
"Evaluation",
".",
"LOG",
".",
"debug",
"(",
"\"Evaluating Status for {}\"",
",",
"_instances",
")",
";",
"if",
"(",
... | Eval status.
@param _instances the instances
@throws EFapsException on error | [
"Eval",
"status",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/access/user/Evaluation.java#L199-L218 | train |
Karumien/jasper-utils | src/main/java/cz/i24/util/jasper/RU.java | RU.addZerosBefore | public static String addZerosBefore(String orderNo, int count) {
if (orderNo == null) {
return "";// orderNo = "";
}
if (orderNo.length() > count) {
orderNo = "?" + orderNo.substring(orderNo.length() - count - 1, orderNo.length() - 1);
} else {
int le = orderNo.length();
for (int i = 0; i < count - le; i++) {
orderNo = "0" + orderNo;
}
}
return orderNo;
} | java | public static String addZerosBefore(String orderNo, int count) {
if (orderNo == null) {
return "";// orderNo = "";
}
if (orderNo.length() > count) {
orderNo = "?" + orderNo.substring(orderNo.length() - count - 1, orderNo.length() - 1);
} else {
int le = orderNo.length();
for (int i = 0; i < count - le; i++) {
orderNo = "0" + orderNo;
}
}
return orderNo;
} | [
"public",
"static",
"String",
"addZerosBefore",
"(",
"String",
"orderNo",
",",
"int",
"count",
")",
"{",
"if",
"(",
"orderNo",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"// orderNo = \"\";\r",
"}",
"if",
"(",
"orderNo",
".",
"length",
"(",
")",
">",... | Method addZerosBefore.
@param orderNo
@param count
@return String | [
"Method",
"addZerosBefore",
"."
] | 7abc795511aca090089e404c14763b13cbeade72 | https://github.com/Karumien/jasper-utils/blob/7abc795511aca090089e404c14763b13cbeade72/src/main/java/cz/i24/util/jasper/RU.java#L1061-L1080 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.getSeries | public Map<String, Set<DataPoint>> getSeries() {
return new HashMap<String, Set<DataPoint>>(store);
} | java | public Map<String, Set<DataPoint>> getSeries() {
return new HashMap<String, Set<DataPoint>>(store);
} | [
"public",
"Map",
"<",
"String",
",",
"Set",
"<",
"DataPoint",
">",
">",
"getSeries",
"(",
")",
"{",
"return",
"new",
"HashMap",
"<",
"String",
",",
"Set",
"<",
"DataPoint",
">",
">",
"(",
"store",
")",
";",
"}"
] | Gets a mapping from series to an unordered set of DataPoints.
@return Mapping from a series name to unordered set of data. | [
"Gets",
"a",
"mapping",
"from",
"series",
"to",
"an",
"unordered",
"set",
"of",
"DataPoints",
"."
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L98-L100 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.addDataPoint | public void addDataPoint(String series, DataPoint dataPoint) {
DataSet set = store.get(series);
if (set == null) {
set = new DataSet();
store.put(series, set);
}
set.add(dataPoint);
} | java | public void addDataPoint(String series, DataPoint dataPoint) {
DataSet set = store.get(series);
if (set == null) {
set = new DataSet();
store.put(series, set);
}
set.add(dataPoint);
} | [
"public",
"void",
"addDataPoint",
"(",
"String",
"series",
",",
"DataPoint",
"dataPoint",
")",
"{",
"DataSet",
"set",
"=",
"store",
".",
"get",
"(",
"series",
")",
";",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"set",
"=",
"new",
"DataSet",
"(",
")",... | Adds a new data point to a particular series.
@param series The series this data point should be added to. If it doesn't exist, it will
be created.
@param dataPoint Data to be added. | [
"Adds",
"a",
"new",
"data",
"point",
"to",
"a",
"particular",
"series",
"."
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L119-L126 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.addDataPointSet | public void addDataPointSet(String series, Set<DataPoint> dataPoints) {
DataSet set = store.get(series);
if (set == null) {
set = new DataSet(dataPoints);
store.put(series, set);
} else {
set.addAll(dataPoints);
}
} | java | public void addDataPointSet(String series, Set<DataPoint> dataPoints) {
DataSet set = store.get(series);
if (set == null) {
set = new DataSet(dataPoints);
store.put(series, set);
} else {
set.addAll(dataPoints);
}
} | [
"public",
"void",
"addDataPointSet",
"(",
"String",
"series",
",",
"Set",
"<",
"DataPoint",
">",
"dataPoints",
")",
"{",
"DataSet",
"set",
"=",
"store",
".",
"get",
"(",
"series",
")",
";",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"set",
"=",
"new",... | Adds a set of `DataPoint`s to a series.
@param series The series the DataPoints should be added to. If the series doesn't exist,
it will be created.
@param dataPoints Data to be added. | [
"Adds",
"a",
"set",
"of",
"DataPoint",
"s",
"to",
"a",
"series",
"."
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L135-L143 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.serialize | public JSONObject serialize(Map<String, Object> out) {
JSONObject json = new JSONObject();
json.put("device_id", deviceId);
json.put("project_id", projectId);
out.put("device_id", deviceId);
out.put("project_id", projectId);
JSONArray sourcesArr = new JSONArray();
List<String> sourceNames = new ArrayList<String>(store.keySet());
Collections.sort(sourceNames);
for (String k : sourceNames) {
JSONObject temp = new JSONObject();
temp.put("name", k);
JSONArray dataArr = new JSONArray();
for (DataPoint d : store.get(k)) {
dataArr.put(d.toJson());
}
temp.put("data", dataArr);
sourcesArr.put(temp);
}
json.put("sources", sourcesArr);
out.put("sources", sourcesArr);
return json;
} | java | public JSONObject serialize(Map<String, Object> out) {
JSONObject json = new JSONObject();
json.put("device_id", deviceId);
json.put("project_id", projectId);
out.put("device_id", deviceId);
out.put("project_id", projectId);
JSONArray sourcesArr = new JSONArray();
List<String> sourceNames = new ArrayList<String>(store.keySet());
Collections.sort(sourceNames);
for (String k : sourceNames) {
JSONObject temp = new JSONObject();
temp.put("name", k);
JSONArray dataArr = new JSONArray();
for (DataPoint d : store.get(k)) {
dataArr.put(d.toJson());
}
temp.put("data", dataArr);
sourcesArr.put(temp);
}
json.put("sources", sourcesArr);
out.put("sources", sourcesArr);
return json;
} | [
"public",
"JSONObject",
"serialize",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"out",
")",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"json",
".",
"put",
"(",
"\"device_id\"",
",",
"deviceId",
")",
";",
"json",
".",
"put",... | Custom serialization method for this object to JSON.
@param out In-out parameter that maps JSON keys to their values.
@return A JSONObject representing this object. | [
"Custom",
"serialization",
"method",
"for",
"this",
"object",
"to",
"JSON",
"."
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L162-L184 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.getVertex | public Vector3D getVertex(int index) {
tmpV.setX(cornerX.get(index));
tmpV.setY(cornerY.get(index));
tmpV.setZ(cornerZ.get(index));
calcG();
return tmpV;
} | java | public Vector3D getVertex(int index) {
tmpV.setX(cornerX.get(index));
tmpV.setY(cornerY.get(index));
tmpV.setZ(cornerZ.get(index));
calcG();
return tmpV;
} | [
"public",
"Vector3D",
"getVertex",
"(",
"int",
"index",
")",
"{",
"tmpV",
".",
"setX",
"(",
"cornerX",
".",
"get",
"(",
"index",
")",
")",
";",
"tmpV",
".",
"setY",
"(",
"cornerY",
".",
"get",
"(",
"index",
")",
")",
";",
"tmpV",
".",
"setZ",
"("... | Gets the corner of Polygon.
@param index The index number of the corner.
@return The coordinates of the corner. | [
"Gets",
"the",
"corner",
"of",
"Polygon",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L116-L122 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.removeVertex | public void removeVertex(int index) {
this.cornerX.remove(index);
this.cornerY.remove(index);
this.cornerZ.remove(index);
if (isGradation() == true) this.cornerColor.remove(index);
setNumberOfCorner(this.cornerX.size());
calcG();
} | java | public void removeVertex(int index) {
this.cornerX.remove(index);
this.cornerY.remove(index);
this.cornerZ.remove(index);
if (isGradation() == true) this.cornerColor.remove(index);
setNumberOfCorner(this.cornerX.size());
calcG();
} | [
"public",
"void",
"removeVertex",
"(",
"int",
"index",
")",
"{",
"this",
".",
"cornerX",
".",
"remove",
"(",
"index",
")",
";",
"this",
".",
"cornerY",
".",
"remove",
"(",
"index",
")",
";",
"this",
".",
"cornerZ",
".",
"remove",
"(",
"index",
")",
... | Removes the corner of Polygon.
@param index The index number of the corner. | [
"Removes",
"the",
"corner",
"of",
"Polygon",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L129-L136 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.setVertex | public void setVertex(int i, double x, double y, double z) {
this.cornerX.set(i, x);
this.cornerY.set(i, y);
this.cornerZ.set(i, z);
calcG();
} | java | public void setVertex(int i, double x, double y, double z) {
this.cornerX.set(i, x);
this.cornerY.set(i, y);
this.cornerZ.set(i, z);
calcG();
} | [
"public",
"void",
"setVertex",
"(",
"int",
"i",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"this",
".",
"cornerX",
".",
"set",
"(",
"i",
",",
"x",
")",
";",
"this",
".",
"cornerY",
".",
"set",
"(",
"i",
",",
"y",
")... | Sets the coordinates of the corner.
@param i The index number of the point.
@param x The x-coordinate of the point.
@param y The y-coordinate of the point.
@param z The z-coordinate of the point. | [
"Sets",
"the",
"coordinates",
"of",
"the",
"corner",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L160-L165 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.setCornerColor | public void setCornerColor(int index, Color color) {
if (cornerColor == null) {
for (int i = 0; i < cornerX.size(); i++) {
cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(),
this.fillColor.getBlue(), this.fillColor.getAlpha()));
}
setGradation(true);
}
if (cornerColor.size() < cornerX.size()) {
while (cornerColor.size() != cornerX.size()) {
cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(),
this.fillColor.getBlue(), this.fillColor.getAlpha()));
}
}
cornerColor.set(index, color);
} | java | public void setCornerColor(int index, Color color) {
if (cornerColor == null) {
for (int i = 0; i < cornerX.size(); i++) {
cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(),
this.fillColor.getBlue(), this.fillColor.getAlpha()));
}
setGradation(true);
}
if (cornerColor.size() < cornerX.size()) {
while (cornerColor.size() != cornerX.size()) {
cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(),
this.fillColor.getBlue(), this.fillColor.getAlpha()));
}
}
cornerColor.set(index, color);
} | [
"public",
"void",
"setCornerColor",
"(",
"int",
"index",
",",
"Color",
"color",
")",
"{",
"if",
"(",
"cornerColor",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cornerX",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
... | Sets the color of a corner.
@param index The index number of a corner.
@param color The color of a corner. | [
"Sets",
"the",
"color",
"of",
"a",
"corner",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L286-L301 | train |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/util/DataPointParser.java | DataPointParser.parse | public static List<DataPoint> parse(int[] values, long ts) {
List<DataPoint> ret = new ArrayList<DataPoint>(values.length);
for (int v : values) {
ret.add(new DataPoint(ts, v));
}
return ret;
} | java | public static List<DataPoint> parse(int[] values, long ts) {
List<DataPoint> ret = new ArrayList<DataPoint>(values.length);
for (int v : values) {
ret.add(new DataPoint(ts, v));
}
return ret;
} | [
"public",
"static",
"List",
"<",
"DataPoint",
">",
"parse",
"(",
"int",
"[",
"]",
"values",
",",
"long",
"ts",
")",
"{",
"List",
"<",
"DataPoint",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"DataPoint",
">",
"(",
"values",
".",
"length",
")",
";",
"... | Takes an array of values and converts it into a list of `DataPoint`s with the same
timestamp.
@param values Array of values to be converted
@param ts Timestamp to use.
@return A List of DataPoints with the same timestamp. | [
"Takes",
"an",
"array",
"of",
"values",
"and",
"converts",
"it",
"into",
"a",
"list",
"of",
"DataPoint",
"s",
"with",
"the",
"same",
"timestamp",
"."
] | 06e7aeb2a313503392358a3671de7d28628d0e33 | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/util/DataPointParser.java#L150-L156 | train |
javactic/javactic | src/main/java/com/github/javactic/Accumulation.java | Accumulation.when | @SuppressWarnings("unchecked")
@SafeVarargs
public static <G, ERR> Or<G, Every<ERR>>
when(Or<? extends G, ? extends Every<? extends ERR>> or, Function<? super G, ? extends Validation<ERR>>... validations) {
return when(or, Stream.of(validations));
} | java | @SuppressWarnings("unchecked")
@SafeVarargs
public static <G, ERR> Or<G, Every<ERR>>
when(Or<? extends G, ? extends Every<? extends ERR>> or, Function<? super G, ? extends Validation<ERR>>... validations) {
return when(or, Stream.of(validations));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"SafeVarargs",
"public",
"static",
"<",
"G",
",",
"ERR",
">",
"Or",
"<",
"G",
",",
"Every",
"<",
"ERR",
">",
">",
"when",
"(",
"Or",
"<",
"?",
"extends",
"G",
",",
"?",
"extends",
"Every",
"<... | Enables further validation on an existing accumulating Or by passing validation functions.
@param <G> the Good type of the argument Or
@param <ERR> the type of the error message contained in the accumulating failure
@param or the accumulating or
@param validations the validation functions
@return the original or if it passed all validations or a Bad with all failures | [
"Enables",
"further",
"validation",
"on",
"an",
"existing",
"accumulating",
"Or",
"by",
"passing",
"validation",
"functions",
"."
] | dfa040062178c259c3067fd9b59cb4498022d8bc | https://github.com/javactic/javactic/blob/dfa040062178c259c3067fd9b59cb4498022d8bc/src/main/java/com/github/javactic/Accumulation.java#L161-L166 | train |
javactic/javactic | src/main/java/com/github/javactic/Accumulation.java | Accumulation.withGood | public static <A, B, ERR, RESULT> Or<RESULT, Every<ERR>> withGood(
Or<? extends A, ? extends Every<? extends ERR>> a,
Or<? extends B, ? extends Every<? extends ERR>> b,
BiFunction<? super A, ? super B, ? extends RESULT> function) {
if (allGood(a, b))
return Good.of(function.apply(a.get(), b.get()));
else {
return getBads(a, b);
}
} | java | public static <A, B, ERR, RESULT> Or<RESULT, Every<ERR>> withGood(
Or<? extends A, ? extends Every<? extends ERR>> a,
Or<? extends B, ? extends Every<? extends ERR>> b,
BiFunction<? super A, ? super B, ? extends RESULT> function) {
if (allGood(a, b))
return Good.of(function.apply(a.get(), b.get()));
else {
return getBads(a, b);
}
} | [
"public",
"static",
"<",
"A",
",",
"B",
",",
"ERR",
",",
"RESULT",
">",
"Or",
"<",
"RESULT",
",",
"Every",
"<",
"ERR",
">",
">",
"withGood",
"(",
"Or",
"<",
"?",
"extends",
"A",
",",
"?",
"extends",
"Every",
"<",
"?",
"extends",
"ERR",
">",
">"... | Combines two accumulating Or into a single one using the given function.
The resulting Or will be a Good if both Ors are Goods, otherwise it will
be a Bad containing every error in the Bads.
@param <A> the success type of the first Or
@param <B> the success type of the second Or
@param <ERR> the error type of the Ors
@param <RESULT> the success type of the resulting Or
@param a the first Or to combine
@param b the second Or to combine
@param function the function combining the Ors
@return a Good if both Ors were Goods, otherwise a Bad with every error. | [
"Combines",
"two",
"accumulating",
"Or",
"into",
"a",
"single",
"one",
"using",
"the",
"given",
"function",
".",
"The",
"resulting",
"Or",
"will",
"be",
"a",
"Good",
"if",
"both",
"Ors",
"are",
"Goods",
"otherwise",
"it",
"will",
"be",
"a",
"Bad",
"conta... | dfa040062178c259c3067fd9b59cb4498022d8bc | https://github.com/javactic/javactic/blob/dfa040062178c259c3067fd9b59cb4498022d8bc/src/main/java/com/github/javactic/Accumulation.java#L236-L245 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.getVertex | public Vector3D getVertex(int i) {
tmpV.setX(x.get(i));
tmpV.setY(y.get(i));
tmpV.setZ(z.get(i));
calcG();
return tmpV;
} | java | public Vector3D getVertex(int i) {
tmpV.setX(x.get(i));
tmpV.setY(y.get(i));
tmpV.setZ(z.get(i));
calcG();
return tmpV;
} | [
"public",
"Vector3D",
"getVertex",
"(",
"int",
"i",
")",
"{",
"tmpV",
".",
"setX",
"(",
"x",
".",
"get",
"(",
"i",
")",
")",
";",
"tmpV",
".",
"setY",
"(",
"y",
".",
"get",
"(",
"i",
")",
")",
";",
"tmpV",
".",
"setZ",
"(",
"z",
".",
"get",... | Gets the coordinates of the point.
@param i The index number of the point.
@return The coordinates of the point. | [
"Gets",
"the",
"coordinates",
"of",
"the",
"point",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L122-L129 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.removeVertex | public void removeVertex(int i) {
this.x.remove(i);
this.y.remove(i);
this.z.remove(i);
this.colors.remove(i);
calcG();
} | java | public void removeVertex(int i) {
this.x.remove(i);
this.y.remove(i);
this.z.remove(i);
this.colors.remove(i);
calcG();
} | [
"public",
"void",
"removeVertex",
"(",
"int",
"i",
")",
"{",
"this",
".",
"x",
".",
"remove",
"(",
"i",
")",
";",
"this",
".",
"y",
".",
"remove",
"(",
"i",
")",
";",
"this",
".",
"z",
".",
"remove",
"(",
"i",
")",
";",
"this",
".",
"colors",... | Removes the point from Lines.
@param i The index number of the point. | [
"Removes",
"the",
"point",
"from",
"Lines",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L136-L142 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.setVertex | public void setVertex(int i, double x, double y) {
this.x.set(i, x);
this.y.set(i, y);
this.z.set(i, 0d);
calcG();
} | java | public void setVertex(int i, double x, double y) {
this.x.set(i, x);
this.y.set(i, y);
this.z.set(i, 0d);
calcG();
} | [
"public",
"void",
"setVertex",
"(",
"int",
"i",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"this",
".",
"x",
".",
"set",
"(",
"i",
",",
"x",
")",
";",
"this",
".",
"y",
".",
"set",
"(",
"i",
",",
"y",
")",
";",
"this",
".",
"z",
".... | Sets the coordinates of the point.
@param i The index number of the point.
@param x The x-coordinate of the point.
@param y The y-coordinate of the point. | [
"Sets",
"the",
"coordinates",
"of",
"the",
"point",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L151-L156 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.setStartCornerColor | public void setStartCornerColor(Color color) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.startColor = color;
} | java | public void setStartCornerColor(Color color) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.startColor = color;
} | [
"public",
"void",
"setStartCornerColor",
"(",
"Color",
"color",
")",
"{",
"if",
"(",
"startColor",
"==",
"null",
")",
"{",
"startColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"}",
"setGradation",
"(",
"true",
")",
";",
... | Sets the start point's color for gradation.
@param color The color of the start point. | [
"Sets",
"the",
"start",
"point",
"s",
"color",
"for",
"gradation",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L264-L270 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.setEndCornerColor | public void setEndCornerColor(Color color) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
} | java | public void setEndCornerColor(Color color) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
} | [
"public",
"void",
"setEndCornerColor",
"(",
"Color",
"color",
")",
"{",
"if",
"(",
"endColor",
"==",
"null",
")",
"{",
"endColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"}",
"setGradation",
"(",
"true",
")",
";",
"this... | Sets the end point's color for gradation.
@param color The color of the end point. | [
"Sets",
"the",
"end",
"point",
"s",
"color",
"for",
"gradation",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L286-L292 | train |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.setCornerColor | public void setCornerColor(int index, Color color) {
if (!cornerGradation) {
cornerGradation = true;
}
colors.set(index, color);
} | java | public void setCornerColor(int index, Color color) {
if (!cornerGradation) {
cornerGradation = true;
}
colors.set(index, color);
} | [
"public",
"void",
"setCornerColor",
"(",
"int",
"index",
",",
"Color",
"color",
")",
"{",
"if",
"(",
"!",
"cornerGradation",
")",
"{",
"cornerGradation",
"=",
"true",
";",
"}",
"colors",
".",
"set",
"(",
"index",
",",
"color",
")",
";",
"}"
] | Sets the point's color for gradation.
@param index The index number of the point.
@param color The color of the point. | [
"Sets",
"the",
"point",
"s",
"color",
"for",
"gradation",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L309-L314 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.hasTransitionTo | public boolean hasTransitionTo(CharRange condition, NFAState<T> state)
{
Set<Transition<NFAState<T>>> set = transitions.get(condition);
if (set != null)
{
for (Transition<NFAState<T>> tr : set)
{
if (state.equals(tr.getTo()))
{
return true;
}
}
}
return false;
} | java | public boolean hasTransitionTo(CharRange condition, NFAState<T> state)
{
Set<Transition<NFAState<T>>> set = transitions.get(condition);
if (set != null)
{
for (Transition<NFAState<T>> tr : set)
{
if (state.equals(tr.getTo()))
{
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"hasTransitionTo",
"(",
"CharRange",
"condition",
",",
"NFAState",
"<",
"T",
">",
"state",
")",
"{",
"Set",
"<",
"Transition",
"<",
"NFAState",
"<",
"T",
">>>",
"set",
"=",
"transitions",
".",
"get",
"(",
"condition",
")",
";",
"if",... | Returns true if transition with condition to state exists
@param condition
@param state
@return | [
"Returns",
"true",
"if",
"transition",
"with",
"condition",
"to",
"state",
"exists"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L126-L140 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.getConditionsTo | public RangeSet getConditionsTo(NFAState<T> state)
{
RangeSet rs = new RangeSet();
for (CharRange range : transitions.keySet())
{
if (range != null)
{
Set<Transition<NFAState<T>>> set2 = transitions.get(range);
for (Transition<NFAState<T>> tr : set2)
{
if (state.equals(tr.getTo()))
{
rs.add(range);
}
}
}
}
return rs;
} | java | public RangeSet getConditionsTo(NFAState<T> state)
{
RangeSet rs = new RangeSet();
for (CharRange range : transitions.keySet())
{
if (range != null)
{
Set<Transition<NFAState<T>>> set2 = transitions.get(range);
for (Transition<NFAState<T>> tr : set2)
{
if (state.equals(tr.getTo()))
{
rs.add(range);
}
}
}
}
return rs;
} | [
"public",
"RangeSet",
"getConditionsTo",
"(",
"NFAState",
"<",
"T",
">",
"state",
")",
"{",
"RangeSet",
"rs",
"=",
"new",
"RangeSet",
"(",
")",
";",
"for",
"(",
"CharRange",
"range",
":",
"transitions",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"... | Returns non epsilon confitions to transit to given state
@param state
@return | [
"Returns",
"non",
"epsilon",
"confitions",
"to",
"transit",
"to",
"given",
"state"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L218-L237 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.isSingleEpsilonOnly | public static boolean isSingleEpsilonOnly(Set<Transition<NFAState>> set)
{
if (set.size() != 1)
{
return false;
}
for (Transition<NFAState> tr : set)
{
if (tr.isEpsilon())
{
return true;
}
}
return false;
} | java | public static boolean isSingleEpsilonOnly(Set<Transition<NFAState>> set)
{
if (set.size() != 1)
{
return false;
}
for (Transition<NFAState> tr : set)
{
if (tr.isEpsilon())
{
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isSingleEpsilonOnly",
"(",
"Set",
"<",
"Transition",
"<",
"NFAState",
">",
">",
"set",
")",
"{",
"if",
"(",
"set",
".",
"size",
"(",
")",
"!=",
"1",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"Transition",
"<",... | Returns true if set only has one epsilon transition.
@param set
@return | [
"Returns",
"true",
"if",
"set",
"only",
"has",
"one",
"epsilon",
"transition",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L295-L309 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.isDeadEnd | boolean isDeadEnd(Set<NFAState<T>> nfaSet)
{
for (Set<Transition<NFAState<T>>> set : transitions.values())
{
for (Transition<NFAState<T>> t : set)
{
if (!nfaSet.contains(t.getTo()))
{
return false;
}
}
}
return true;
} | java | boolean isDeadEnd(Set<NFAState<T>> nfaSet)
{
for (Set<Transition<NFAState<T>>> set : transitions.values())
{
for (Transition<NFAState<T>> t : set)
{
if (!nfaSet.contains(t.getTo()))
{
return false;
}
}
}
return true;
} | [
"boolean",
"isDeadEnd",
"(",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"nfaSet",
")",
"{",
"for",
"(",
"Set",
"<",
"Transition",
"<",
"NFAState",
"<",
"T",
">",
">",
">",
"set",
":",
"transitions",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",... | Returns true if this state is not accepting and doesn't have any outbound
transitions.
@param nfaSet
@return | [
"Returns",
"true",
"if",
"this",
"state",
"is",
"not",
"accepting",
"and",
"doesn",
"t",
"have",
"any",
"outbound",
"transitions",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L328-L341 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.constructDFA | public DFAState<T> constructDFA(Scope<DFAState<T>> dfaScope)
{
Map<Set<NFAState<T>>,DFAState<T>> all = new HashMap<>();
Deque<DFAState<T>> unmarked = new ArrayDeque<>();
Set<NFAState<T>> startSet = epsilonClosure(dfaScope);
DFAState<T> startDfa = new DFAState<>(dfaScope, startSet);
all.put(startSet, startDfa);
unmarked.add(startDfa);
while (!unmarked.isEmpty())
{
DFAState<T> dfa = unmarked.pop();
for (CharRange c : dfa.possibleMoves())
{
Set<NFAState<T>> moveSet = dfa.nfaTransitsFor(c);
if (!moveSet.isEmpty())
{
Set<NFAState<T>> newSet = epsilonClosure(dfaScope, moveSet);
DFAState<T> ndfa = all.get(newSet);
if (ndfa == null)
{
ndfa = new DFAState<>(dfaScope, newSet);
all.put(newSet, ndfa);
unmarked.add(ndfa);
}
dfa.addTransition(c, ndfa);
}
}
}
// optimize
for (DFAState<T> dfa : all.values())
{
dfa.removeTransitionsFromAcceptImmediatelyStates();
}
for (DFAState<T> dfa : all.values())
{
dfa.removeDeadEndTransitions();
}
for (DFAState<T> dfa : startDfa)
{
dfa.optimizeTransitions();
}
return startDfa;
} | java | public DFAState<T> constructDFA(Scope<DFAState<T>> dfaScope)
{
Map<Set<NFAState<T>>,DFAState<T>> all = new HashMap<>();
Deque<DFAState<T>> unmarked = new ArrayDeque<>();
Set<NFAState<T>> startSet = epsilonClosure(dfaScope);
DFAState<T> startDfa = new DFAState<>(dfaScope, startSet);
all.put(startSet, startDfa);
unmarked.add(startDfa);
while (!unmarked.isEmpty())
{
DFAState<T> dfa = unmarked.pop();
for (CharRange c : dfa.possibleMoves())
{
Set<NFAState<T>> moveSet = dfa.nfaTransitsFor(c);
if (!moveSet.isEmpty())
{
Set<NFAState<T>> newSet = epsilonClosure(dfaScope, moveSet);
DFAState<T> ndfa = all.get(newSet);
if (ndfa == null)
{
ndfa = new DFAState<>(dfaScope, newSet);
all.put(newSet, ndfa);
unmarked.add(ndfa);
}
dfa.addTransition(c, ndfa);
}
}
}
// optimize
for (DFAState<T> dfa : all.values())
{
dfa.removeTransitionsFromAcceptImmediatelyStates();
}
for (DFAState<T> dfa : all.values())
{
dfa.removeDeadEndTransitions();
}
for (DFAState<T> dfa : startDfa)
{
dfa.optimizeTransitions();
}
return startDfa;
} | [
"public",
"DFAState",
"<",
"T",
">",
"constructDFA",
"(",
"Scope",
"<",
"DFAState",
"<",
"T",
">",
">",
"dfaScope",
")",
"{",
"Map",
"<",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
",",
"DFAState",
"<",
"T",
">",
">",
"all",
"=",
"new",
"HashMap... | Construct a dfa by using this state as starting state.
@param dfaScope
@return | [
"Construct",
"a",
"dfa",
"by",
"using",
"this",
"state",
"as",
"starting",
"state",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L347-L389 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.getConditions | RangeSet getConditions()
{
RangeSet is = new RangeSet();
for (CharRange ic : transitions.keySet())
{
if (ic != null)
{
is.add(ic);
}
}
return is;
} | java | RangeSet getConditions()
{
RangeSet is = new RangeSet();
for (CharRange ic : transitions.keySet())
{
if (ic != null)
{
is.add(ic);
}
}
return is;
} | [
"RangeSet",
"getConditions",
"(",
")",
"{",
"RangeSet",
"is",
"=",
"new",
"RangeSet",
"(",
")",
";",
"for",
"(",
"CharRange",
"ic",
":",
"transitions",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"ic",
"!=",
"null",
")",
"{",
"is",
".",
"add",
... | Returns all ranges from all transitions
@return | [
"Returns",
"all",
"ranges",
"from",
"all",
"transitions"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L394-L405 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.epsilonTransitions | private Set<NFAState<T>> epsilonTransitions(StateVisitSet<NFAState<T>> marked)
{
marked.add(this);
Set<NFAState<T>> set = new HashSet<>();
for (NFAState<T> nfa : epsilonTransit())
{
if (!marked.contains(nfa))
{
set.add(nfa);
set.addAll(nfa.epsilonTransitions(marked));
}
}
return set;
} | java | private Set<NFAState<T>> epsilonTransitions(StateVisitSet<NFAState<T>> marked)
{
marked.add(this);
Set<NFAState<T>> set = new HashSet<>();
for (NFAState<T> nfa : epsilonTransit())
{
if (!marked.contains(nfa))
{
set.add(nfa);
set.addAll(nfa.epsilonTransitions(marked));
}
}
return set;
} | [
"private",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"epsilonTransitions",
"(",
"StateVisitSet",
"<",
"NFAState",
"<",
"T",
">",
">",
"marked",
")",
"{",
"marked",
".",
"add",
"(",
"this",
")",
";",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"se... | Returns a set of states that can be reached by epsilon transitions.
@param marked
@return | [
"Returns",
"a",
"set",
"of",
"states",
"that",
"can",
"be",
"reached",
"by",
"epsilon",
"transitions",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L411-L424 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.epsilonClosure | public Set<NFAState<T>> epsilonClosure(Scope<DFAState<T>> scope)
{
Set<NFAState<T>> set = new HashSet<>();
set.add(this);
return epsilonClosure(scope, set);
} | java | public Set<NFAState<T>> epsilonClosure(Scope<DFAState<T>> scope)
{
Set<NFAState<T>> set = new HashSet<>();
set.add(this);
return epsilonClosure(scope, set);
} | [
"public",
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"epsilonClosure",
"(",
"Scope",
"<",
"DFAState",
"<",
"T",
">",
">",
"scope",
")",
"{",
"Set",
"<",
"NFAState",
"<",
"T",
">>",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"set",
".",
... | Creates a dfa state from all nfa states that can be reached from this state
with epsilon move.
@param scope
@return | [
"Creates",
"a",
"dfa",
"state",
"from",
"all",
"nfa",
"states",
"that",
"can",
"be",
"reached",
"from",
"this",
"state",
"with",
"epsilon",
"move",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L431-L436 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.addTransition | public void addTransition(RangeSet rs, NFAState<T> to)
{
for (CharRange c : rs)
{
addTransition(c, to);
}
edges.add(to);
to.inStates.add(this);
} | java | public void addTransition(RangeSet rs, NFAState<T> to)
{
for (CharRange c : rs)
{
addTransition(c, to);
}
edges.add(to);
to.inStates.add(this);
} | [
"public",
"void",
"addTransition",
"(",
"RangeSet",
"rs",
",",
"NFAState",
"<",
"T",
">",
"to",
")",
"{",
"for",
"(",
"CharRange",
"c",
":",
"rs",
")",
"{",
"addTransition",
"(",
"c",
",",
"to",
")",
";",
"}",
"edges",
".",
"add",
"(",
"to",
")",... | Adds a set of transitions
@param rs
@param to | [
"Adds",
"a",
"set",
"of",
"transitions"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L483-L491 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.addTransition | public Transition<NFAState<T>> addTransition(CharRange condition, NFAState<T> to)
{
Transition<NFAState<T>> t = new Transition<>(condition, this, to);
Set<Transition<NFAState<T>>> set = transitions.get(t.getCondition());
if (set == null)
{
set = new HashSet<>();
transitions.put(t.getCondition(), set);
}
set.add(t);
edges.add(to);
to.inStates.add(this);
return t;
} | java | public Transition<NFAState<T>> addTransition(CharRange condition, NFAState<T> to)
{
Transition<NFAState<T>> t = new Transition<>(condition, this, to);
Set<Transition<NFAState<T>>> set = transitions.get(t.getCondition());
if (set == null)
{
set = new HashSet<>();
transitions.put(t.getCondition(), set);
}
set.add(t);
edges.add(to);
to.inStates.add(this);
return t;
} | [
"public",
"Transition",
"<",
"NFAState",
"<",
"T",
">",
">",
"addTransition",
"(",
"CharRange",
"condition",
",",
"NFAState",
"<",
"T",
">",
"to",
")",
"{",
"Transition",
"<",
"NFAState",
"<",
"T",
">>",
"t",
"=",
"new",
"Transition",
"<>",
"(",
"condi... | Adds a transition
@param condition
@param to
@return | [
"Adds",
"a",
"transition"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L498-L511 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/NFAState.java | NFAState.addEpsilon | public void addEpsilon(NFAState<T> to)
{
Transition<NFAState<T>> t = new Transition<>(this, to);
Set<Transition<NFAState<T>>> set = transitions.get(null);
if (set == null)
{
set = new HashSet<>();
transitions.put(null, set);
}
set.add(t);
edges.add(to);
to.inStates.add(this);
} | java | public void addEpsilon(NFAState<T> to)
{
Transition<NFAState<T>> t = new Transition<>(this, to);
Set<Transition<NFAState<T>>> set = transitions.get(null);
if (set == null)
{
set = new HashSet<>();
transitions.put(null, set);
}
set.add(t);
edges.add(to);
to.inStates.add(this);
} | [
"public",
"void",
"addEpsilon",
"(",
"NFAState",
"<",
"T",
">",
"to",
")",
"{",
"Transition",
"<",
"NFAState",
"<",
"T",
">>",
"t",
"=",
"new",
"Transition",
"<>",
"(",
"this",
",",
"to",
")",
";",
"Set",
"<",
"Transition",
"<",
"NFAState",
"<",
"T... | Adds a epsilon transition
@param to | [
"Adds",
"a",
"epsilon",
"transition"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/NFAState.java#L516-L528 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/print/value/AbstractValueSelect.java | AbstractValueSelect.addChildValueSelect | public void addChildValueSelect(final AbstractValueSelect _valueSelect)
throws EFapsException
{
if (this.child == null) {
this.child = _valueSelect;
_valueSelect.setParentValueSelect(this);
} else {
this.child.addChildValueSelect(_valueSelect);
}
} | java | public void addChildValueSelect(final AbstractValueSelect _valueSelect)
throws EFapsException
{
if (this.child == null) {
this.child = _valueSelect;
_valueSelect.setParentValueSelect(this);
} else {
this.child.addChildValueSelect(_valueSelect);
}
} | [
"public",
"void",
"addChildValueSelect",
"(",
"final",
"AbstractValueSelect",
"_valueSelect",
")",
"throws",
"EFapsException",
"{",
"if",
"(",
"this",
".",
"child",
"==",
"null",
")",
"{",
"this",
".",
"child",
"=",
"_valueSelect",
";",
"_valueSelect",
".",
"s... | Method adds an AbstractValueSelect as a child of this chain of
AbstractValueSelect.
@param _valueSelect AbstractValueSelect to be added as child
@throws EFapsException on error | [
"Method",
"adds",
"an",
"AbstractValueSelect",
"as",
"a",
"child",
"of",
"this",
"chain",
"of",
"AbstractValueSelect",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/value/AbstractValueSelect.java#L136-L145 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/print/value/AbstractValueSelect.java | AbstractValueSelect.getValue | public Object getValue(final List<Object> _objectList)
throws EFapsException
{
final List<Object> ret = new ArrayList<Object>();
for (final Object object : _objectList) {
ret.add(getValue(object));
}
return _objectList.size() > 0 ? (ret.size() > 1 ? ret : ret.get(0)) : null;
} | java | public Object getValue(final List<Object> _objectList)
throws EFapsException
{
final List<Object> ret = new ArrayList<Object>();
for (final Object object : _objectList) {
ret.add(getValue(object));
}
return _objectList.size() > 0 ? (ret.size() > 1 ? ret : ret.get(0)) : null;
} | [
"public",
"Object",
"getValue",
"(",
"final",
"List",
"<",
"Object",
">",
"_objectList",
")",
"throws",
"EFapsException",
"{",
"final",
"List",
"<",
"Object",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"for",
"(",
"final",
... | Method to get the value for a list of object.
@param _objectList list of objects
@throws EFapsException on error
@return object | [
"Method",
"to",
"get",
"the",
"value",
"for",
"a",
"list",
"of",
"object",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/value/AbstractValueSelect.java#L187-L195 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/runner/SQLRunner.java | SQLRunner.preparePrint | private void preparePrint(final AbstractPrint _print) throws EFapsException {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLSelect(sqlSelect);
}
}
}
if (sqlSelect.getColumns().size() > 0) {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLWhere(sqlSelect.getWhere());
}
}
}
if (_print instanceof ObjectPrint) {
addWhere4ObjectPrint((ObjectPrint) _print);
} else if (_print instanceof ListPrint) {
addWhere4ListPrint((ListPrint) _print);
} else {
addTypeCriteria((QueryPrint) _print);
addWhere4QueryPrint((QueryPrint) _print);
}
addCompanyCriteria(_print);
}
} | java | private void preparePrint(final AbstractPrint _print) throws EFapsException {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLSelect(sqlSelect);
}
}
}
if (sqlSelect.getColumns().size() > 0) {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLWhere(sqlSelect.getWhere());
}
}
}
if (_print instanceof ObjectPrint) {
addWhere4ObjectPrint((ObjectPrint) _print);
} else if (_print instanceof ListPrint) {
addWhere4ListPrint((ListPrint) _print);
} else {
addTypeCriteria((QueryPrint) _print);
addWhere4QueryPrint((QueryPrint) _print);
}
addCompanyCriteria(_print);
}
} | [
"private",
"void",
"preparePrint",
"(",
"final",
"AbstractPrint",
"_print",
")",
"throws",
"EFapsException",
"{",
"for",
"(",
"final",
"Select",
"select",
":",
"_print",
".",
"getSelection",
"(",
")",
".",
"getAllSelects",
"(",
")",
")",
"{",
"for",
"(",
"... | Prepare print.
@param _print the print
@throws EFapsException the e faps exception | [
"Prepare",
"print",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L250-L276 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/runner/SQLRunner.java | SQLRunner.addTypeCriteria | private void addTypeCriteria(final QueryPrint _print)
{
final MultiValuedMap<TableIdx, TypeCriteria> typeCriterias = MultiMapUtils.newListValuedHashMap();
final List<Type> types = _print.getTypes().stream()
.sorted((type1, type2) -> Long.compare(type1.getId(), type2.getId()))
.collect(Collectors.toList());
for (final Type type : types) {
final String tableName = type.getMainTable().getSqlTable();
final TableIdx tableIdx = sqlSelect.getIndexer().getTableIdx(tableName);
if (tableIdx.isCreated()) {
sqlSelect.from(tableIdx.getTable(), tableIdx.getIdx());
}
if (type.getMainTable().getSqlColType() != null) {
typeCriterias.put(tableIdx, new TypeCriteria(type.getMainTable().getSqlColType(), type.getId()));
}
}
if (!typeCriterias.isEmpty()) {
final SQLWhere where = sqlSelect.getWhere();
for (final TableIdx tableIdx : typeCriterias.keySet()) {
final Collection<TypeCriteria> criterias = typeCriterias.get(tableIdx);
final Iterator<TypeCriteria> iter = criterias.iterator();
final TypeCriteria typeCriteria = iter.next();
final Criteria criteria = where.addCriteria(tableIdx.getIdx(), typeCriteria.sqlColType,
iter.hasNext() ? Comparison.IN : Comparison.EQUAL,
String.valueOf(typeCriteria.id), Connection.AND);
while (iter.hasNext()) {
criteria.value(String.valueOf(iter.next().id));
}
}
}
} | java | private void addTypeCriteria(final QueryPrint _print)
{
final MultiValuedMap<TableIdx, TypeCriteria> typeCriterias = MultiMapUtils.newListValuedHashMap();
final List<Type> types = _print.getTypes().stream()
.sorted((type1, type2) -> Long.compare(type1.getId(), type2.getId()))
.collect(Collectors.toList());
for (final Type type : types) {
final String tableName = type.getMainTable().getSqlTable();
final TableIdx tableIdx = sqlSelect.getIndexer().getTableIdx(tableName);
if (tableIdx.isCreated()) {
sqlSelect.from(tableIdx.getTable(), tableIdx.getIdx());
}
if (type.getMainTable().getSqlColType() != null) {
typeCriterias.put(tableIdx, new TypeCriteria(type.getMainTable().getSqlColType(), type.getId()));
}
}
if (!typeCriterias.isEmpty()) {
final SQLWhere where = sqlSelect.getWhere();
for (final TableIdx tableIdx : typeCriterias.keySet()) {
final Collection<TypeCriteria> criterias = typeCriterias.get(tableIdx);
final Iterator<TypeCriteria> iter = criterias.iterator();
final TypeCriteria typeCriteria = iter.next();
final Criteria criteria = where.addCriteria(tableIdx.getIdx(), typeCriteria.sqlColType,
iter.hasNext() ? Comparison.IN : Comparison.EQUAL,
String.valueOf(typeCriteria.id), Connection.AND);
while (iter.hasNext()) {
criteria.value(String.valueOf(iter.next().id));
}
}
}
} | [
"private",
"void",
"addTypeCriteria",
"(",
"final",
"QueryPrint",
"_print",
")",
"{",
"final",
"MultiValuedMap",
"<",
"TableIdx",
",",
"TypeCriteria",
">",
"typeCriterias",
"=",
"MultiMapUtils",
".",
"newListValuedHashMap",
"(",
")",
";",
"final",
"List",
"<",
"... | Adds the type criteria.
@param _print the print | [
"Adds",
"the",
"type",
"criteria",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L367-L400 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/runner/SQLRunner.java | SQLRunner.executeUpdates | private void executeUpdates()
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) {
((SQLUpdate) entry.getValue()).execute(con);
}
} catch (final SQLException e) {
throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e);
}
} | java | private void executeUpdates()
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) {
((SQLUpdate) entry.getValue()).execute(con);
}
} catch (final SQLException e) {
throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e);
}
} | [
"private",
"void",
"executeUpdates",
"(",
")",
"throws",
"EFapsException",
"{",
"ConnectionResource",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"Context",
".",
"getThreadContext",
"(",
")",
".",
"getConnectionResource",
"(",
")",
";",
"for",
"(",
"fin... | Execute the update.
@throws EFapsException the e faps exception | [
"Execute",
"the",
"update",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L508-L520 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/runner/SQLRunner.java | SQLRunner.executeSQLStmt | @SuppressWarnings("unchecked")
protected boolean executeSQLStmt(final ISelectionProvider _sqlProvider, final String _complStmt)
throws EFapsException
{
SQLRunner.LOG.debug("SQL-Statement: {}", _complStmt);
boolean ret = false;
List<Object[]> rows = new ArrayList<>();
boolean cached = false;
if (runnable.has(StmtFlag.REQCACHED)) {
final QueryKey querykey = QueryKey.get(Context.getThreadContext().getRequestId(), _complStmt);
final Cache<QueryKey, Object> cache = QueryCache.getSqlCache();
if (cache.containsKey(querykey)) {
final Object object = cache.get(querykey);
if (object instanceof List) {
rows = (List<Object[]>) object;
}
cached = true;
}
}
if (!cached) {
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt);
final ArrayListHandler handler = new ArrayListHandler(Context.getDbType().getRowProcessor());
rows = handler.handle(rs);
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e);
}
if (runnable.has(StmtFlag.REQCACHED)) {
final ICacheDefinition cacheDefinition = new ICacheDefinition() {
@Override
public long getLifespan()
{
return 5;
}
@Override
public TimeUnit getLifespanUnit()
{
return TimeUnit.MINUTES;
}
};
QueryCache.put(cacheDefinition, QueryKey.get(Context.getThreadContext().getRequestId(), _complStmt), rows);
}
}
for (final Object[] row : rows) {
for (final Select select : _sqlProvider.getSelection().getAllSelects()) {
select.addObject(row);
}
ret = true;
}
return ret;
} | java | @SuppressWarnings("unchecked")
protected boolean executeSQLStmt(final ISelectionProvider _sqlProvider, final String _complStmt)
throws EFapsException
{
SQLRunner.LOG.debug("SQL-Statement: {}", _complStmt);
boolean ret = false;
List<Object[]> rows = new ArrayList<>();
boolean cached = false;
if (runnable.has(StmtFlag.REQCACHED)) {
final QueryKey querykey = QueryKey.get(Context.getThreadContext().getRequestId(), _complStmt);
final Cache<QueryKey, Object> cache = QueryCache.getSqlCache();
if (cache.containsKey(querykey)) {
final Object object = cache.get(querykey);
if (object instanceof List) {
rows = (List<Object[]>) object;
}
cached = true;
}
}
if (!cached) {
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt);
final ArrayListHandler handler = new ArrayListHandler(Context.getDbType().getRowProcessor());
rows = handler.handle(rs);
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e);
}
if (runnable.has(StmtFlag.REQCACHED)) {
final ICacheDefinition cacheDefinition = new ICacheDefinition() {
@Override
public long getLifespan()
{
return 5;
}
@Override
public TimeUnit getLifespanUnit()
{
return TimeUnit.MINUTES;
}
};
QueryCache.put(cacheDefinition, QueryKey.get(Context.getThreadContext().getRequestId(), _complStmt), rows);
}
}
for (final Object[] row : rows) {
for (final Select select : _sqlProvider.getSelection().getAllSelects()) {
select.addObject(row);
}
ret = true;
}
return ret;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"boolean",
"executeSQLStmt",
"(",
"final",
"ISelectionProvider",
"_sqlProvider",
",",
"final",
"String",
"_complStmt",
")",
"throws",
"EFapsException",
"{",
"SQLRunner",
".",
"LOG",
".",
"debug",
"(",
... | Execute SQL stmt.
@param _sqlProvider the sql provider
@param _complStmt the compl stmt
@return true, if successful
@throws EFapsException the e faps exception | [
"Execute",
"SQL",
"stmt",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L560-L619 | train |
labai/ted | ted-driver/src/main/java/ted/driver/sys/EventQueueManager.java | EventQueueManager.processTedQueue | void processTedQueue() {
int totalProcessing = context.taskManager.calcWaitingTaskCountInAllChannels();
if (totalProcessing >= TaskManager.LIMIT_TOTAL_WAIT_TASKS) {
logger.warn("Total size of waiting tasks ({}) already exceeded limit ({}), skip this iteration (2)", totalProcessing, TaskManager.LIMIT_TOTAL_WAIT_TASKS);
return;
}
Channel channel = context.registry.getChannelOrMain(Model.CHANNEL_QUEUE);
int maxTask = context.taskManager.calcChannelBufferFree(channel);
maxTask = Math.min(maxTask, 50);
Map<String, Integer> channelSizes = new HashMap<String, Integer>();
channelSizes.put(Model.CHANNEL_QUEUE, maxTask);
List<TaskRec> heads = tedDao.reserveTaskPortion(channelSizes);
if (heads.isEmpty())
return;
for (final TaskRec head : heads) {
logger.debug("exec eventQueue for '{}', headTaskId={}", head.key1, head.taskId);
channel.workers.execute(new TedRunnable(head) {
@Override
public void run() {
processEventQueue(head);
}
});
}
} | java | void processTedQueue() {
int totalProcessing = context.taskManager.calcWaitingTaskCountInAllChannels();
if (totalProcessing >= TaskManager.LIMIT_TOTAL_WAIT_TASKS) {
logger.warn("Total size of waiting tasks ({}) already exceeded limit ({}), skip this iteration (2)", totalProcessing, TaskManager.LIMIT_TOTAL_WAIT_TASKS);
return;
}
Channel channel = context.registry.getChannelOrMain(Model.CHANNEL_QUEUE);
int maxTask = context.taskManager.calcChannelBufferFree(channel);
maxTask = Math.min(maxTask, 50);
Map<String, Integer> channelSizes = new HashMap<String, Integer>();
channelSizes.put(Model.CHANNEL_QUEUE, maxTask);
List<TaskRec> heads = tedDao.reserveTaskPortion(channelSizes);
if (heads.isEmpty())
return;
for (final TaskRec head : heads) {
logger.debug("exec eventQueue for '{}', headTaskId={}", head.key1, head.taskId);
channel.workers.execute(new TedRunnable(head) {
@Override
public void run() {
processEventQueue(head);
}
});
}
} | [
"void",
"processTedQueue",
"(",
")",
"{",
"int",
"totalProcessing",
"=",
"context",
".",
"taskManager",
".",
"calcWaitingTaskCountInAllChannels",
"(",
")",
";",
"if",
"(",
"totalProcessing",
">=",
"TaskManager",
".",
"LIMIT_TOTAL_WAIT_TASKS",
")",
"{",
"logger",
"... | heads uniqueness by key1 should be guaranteed by unique index. | [
"heads",
"uniqueness",
"by",
"key1",
"should",
"be",
"guaranteed",
"by",
"unique",
"index",
"."
] | 2ee197246a78d842c18d6780c48fd903b00608a6 | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/EventQueueManager.java#L44-L68 | train |
labai/ted | ted-driver/src/main/java/ted/driver/sys/EventQueueManager.java | EventQueueManager.processEventQueue | private void processEventQueue(final TaskRec head) {
final TedResult headResult = processEvent(head);
TaskConfig tc = context.registry.getTaskConfig(head.name);
if (tc == null) {
context.taskManager.handleUnknownTasks(asList(head));
return;
}
TaskRec lastUnsavedEvent = null;
TedResult lastUnsavedResult = null;
// try to execute next events, while head is reserved. some events may be created while executing current
if (headResult.status == TedStatus.DONE) {
outer:
for (int i = 0; i < 10; i++) {
List<TaskRec> events = tedDaoExt.eventQueueGetTail(head.key1);
if (events.isEmpty())
break outer;
for (TaskRec event : events) {
TaskConfig tc2 = context.registry.getTaskConfig(event.name);
if (tc2 == null)
break outer; // unknown task, leave it for later
TedResult result = processEvent(event);
// DONE - final status, on which can continue with next event
if (result.status == TedStatus.DONE) {
saveResult(event, result);
} else {
lastUnsavedEvent = event;
lastUnsavedResult = result;
break outer;
}
}
}
}
// first save head, otherwise unique index will fail
final TedResult finalLastUnsavedResult = lastUnsavedResult;
final TaskRec finalLastUnsavedEvent = lastUnsavedEvent;
tedDaoExt.runInTx(new Runnable() {
@Override
public void run() {
try {
saveResult(head, headResult);
if (finalLastUnsavedResult != null) {
saveResult(finalLastUnsavedEvent, finalLastUnsavedResult);
}
} catch (Exception e) {
logger.error("Error while finishing events queue execution", e);
}
}
});
} | java | private void processEventQueue(final TaskRec head) {
final TedResult headResult = processEvent(head);
TaskConfig tc = context.registry.getTaskConfig(head.name);
if (tc == null) {
context.taskManager.handleUnknownTasks(asList(head));
return;
}
TaskRec lastUnsavedEvent = null;
TedResult lastUnsavedResult = null;
// try to execute next events, while head is reserved. some events may be created while executing current
if (headResult.status == TedStatus.DONE) {
outer:
for (int i = 0; i < 10; i++) {
List<TaskRec> events = tedDaoExt.eventQueueGetTail(head.key1);
if (events.isEmpty())
break outer;
for (TaskRec event : events) {
TaskConfig tc2 = context.registry.getTaskConfig(event.name);
if (tc2 == null)
break outer; // unknown task, leave it for later
TedResult result = processEvent(event);
// DONE - final status, on which can continue with next event
if (result.status == TedStatus.DONE) {
saveResult(event, result);
} else {
lastUnsavedEvent = event;
lastUnsavedResult = result;
break outer;
}
}
}
}
// first save head, otherwise unique index will fail
final TedResult finalLastUnsavedResult = lastUnsavedResult;
final TaskRec finalLastUnsavedEvent = lastUnsavedEvent;
tedDaoExt.runInTx(new Runnable() {
@Override
public void run() {
try {
saveResult(head, headResult);
if (finalLastUnsavedResult != null) {
saveResult(finalLastUnsavedEvent, finalLastUnsavedResult);
}
} catch (Exception e) {
logger.error("Error while finishing events queue execution", e);
}
}
});
} | [
"private",
"void",
"processEventQueue",
"(",
"final",
"TaskRec",
"head",
")",
"{",
"final",
"TedResult",
"headResult",
"=",
"processEvent",
"(",
"head",
")",
";",
"TaskConfig",
"tc",
"=",
"context",
".",
"registry",
".",
"getTaskConfig",
"(",
"head",
".",
"n... | process events from queue each after other, until ERROR or RETRY will happen | [
"process",
"events",
"from",
"queue",
"each",
"after",
"other",
"until",
"ERROR",
"or",
"RETRY",
"will",
"happen"
] | 2ee197246a78d842c18d6780c48fd903b00608a6 | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/EventQueueManager.java#L81-L133 | train |
casmi/casmi | src/main/java/casmi/util/SystemUtil.java | SystemUtil.getAllProperties | static public String[] getAllProperties() {
java.util.Properties prop = System.getProperties();
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
java.util.Enumeration<?> enumeration = prop.propertyNames();
while (enumeration.hasMoreElements()) {
list.add((String)enumeration.nextElement());
}
return list.toArray(new String[0]);
} | java | static public String[] getAllProperties() {
java.util.Properties prop = System.getProperties();
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
java.util.Enumeration<?> enumeration = prop.propertyNames();
while (enumeration.hasMoreElements()) {
list.add((String)enumeration.nextElement());
}
return list.toArray(new String[0]);
} | [
"static",
"public",
"String",
"[",
"]",
"getAllProperties",
"(",
")",
"{",
"java",
".",
"util",
".",
"Properties",
"prop",
"=",
"System",
".",
"getProperties",
"(",
")",
";",
"java",
".",
"util",
".",
"ArrayList",
"<",
"String",
">",
"list",
"=",
"new"... | Get all property names.
@return String array of all property names. | [
"Get",
"all",
"property",
"names",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/SystemUtil.java#L99-L107 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Perspective.java | Perspective.set | public void set(double fov, double aspect, double zNear, double zFar) {
this.fov = fov;
this.aspect = aspect;
this.zNear = zNear;
this.zFar = zFar;
} | java | public void set(double fov, double aspect, double zNear, double zFar) {
this.fov = fov;
this.aspect = aspect;
this.zNear = zNear;
this.zFar = zFar;
} | [
"public",
"void",
"set",
"(",
"double",
"fov",
",",
"double",
"aspect",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"this",
".",
"fov",
"=",
"fov",
";",
"this",
".",
"aspect",
"=",
"aspect",
";",
"this",
".",
"zNear",
"=",
"zNear",
";"... | Sets a perspective projection applying foreshortening,
making distant objects appear smaller than closer ones.
@param fov
The field-of-view angle (in radians) for vertical direction.
@param aspect
The ratio of width to height.
@param zNear
The z-position of nearest clipping plane.
@param zFar
The z-position of nearest farthest plane. | [
"Sets",
"a",
"perspective",
"projection",
"applying",
"foreshortening",
"making",
"distant",
"objects",
"appear",
"smaller",
"than",
"closer",
"ones",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Perspective.java#L82-L87 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/CharRange.java | CharRange.removeOverlap | public static List<CharRange> removeOverlap(CharRange r1, CharRange r2)
{
assert r1.intersect(r2);
List<CharRange> list = new ArrayList<CharRange>();
Set<Integer> set = new TreeSet<Integer>();
set.add(r1.getFrom());
set.add(r1.getTo());
set.add(r2.getFrom());
set.add(r2.getTo());
int p = 0;
for (int r : set)
{
if (p != 0)
{
list.add(new CharRange(p, r));
}
p = r;
}
return list;
} | java | public static List<CharRange> removeOverlap(CharRange r1, CharRange r2)
{
assert r1.intersect(r2);
List<CharRange> list = new ArrayList<CharRange>();
Set<Integer> set = new TreeSet<Integer>();
set.add(r1.getFrom());
set.add(r1.getTo());
set.add(r2.getFrom());
set.add(r2.getTo());
int p = 0;
for (int r : set)
{
if (p != 0)
{
list.add(new CharRange(p, r));
}
p = r;
}
return list;
} | [
"public",
"static",
"List",
"<",
"CharRange",
">",
"removeOverlap",
"(",
"CharRange",
"r1",
",",
"CharRange",
"r2",
")",
"{",
"assert",
"r1",
".",
"intersect",
"(",
"r2",
")",
";",
"List",
"<",
"CharRange",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"C... | Returns a list of ranges that together gather the same characters as r1 and r2.
None of the resulting ranges doesn't intersect each other.
@param r1
@param r2
@return | [
"Returns",
"a",
"list",
"of",
"ranges",
"that",
"together",
"gather",
"the",
"same",
"characters",
"as",
"r1",
"and",
"r2",
".",
"None",
"of",
"the",
"resulting",
"ranges",
"doesn",
"t",
"intersect",
"each",
"other",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/CharRange.java#L154-L173 | train |
rometools/rome-propono | src/main/java/com/rometools/propono/atom/common/Collection.java | Collection.getHrefResolved | public String getHrefResolved() {
if (Atom10Parser.isAbsoluteURI(href)) {
return href;
} else if (baseURI != null && collectionElement != null) {
final int lastslash = baseURI.lastIndexOf("/");
return Atom10Parser.resolveURI(baseURI.substring(0, lastslash), collectionElement, href);
}
return null;
} | java | public String getHrefResolved() {
if (Atom10Parser.isAbsoluteURI(href)) {
return href;
} else if (baseURI != null && collectionElement != null) {
final int lastslash = baseURI.lastIndexOf("/");
return Atom10Parser.resolveURI(baseURI.substring(0, lastslash), collectionElement, href);
}
return null;
} | [
"public",
"String",
"getHrefResolved",
"(",
")",
"{",
"if",
"(",
"Atom10Parser",
".",
"isAbsoluteURI",
"(",
"href",
")",
")",
"{",
"return",
"href",
";",
"}",
"else",
"if",
"(",
"baseURI",
"!=",
"null",
"&&",
"collectionElement",
"!=",
"null",
")",
"{",
... | Get resolved URI of the collection, or null if impossible to determine | [
"Get",
"resolved",
"URI",
"of",
"the",
"collection",
"or",
"null",
"if",
"impossible",
"to",
"determine"
] | 721de8d5a47998f92969d1ee3db80bdaa3f26fb2 | https://github.com/rometools/rome-propono/blob/721de8d5a47998f92969d1ee3db80bdaa3f26fb2/src/main/java/com/rometools/propono/atom/common/Collection.java#L98-L106 | train |
rometools/rome-propono | src/main/java/com/rometools/propono/atom/common/Collection.java | Collection.getHrefResolved | public String getHrefResolved(final String relativeUri) {
if (Atom10Parser.isAbsoluteURI(relativeUri)) {
return relativeUri;
} else if (baseURI != null && collectionElement != null) {
final int lastslash = baseURI.lastIndexOf("/");
return Atom10Parser.resolveURI(baseURI.substring(0, lastslash), collectionElement, relativeUri);
}
return null;
} | java | public String getHrefResolved(final String relativeUri) {
if (Atom10Parser.isAbsoluteURI(relativeUri)) {
return relativeUri;
} else if (baseURI != null && collectionElement != null) {
final int lastslash = baseURI.lastIndexOf("/");
return Atom10Parser.resolveURI(baseURI.substring(0, lastslash), collectionElement, relativeUri);
}
return null;
} | [
"public",
"String",
"getHrefResolved",
"(",
"final",
"String",
"relativeUri",
")",
"{",
"if",
"(",
"Atom10Parser",
".",
"isAbsoluteURI",
"(",
"relativeUri",
")",
")",
"{",
"return",
"relativeUri",
";",
"}",
"else",
"if",
"(",
"baseURI",
"!=",
"null",
"&&",
... | Get resolved URI using collection's baseURI, or null if impossible to determine | [
"Get",
"resolved",
"URI",
"using",
"collection",
"s",
"baseURI",
"or",
"null",
"if",
"impossible",
"to",
"determine"
] | 721de8d5a47998f92969d1ee3db80bdaa3f26fb2 | https://github.com/rometools/rome-propono/blob/721de8d5a47998f92969d1ee3db80bdaa3f26fb2/src/main/java/com/rometools/propono/atom/common/Collection.java#L109-L117 | train |
rometools/rome-propono | src/main/java/com/rometools/propono/atom/common/Collection.java | Collection.accepts | public boolean accepts(final String ct) {
for (final Object element : accepts) {
final String accept = (String) element;
if (accept != null && accept.trim().equals("*/*")) {
return true;
}
final String entryType = "application/atom+xml";
final boolean entry = entryType.equals(ct);
if (entry && null == accept) {
return true;
} else if (entry && "entry".equals(accept)) {
return true;
} else if (entry && entryType.equals(accept)) {
return true;
} else {
final String[] rules = accepts.toArray(new String[accepts.size()]);
for (final String rule2 : rules) {
String rule = rule2.trim();
if (rule.equals(ct)) {
return true;
}
final int slashstar = rule.indexOf("/*");
if (slashstar > 0) {
rule = rule.substring(0, slashstar + 1);
if (ct.startsWith(rule)) {
return true;
}
}
}
}
}
return false;
} | java | public boolean accepts(final String ct) {
for (final Object element : accepts) {
final String accept = (String) element;
if (accept != null && accept.trim().equals("*/*")) {
return true;
}
final String entryType = "application/atom+xml";
final boolean entry = entryType.equals(ct);
if (entry && null == accept) {
return true;
} else if (entry && "entry".equals(accept)) {
return true;
} else if (entry && entryType.equals(accept)) {
return true;
} else {
final String[] rules = accepts.toArray(new String[accepts.size()]);
for (final String rule2 : rules) {
String rule = rule2.trim();
if (rule.equals(ct)) {
return true;
}
final int slashstar = rule.indexOf("/*");
if (slashstar > 0) {
rule = rule.substring(0, slashstar + 1);
if (ct.startsWith(rule)) {
return true;
}
}
}
}
}
return false;
} | [
"public",
"boolean",
"accepts",
"(",
"final",
"String",
"ct",
")",
"{",
"for",
"(",
"final",
"Object",
"element",
":",
"accepts",
")",
"{",
"final",
"String",
"accept",
"=",
"(",
"String",
")",
"element",
";",
"if",
"(",
"accept",
"!=",
"null",
"&&",
... | Returns true if contentType is accepted by collection. | [
"Returns",
"true",
"if",
"contentType",
"is",
"accepted",
"by",
"collection",
"."
] | 721de8d5a47998f92969d1ee3db80bdaa3f26fb2 | https://github.com/rometools/rome-propono/blob/721de8d5a47998f92969d1ee3db80bdaa3f26fb2/src/main/java/com/rometools/propono/atom/common/Collection.java#L162-L194 | train |
rometools/rome-propono | src/main/java/com/rometools/propono/atom/common/Collection.java | Collection.collectionToElement | public Element collectionToElement() {
final Collection collection = this;
final Element element = new Element("collection", AtomService.ATOM_PROTOCOL);
element.setAttribute("href", collection.getHref());
final Element titleElem = new Element("title", AtomService.ATOM_FORMAT);
titleElem.setText(collection.getTitle());
if (collection.getTitleType() != null && !collection.getTitleType().equals("TEXT")) {
titleElem.setAttribute("type", collection.getTitleType(), AtomService.ATOM_FORMAT);
}
element.addContent(titleElem);
// Loop to create <app:categories> elements
for (final Object element2 : collection.getCategories()) {
final Categories cats = (Categories) element2;
element.addContent(cats.categoriesToElement());
}
for (final Object element2 : collection.getAccepts()) {
final String range = (String) element2;
final Element acceptElem = new Element("accept", AtomService.ATOM_PROTOCOL);
acceptElem.setText(range);
element.addContent(acceptElem);
}
return element;
} | java | public Element collectionToElement() {
final Collection collection = this;
final Element element = new Element("collection", AtomService.ATOM_PROTOCOL);
element.setAttribute("href", collection.getHref());
final Element titleElem = new Element("title", AtomService.ATOM_FORMAT);
titleElem.setText(collection.getTitle());
if (collection.getTitleType() != null && !collection.getTitleType().equals("TEXT")) {
titleElem.setAttribute("type", collection.getTitleType(), AtomService.ATOM_FORMAT);
}
element.addContent(titleElem);
// Loop to create <app:categories> elements
for (final Object element2 : collection.getCategories()) {
final Categories cats = (Categories) element2;
element.addContent(cats.categoriesToElement());
}
for (final Object element2 : collection.getAccepts()) {
final String range = (String) element2;
final Element acceptElem = new Element("accept", AtomService.ATOM_PROTOCOL);
acceptElem.setText(range);
element.addContent(acceptElem);
}
return element;
} | [
"public",
"Element",
"collectionToElement",
"(",
")",
"{",
"final",
"Collection",
"collection",
"=",
"this",
";",
"final",
"Element",
"element",
"=",
"new",
"Element",
"(",
"\"collection\"",
",",
"AtomService",
".",
"ATOM_PROTOCOL",
")",
";",
"element",
".",
"... | Serialize an AtomService.Collection into an XML element | [
"Serialize",
"an",
"AtomService",
".",
"Collection",
"into",
"an",
"XML",
"element"
] | 721de8d5a47998f92969d1ee3db80bdaa3f26fb2 | https://github.com/rometools/rome-propono/blob/721de8d5a47998f92969d1ee3db80bdaa3f26fb2/src/main/java/com/rometools/propono/atom/common/Collection.java#L199-L225 | train |
casmi/casmi | src/main/java/casmi/matrix/Matrix2D.java | Matrix2D.rotate | public void rotate(double angle) {
double s = Math.sin(angle);
double c = Math.cos(angle);
double temp1 = m00;
double temp2 = m01;
m00 = c * temp1 + s * temp2;
m01 = -s * temp1 + c * temp2;
temp1 = m10;
temp2 = m11;
m10 = c * temp1 + s * temp2;
m11 = -s * temp1 + c * temp2;
} | java | public void rotate(double angle) {
double s = Math.sin(angle);
double c = Math.cos(angle);
double temp1 = m00;
double temp2 = m01;
m00 = c * temp1 + s * temp2;
m01 = -s * temp1 + c * temp2;
temp1 = m10;
temp2 = m11;
m10 = c * temp1 + s * temp2;
m11 = -s * temp1 + c * temp2;
} | [
"public",
"void",
"rotate",
"(",
"double",
"angle",
")",
"{",
"double",
"s",
"=",
"Math",
".",
"sin",
"(",
"angle",
")",
";",
"double",
"c",
"=",
"Math",
".",
"cos",
"(",
"angle",
")",
";",
"double",
"temp1",
"=",
"m00",
";",
"double",
"temp2",
"... | Implementation roughly based on AffineTransform. | [
"Implementation",
"roughly",
"based",
"on",
"AffineTransform",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/matrix/Matrix2D.java#L129-L141 | train |
casmi/casmi | src/main/java/casmi/matrix/Matrix2D.java | Matrix2D.mult | public Vector3D mult(Vector3D source) {
Vector3D result = new Vector3D();
result.setX(m00 * source.getX() + m01 * source.getY() + m02);
result.setY(m10 * source.getX() + m11 * source.getY() + m12);
return result;
} | java | public Vector3D mult(Vector3D source) {
Vector3D result = new Vector3D();
result.setX(m00 * source.getX() + m01 * source.getY() + m02);
result.setY(m10 * source.getX() + m11 * source.getY() + m12);
return result;
} | [
"public",
"Vector3D",
"mult",
"(",
"Vector3D",
"source",
")",
"{",
"Vector3D",
"result",
"=",
"new",
"Vector3D",
"(",
")",
";",
"result",
".",
"setX",
"(",
"m00",
"*",
"source",
".",
"getX",
"(",
")",
"+",
"m01",
"*",
"source",
".",
"getY",
"(",
")... | Multiply the x and y coordinates of a Vertex against this matrix. | [
"Multiply",
"the",
"x",
"and",
"y",
"coordinates",
"of",
"a",
"Vertex",
"against",
"this",
"matrix",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/matrix/Matrix2D.java#L264-L269 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.