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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.int16 | public RowBuilder int16(String name)
{
ColumnInt16 column = new ColumnInt16(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder int16(String name)
{
ColumnInt16 column = new ColumnInt16(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"int16",
"(",
"String",
"name",
")",
"{",
"ColumnInt16",
"column",
"=",
"new",
"ColumnInt16",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",
";"... | Creates a 16-bit integer valued column
@param name the column name | [
"Creates",
"a",
"16",
"-",
"bit",
"integer",
"valued",
"column"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L120-L128 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.int32 | public RowBuilder int32(String name)
{
ColumnInt32 column = new ColumnInt32(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder int32(String name)
{
ColumnInt32 column = new ColumnInt32(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"int32",
"(",
"String",
"name",
")",
"{",
"ColumnInt32",
"column",
"=",
"new",
"ColumnInt32",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",
";"... | Creates a 32-bit integer valued column
@param name the column name | [
"Creates",
"a",
"32",
"-",
"bit",
"integer",
"valued",
"column"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L135-L143 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.int64 | public RowBuilder int64(String name)
{
ColumnInt64 column = new ColumnInt64(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder int64(String name)
{
ColumnInt64 column = new ColumnInt64(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"int64",
"(",
"String",
"name",
")",
"{",
"ColumnInt64",
"column",
"=",
"new",
"ColumnInt64",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",
";"... | Creates a 64-bit long valued column
@param name the column name | [
"Creates",
"a",
"64",
"-",
"bit",
"long",
"valued",
"column"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L150-L158 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.floatCol | public RowBuilder floatCol(String name)
{
ColumnFloat column = new ColumnFloat(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder floatCol(String name)
{
ColumnFloat column = new ColumnFloat(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"floatCol",
"(",
"String",
"name",
")",
"{",
"ColumnFloat",
"column",
"=",
"new",
"ColumnFloat",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",
... | Creates a float valued column.
@param name the column name | [
"Creates",
"a",
"float",
"valued",
"column",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L165-L173 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.doubleCol | public RowBuilder doubleCol(String name)
{
ColumnDouble column = new ColumnDouble(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder doubleCol(String name)
{
ColumnDouble column = new ColumnDouble(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"doubleCol",
"(",
"String",
"name",
")",
"{",
"ColumnDouble",
"column",
"=",
"new",
"ColumnDouble",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",... | Creates a double valued column.
@param name the column name | [
"Creates",
"a",
"double",
"valued",
"column",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L180-L188 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.timestampCol | public RowBuilder timestampCol(String name)
{
Column column = new ColumnTimestamp(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder timestampCol(String name)
{
Column column = new ColumnTimestamp(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"timestampCol",
"(",
"String",
"name",
")",
"{",
"Column",
"column",
"=",
"new",
"ColumnTimestamp",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",... | timestamp valued column.
@param name the column name | [
"timestamp",
"valued",
"column",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L195-L203 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java | RowBuilder.identityCol | public RowBuilder identityCol(String name)
{
Column column = new ColumnIdentity(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | java | public RowBuilder identityCol(String name)
{
Column column = new ColumnIdentity(_columns.size(), name, _offset);
_offset += column.length();
_columns.add(column);
return this;
} | [
"public",
"RowBuilder",
"identityCol",
"(",
"String",
"name",
")",
"{",
"Column",
"column",
"=",
"new",
"ColumnIdentity",
"(",
"_columns",
".",
"size",
"(",
")",
",",
"name",
",",
"_offset",
")",
";",
"_offset",
"+=",
"column",
".",
"length",
"(",
")",
... | identity valued column.
@param name the column name | [
"identity",
"valued",
"column",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/RowBuilder.java#L210-L218 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/JAnnotation.java | JAnnotation.getInt | public int getInt(String name)
{
Integer value = (Integer) get(name);
if (value != null)
return value.intValue();
else
return 0;
} | java | public int getInt(String name)
{
Integer value = (Integer) get(name);
if (value != null)
return value.intValue();
else
return 0;
} | [
"public",
"int",
"getInt",
"(",
"String",
"name",
")",
"{",
"Integer",
"value",
"=",
"(",
"Integer",
")",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"return",
"value",
".",
"intValue",
"(",
")",
";",
"else",
"return",
"0",... | Returns the annotation value. | [
"Returns",
"the",
"annotation",
"value",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/JAnnotation.java#L75-L83 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/ramp/events/EventServiceRamp.java | EventServiceRamp.publisher | public <T> void publisher(Class<T> api,
Result<T> result)
{
String path = api.getName();
String address = address(path);
ServicesAmp manager = ServicesAmp.current();
ServiceRefAmp pubRef = manager.service(address);
result.ok(pubRef.as(api));
} | java | public <T> void publisher(Class<T> api,
Result<T> result)
{
String path = api.getName();
String address = address(path);
ServicesAmp manager = ServicesAmp.current();
ServiceRefAmp pubRef = manager.service(address);
result.ok(pubRef.as(api));
} | [
"public",
"<",
"T",
">",
"void",
"publisher",
"(",
"Class",
"<",
"T",
">",
"api",
",",
"Result",
"<",
"T",
">",
"result",
")",
"{",
"String",
"path",
"=",
"api",
".",
"getName",
"(",
")",
";",
"String",
"address",
"=",
"address",
"(",
"path",
")"... | Publish to a location. | [
"Publish",
"to",
"a",
"location",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/events/EventServiceRamp.java#L130-L141 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/Loader.java | Loader.getResourceAsStream | public InputStream getResourceAsStream(String name)
{
Source path;
path = getPath(name);
if (path != null && path.canRead()) {
try {
return path.inputStream();
} catch (Exception e) {
}
}
return null;
} | java | public InputStream getResourceAsStream(String name)
{
Source path;
path = getPath(name);
if (path != null && path.canRead()) {
try {
return path.inputStream();
} catch (Exception e) {
}
}
return null;
} | [
"public",
"InputStream",
"getResourceAsStream",
"(",
"String",
"name",
")",
"{",
"Source",
"path",
";",
"path",
"=",
"getPath",
"(",
"name",
")",
";",
"if",
"(",
"path",
"!=",
"null",
"&&",
"path",
".",
"canRead",
"(",
")",
")",
"{",
"try",
"{",
"ret... | Opens the stream to the resource.
@param name name of the resource | [
"Opens",
"the",
"stream",
"to",
"the",
"resource",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/Loader.java#L186-L200 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/JarPath.java | JarPath.create | public static JarPath create(PathImpl backing)
{
backing = backing.unwrap();
if (backing instanceof JarPath) {
return (JarPath) backing;
}
JarPath path = _jarCache.get(backing);
if (path == null) {
path = new JarPath(null, "/", "/", backing);
_jarCache.put(backing, path);
}
return path;
} | java | public static JarPath create(PathImpl backing)
{
backing = backing.unwrap();
if (backing instanceof JarPath) {
return (JarPath) backing;
}
JarPath path = _jarCache.get(backing);
if (path == null) {
path = new JarPath(null, "/", "/", backing);
_jarCache.put(backing, path);
}
return path;
} | [
"public",
"static",
"JarPath",
"create",
"(",
"PathImpl",
"backing",
")",
"{",
"backing",
"=",
"backing",
".",
"unwrap",
"(",
")",
";",
"if",
"(",
"backing",
"instanceof",
"JarPath",
")",
"{",
"return",
"(",
"JarPath",
")",
"backing",
";",
"}",
"JarPath"... | Creates a new root Jar path. | [
"Creates",
"a",
"new",
"root",
"Jar",
"path",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/JarPath.java#L74-L90 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/javac/LineMapWriter.java | LineMapWriter.write | public void write(LineMap lineMap)
throws IOException
{
_os.println("SMAP");
_os.println(lineMap.getDestFilename());
_os.println(_sourceType);
_os.println("*S " + _sourceType);
IntMap fileMap = new IntMap();
_os.println("*F");
Iterator<LineMap.Line> iter = lineMap.iterator();
while (iter.hasNext()) {
LineMap.Line line = iter.next();
String filename = line.getSourceFilename();
int index = fileMap.get(filename);
if (index < 0) {
index = fileMap.size() + 1;
fileMap.put(filename, index);
if (filename.indexOf('/') >= 0) {
int p = filename.lastIndexOf('/');
_os.println("+ " + index + " " + filename.substring(p + 1));
// XXX: _os.println(filename);
if (filename.startsWith("/"))
_os.println(filename.substring(1));
else
_os.println(filename);
}
else
_os.println(index + " " + filename);
}
}
_os.println("*L");
int size = lineMap.size();
int lastIndex = 0;
for (int i = 0; i < size; i++) {
LineMap.Line line = lineMap.get(i);
String filename = line.getSourceFilename();
int index = fileMap.get(filename);
String fileMarker = "";
_os.print(line.getSourceLine());
_os.print("#" + index);
if (line.getRepeatCount() > 1)
_os.print("," + line.getRepeatCount());
_os.print(":");
_os.print(line.getDestinationLine());
if (line.getDestinationIncrement() > 1)
_os.print("," + line.getDestinationIncrement());
_os.println();
}
_os.println("*E");
} | java | public void write(LineMap lineMap)
throws IOException
{
_os.println("SMAP");
_os.println(lineMap.getDestFilename());
_os.println(_sourceType);
_os.println("*S " + _sourceType);
IntMap fileMap = new IntMap();
_os.println("*F");
Iterator<LineMap.Line> iter = lineMap.iterator();
while (iter.hasNext()) {
LineMap.Line line = iter.next();
String filename = line.getSourceFilename();
int index = fileMap.get(filename);
if (index < 0) {
index = fileMap.size() + 1;
fileMap.put(filename, index);
if (filename.indexOf('/') >= 0) {
int p = filename.lastIndexOf('/');
_os.println("+ " + index + " " + filename.substring(p + 1));
// XXX: _os.println(filename);
if (filename.startsWith("/"))
_os.println(filename.substring(1));
else
_os.println(filename);
}
else
_os.println(index + " " + filename);
}
}
_os.println("*L");
int size = lineMap.size();
int lastIndex = 0;
for (int i = 0; i < size; i++) {
LineMap.Line line = lineMap.get(i);
String filename = line.getSourceFilename();
int index = fileMap.get(filename);
String fileMarker = "";
_os.print(line.getSourceLine());
_os.print("#" + index);
if (line.getRepeatCount() > 1)
_os.print("," + line.getRepeatCount());
_os.print(":");
_os.print(line.getDestinationLine());
if (line.getDestinationIncrement() > 1)
_os.print("," + line.getDestinationIncrement());
_os.println();
}
_os.println("*E");
} | [
"public",
"void",
"write",
"(",
"LineMap",
"lineMap",
")",
"throws",
"IOException",
"{",
"_os",
".",
"println",
"(",
"\"SMAP\"",
")",
";",
"_os",
".",
"println",
"(",
"lineMap",
".",
"getDestFilename",
"(",
")",
")",
";",
"_os",
".",
"println",
"(",
"_... | Writes the line map | [
"Writes",
"the",
"line",
"map"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/javac/LineMapWriter.java#L64-L126 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/network/balance/ClientSocket.java | ClientSocket.isIdleAlmostExpired | @Override
public boolean isIdleAlmostExpired(long delta)
{
long now = CurrentTime.currentTime();
return (_pool.getLoadBalanceIdleTime() < now - _idleStartTime + delta);
} | java | @Override
public boolean isIdleAlmostExpired(long delta)
{
long now = CurrentTime.currentTime();
return (_pool.getLoadBalanceIdleTime() < now - _idleStartTime + delta);
} | [
"@",
"Override",
"public",
"boolean",
"isIdleAlmostExpired",
"(",
"long",
"delta",
")",
"{",
"long",
"now",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
";",
"return",
"(",
"_pool",
".",
"getLoadBalanceIdleTime",
"(",
")",
"<",
"now",
"-",
"_idleStartTi... | Returns true if nearing end of free time. | [
"Returns",
"true",
"if",
"nearing",
"end",
"of",
"free",
"time",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/network/balance/ClientSocket.java#L189-L195 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/network/balance/ClientSocket.java | ClientSocket.free | @Override
public void free(long idleStartTime)
{
if (_is == null) {
IllegalStateException exn = new IllegalStateException(L.l("{0} unexpected free of closed stream", this));
exn.fillInStackTrace();
log.log(Level.FINE, exn.toString(), exn);
return;
}
long requestStartTime = _requestStartTime;
_requestStartTime = 0;
if (requestStartTime > 0)
_requestTimeProbe.end(requestStartTime);
// #2369 - the load balancer might set its own view of the free
// time
if (idleStartTime <= 0) {
idleStartTime = _is.getReadTime();
if (idleStartTime <= 0) {
// for write-only, the read time is zero
idleStartTime = CurrentTime.currentTime();
}
}
_idleStartTime = idleStartTime;
_idleProbe.start();
_isIdle = true;
_pool.free(this);
} | java | @Override
public void free(long idleStartTime)
{
if (_is == null) {
IllegalStateException exn = new IllegalStateException(L.l("{0} unexpected free of closed stream", this));
exn.fillInStackTrace();
log.log(Level.FINE, exn.toString(), exn);
return;
}
long requestStartTime = _requestStartTime;
_requestStartTime = 0;
if (requestStartTime > 0)
_requestTimeProbe.end(requestStartTime);
// #2369 - the load balancer might set its own view of the free
// time
if (idleStartTime <= 0) {
idleStartTime = _is.getReadTime();
if (idleStartTime <= 0) {
// for write-only, the read time is zero
idleStartTime = CurrentTime.currentTime();
}
}
_idleStartTime = idleStartTime;
_idleProbe.start();
_isIdle = true;
_pool.free(this);
} | [
"@",
"Override",
"public",
"void",
"free",
"(",
"long",
"idleStartTime",
")",
"{",
"if",
"(",
"_is",
"==",
"null",
")",
"{",
"IllegalStateException",
"exn",
"=",
"new",
"IllegalStateException",
"(",
"L",
".",
"l",
"(",
"\"{0} unexpected free of closed stream\"",... | Adds the stream to the free pool.
The idleStartTime may be earlier than the current time
to deal with TCP buffer delays. Typically it will be
recorded as the start time of the request's write.
@param idleStartTime the time to be used as the start
of the idle period. | [
"Adds",
"the",
"stream",
"to",
"the",
"free",
"pool",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/network/balance/ClientSocket.java#L266-L301 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/ReaderWriterStream.java | ReaderWriterStream.write | public void write(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
int end = offset + length;
while (offset < end) {
int ch1 = buf[offset++] & 0xff;
if (ch1 < 0x80)
os.write(ch1);
else if ((ch1 & 0xe0) == 0xc0) {
if (offset >= end)
throw new EOFException("unexpected end of file in utf8 character");
int ch2 = buf[offset++] & 0xff;
if ((ch2 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
os.write(((ch1 & 0x1f) << 6) + (ch2 & 0x3f));
}
else if ((ch1 & 0xf0) == 0xe0) {
if (offset + 1 >= end)
throw new EOFException("unexpected end of file in utf8 character");
int ch2 = buf[offset++] & 0xff;
int ch3 = buf[offset++] & 0xff;
if ((ch2 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
if ((ch3 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
os.write(((ch1 & 0x1f) << 12) + ((ch2 & 0x3f) << 6) + (ch3 & 0x3f));
}
else
throw new CharConversionException("illegal utf8 encoding at (" +
(int) ch1 + ")");
}
} | java | public void write(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
int end = offset + length;
while (offset < end) {
int ch1 = buf[offset++] & 0xff;
if (ch1 < 0x80)
os.write(ch1);
else if ((ch1 & 0xe0) == 0xc0) {
if (offset >= end)
throw new EOFException("unexpected end of file in utf8 character");
int ch2 = buf[offset++] & 0xff;
if ((ch2 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
os.write(((ch1 & 0x1f) << 6) + (ch2 & 0x3f));
}
else if ((ch1 & 0xf0) == 0xe0) {
if (offset + 1 >= end)
throw new EOFException("unexpected end of file in utf8 character");
int ch2 = buf[offset++] & 0xff;
int ch3 = buf[offset++] & 0xff;
if ((ch2 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
if ((ch3 & 0xc0) != 0x80)
throw new CharConversionException("illegal utf8 encoding");
os.write(((ch1 & 0x1f) << 12) + ((ch2 & 0x3f) << 6) + (ch3 & 0x3f));
}
else
throw new CharConversionException("illegal utf8 encoding at (" +
(int) ch1 + ")");
}
} | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
",",
"boolean",
"isEnd",
")",
"throws",
"IOException",
"{",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"while",
"(",
"offset",
"<",
"end",
")",... | Implementation of the writer write.
@param buf byte buffer containing the bytes
@param offset offset where to start writing
@param length number of bytes to write
@param isEnd true when the write is flushing a close. | [
"Implementation",
"of",
"the",
"writer",
"write",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/ReaderWriterStream.java#L143-L181 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.getMimeName | public static String getMimeName(String encoding)
{
if (encoding == null)
return null;
String value = _mimeName.get(encoding);
if (value != null)
return value;
String upper = normalize(encoding);
String lookup = _mimeName.get(upper);
value = lookup == null ? upper : lookup;
_mimeName.put(encoding, value);
return value;
} | java | public static String getMimeName(String encoding)
{
if (encoding == null)
return null;
String value = _mimeName.get(encoding);
if (value != null)
return value;
String upper = normalize(encoding);
String lookup = _mimeName.get(upper);
value = lookup == null ? upper : lookup;
_mimeName.put(encoding, value);
return value;
} | [
"public",
"static",
"String",
"getMimeName",
"(",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"return",
"null",
";",
"String",
"value",
"=",
"_mimeName",
".",
"get",
"(",
"encoding",
")",
";",
"if",
"(",
"value",
"!=",
"nu... | Returns the canonical mime name for the given character encoding.
@param encoding character encoding name, possibly an alias
@return canonical mime name for the encoding. | [
"Returns",
"the",
"canonical",
"mime",
"name",
"for",
"the",
"given",
"character",
"encoding",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L70-L88 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.getMimeName | public static String getMimeName(Locale locale)
{
if (locale == null)
return "utf-8";
String mimeName = _localeName.get(locale.toString());
if (mimeName == null)
mimeName = _localeName.get(locale.getLanguage());
if (mimeName == null)
return "utf-8";
else
return mimeName;
} | java | public static String getMimeName(Locale locale)
{
if (locale == null)
return "utf-8";
String mimeName = _localeName.get(locale.toString());
if (mimeName == null)
mimeName = _localeName.get(locale.getLanguage());
if (mimeName == null)
return "utf-8";
else
return mimeName;
} | [
"public",
"static",
"String",
"getMimeName",
"(",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
"==",
"null",
")",
"return",
"\"utf-8\"",
";",
"String",
"mimeName",
"=",
"_localeName",
".",
"get",
"(",
"locale",
".",
"toString",
"(",
")",
")",
";",
... | Returns the canonical mime name for the given locale.
@param locale locale to use.
@return canonical mime name for the encoding. | [
"Returns",
"the",
"canonical",
"mime",
"name",
"for",
"the",
"given",
"locale",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L97-L110 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.getWriteEncoding | public static EncodingWriter getWriteEncoding(String encoding)
{
if (encoding == null)
encoding = "iso-8859-1";
EncodingWriter factory = _writeEncodingFactories.get(encoding);
if (factory != null)
return factory.create();
factory = _writeEncodingFactories.get(encoding);
if (factory == null) {
try {
String javaEncoding = Encoding.getJavaName(encoding);
if (javaEncoding == null)
javaEncoding = "ISO8859_1";
String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Writer";
Class<?> cl = Class.forName(className);
factory = (EncodingWriter) cl.newInstance();
factory.setJavaEncoding(javaEncoding);
} catch (Throwable e) {
}
if (factory == null) {
factory = new JDKWriter();
String javaEncoding = Encoding.getJavaName(encoding);
if (javaEncoding == null)
javaEncoding = "ISO8859_1";
factory.setJavaEncoding(javaEncoding);
}
_writeEncodingFactories.put(encoding, factory);
}
// return factory.create(factory.getJavaEncoding());
// charset uses the original encoding, not the java encoding
return factory.create(encoding);
} | java | public static EncodingWriter getWriteEncoding(String encoding)
{
if (encoding == null)
encoding = "iso-8859-1";
EncodingWriter factory = _writeEncodingFactories.get(encoding);
if (factory != null)
return factory.create();
factory = _writeEncodingFactories.get(encoding);
if (factory == null) {
try {
String javaEncoding = Encoding.getJavaName(encoding);
if (javaEncoding == null)
javaEncoding = "ISO8859_1";
String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Writer";
Class<?> cl = Class.forName(className);
factory = (EncodingWriter) cl.newInstance();
factory.setJavaEncoding(javaEncoding);
} catch (Throwable e) {
}
if (factory == null) {
factory = new JDKWriter();
String javaEncoding = Encoding.getJavaName(encoding);
if (javaEncoding == null)
javaEncoding = "ISO8859_1";
factory.setJavaEncoding(javaEncoding);
}
_writeEncodingFactories.put(encoding, factory);
}
// return factory.create(factory.getJavaEncoding());
// charset uses the original encoding, not the java encoding
return factory.create(encoding);
} | [
"public",
"static",
"EncodingWriter",
"getWriteEncoding",
"(",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"encoding",
"=",
"\"iso-8859-1\"",
";",
"EncodingWriter",
"factory",
"=",
"_writeEncodingFactories",
".",
"get",
"(",
"encoding... | Returns an EncodingWriter to translate characters to bytes.
@param encoding the encoding name.
@return a writer for the translation | [
"Returns",
"an",
"EncodingWriter",
"to",
"translate",
"characters",
"to",
"bytes",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L182-L225 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.getJavaName | public static String getJavaName(String encoding)
{
if (encoding == null)
return null;
String javaName = _javaName.get(encoding);
if (javaName != null)
return javaName;
String upper = normalize(encoding);
javaName = _javaName.get(upper);
if (javaName == null) {
String lookup = _mimeName.get(upper);
if (lookup != null)
javaName = _javaName.get(lookup);
}
if (javaName == null)
javaName = upper;
_javaName.put(encoding, javaName);
return javaName;
} | java | public static String getJavaName(String encoding)
{
if (encoding == null)
return null;
String javaName = _javaName.get(encoding);
if (javaName != null)
return javaName;
String upper = normalize(encoding);
javaName = _javaName.get(upper);
if (javaName == null) {
String lookup = _mimeName.get(upper);
if (lookup != null)
javaName = _javaName.get(lookup);
}
if (javaName == null)
javaName = upper;
_javaName.put(encoding, javaName);
return javaName;
} | [
"public",
"static",
"String",
"getJavaName",
"(",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"return",
"null",
";",
"String",
"javaName",
"=",
"_javaName",
".",
"get",
"(",
"encoding",
")",
";",
"if",
"(",
"javaName",
"!=",... | Returns the Java name for the given encoding.
@param encoding character encoding name
@return Java encoding name | [
"Returns",
"the",
"Java",
"name",
"for",
"the",
"given",
"encoding",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L242-L268 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.getJavaName | public static String getJavaName(Locale locale)
{
if (locale == null)
return null;
return getJavaName(getMimeName(locale));
} | java | public static String getJavaName(Locale locale)
{
if (locale == null)
return null;
return getJavaName(getMimeName(locale));
} | [
"public",
"static",
"String",
"getJavaName",
"(",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
"==",
"null",
")",
"return",
"null",
";",
"return",
"getJavaName",
"(",
"getMimeName",
"(",
"locale",
")",
")",
";",
"}"
] | Returns the Java name for the given locale.
@param locale the locale to use
@return Java encoding name | [
"Returns",
"the",
"Java",
"name",
"for",
"the",
"given",
"locale",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L277-L283 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/i18n/Encoding.java | Encoding.normalize | private static String normalize(String name)
{
CharBuffer cb = new CharBuffer();
int len = name.length();
for (int i = 0; i < len; i++) {
char ch = name.charAt(i);
if (Character.isLowerCase(ch))
cb.append(Character.toUpperCase(ch));
else if (ch == '_')
cb.append('-');
else
cb.append(ch);
}
return cb.close();
} | java | private static String normalize(String name)
{
CharBuffer cb = new CharBuffer();
int len = name.length();
for (int i = 0; i < len; i++) {
char ch = name.charAt(i);
if (Character.isLowerCase(ch))
cb.append(Character.toUpperCase(ch));
else if (ch == '_')
cb.append('-');
else
cb.append(ch);
}
return cb.close();
} | [
"private",
"static",
"String",
"normalize",
"(",
"String",
"name",
")",
"{",
"CharBuffer",
"cb",
"=",
"new",
"CharBuffer",
"(",
")",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"l... | Normalize the user's encoding name to avoid case issues. | [
"Normalize",
"the",
"user",
"s",
"encoding",
"name",
"to",
"avoid",
"case",
"issues",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L288-L305 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java | StoreFsyncServiceImpl.fsync | public void fsync(long sequence, K key, Result<Boolean> result)
{
scheduleFsync(sequence, key, result);
flush();
} | java | public void fsync(long sequence, K key, Result<Boolean> result)
{
scheduleFsync(sequence, key, result);
flush();
} | [
"public",
"void",
"fsync",
"(",
"long",
"sequence",
",",
"K",
"key",
",",
"Result",
"<",
"Boolean",
">",
"result",
")",
"{",
"scheduleFsync",
"(",
"sequence",
",",
"key",
",",
"result",
")",
";",
"flush",
"(",
")",
";",
"}"
] | Request an fsync for the allocated sequence, and request a flush
to occur at the next service batch.
@param sequence the sequence id allocated from allocateFsyncSequence()
@param result the completion to be called after the fsync completes | [
"Request",
"an",
"fsync",
"for",
"the",
"allocated",
"sequence",
"and",
"request",
"a",
"flush",
"to",
"occur",
"at",
"the",
"next",
"service",
"batch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java#L114-L118 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java | StoreFsyncServiceImpl.scheduleFsync | public void scheduleFsync(long sequence, K key, Result<Boolean> result)
{
_requestSequence = Math.max(_requestSequence, sequence);
if (sequence <= _tailSequence) {
result.ok(Boolean.TRUE);
}
else {
_storeFsync.addResult(key, result);
}
} | java | public void scheduleFsync(long sequence, K key, Result<Boolean> result)
{
_requestSequence = Math.max(_requestSequence, sequence);
if (sequence <= _tailSequence) {
result.ok(Boolean.TRUE);
}
else {
_storeFsync.addResult(key, result);
}
} | [
"public",
"void",
"scheduleFsync",
"(",
"long",
"sequence",
",",
"K",
"key",
",",
"Result",
"<",
"Boolean",
">",
"result",
")",
"{",
"_requestSequence",
"=",
"Math",
".",
"max",
"(",
"_requestSequence",
",",
"sequence",
")",
";",
"if",
"(",
"sequence",
"... | Schedule an fsync for the given sequence, but do not request a flush.
The fsync can occur before the flush, depending on other clients.
@param sequence the sequence allocated from allocateFsyncSequence
@param result notifies the caller when the fsync completes | [
"Schedule",
"an",
"fsync",
"for",
"the",
"given",
"sequence",
"but",
"do",
"not",
"request",
"a",
"flush",
".",
"The",
"fsync",
"can",
"occur",
"before",
"the",
"flush",
"depending",
"on",
"other",
"clients",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java#L127-L137 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java | StoreFsyncServiceImpl.afterBatch | @AfterBatch
public void afterBatch()
{
long requestSequence = _requestSequence;
if (! _isFsync) {
return;
}
_isFsync = false;
try {
_storeFsync.fsync();
/*
if (_tailSequence < requestSequence) {
_storeFsync.fsync();
}
*/
} catch (Throwable e) {
e.printStackTrace();
} finally {
_tailSequence = requestSequence;
}
} | java | @AfterBatch
public void afterBatch()
{
long requestSequence = _requestSequence;
if (! _isFsync) {
return;
}
_isFsync = false;
try {
_storeFsync.fsync();
/*
if (_tailSequence < requestSequence) {
_storeFsync.fsync();
}
*/
} catch (Throwable e) {
e.printStackTrace();
} finally {
_tailSequence = requestSequence;
}
} | [
"@",
"AfterBatch",
"public",
"void",
"afterBatch",
"(",
")",
"{",
"long",
"requestSequence",
"=",
"_requestSequence",
";",
"if",
"(",
"!",
"_isFsync",
")",
"{",
"return",
";",
"}",
"_isFsync",
"=",
"false",
";",
"try",
"{",
"_storeFsync",
".",
"fsync",
"... | Completes any fsyncs in a batch.
Because the fsync is slow, this method will typically block while
new requests fill the queue, making the next batch efficient. | [
"Completes",
"any",
"fsyncs",
"in",
"a",
"batch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/store/io/StoreFsyncServiceImpl.java#L154-L177 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/ramp/hamp/OutHamp.java | OutHamp.stream | public void stream(OutputStream os,
HeadersAmp headers,
String from,
long qId,
String address,
String methodName,
PodRef podCaller,
ResultStream<?> result,
Object []args)
throws IOException
{
init(os);
OutH3 out = _out;
if (out == null) {
return;
}
if (log.isLoggable(Level.FINEST)) {
log.finest("hamp-stream-w " + methodName + (args != null ? Arrays.asList(args) : "[]")
+ " {to:" + address + ", from:" + from + "}");
}
out.writeLong(MessageTypeHamp.STREAM.ordinal());
writeHeaders(out, headers);
writeFromAddress(out, from);
out.writeLong(qId);
writeMethod(out, address, methodName, podCaller);
out.writeObject(result);
writeArgs(out, args);
//out.flushBuffer();
out.flush();
} | java | public void stream(OutputStream os,
HeadersAmp headers,
String from,
long qId,
String address,
String methodName,
PodRef podCaller,
ResultStream<?> result,
Object []args)
throws IOException
{
init(os);
OutH3 out = _out;
if (out == null) {
return;
}
if (log.isLoggable(Level.FINEST)) {
log.finest("hamp-stream-w " + methodName + (args != null ? Arrays.asList(args) : "[]")
+ " {to:" + address + ", from:" + from + "}");
}
out.writeLong(MessageTypeHamp.STREAM.ordinal());
writeHeaders(out, headers);
writeFromAddress(out, from);
out.writeLong(qId);
writeMethod(out, address, methodName, podCaller);
out.writeObject(result);
writeArgs(out, args);
//out.flushBuffer();
out.flush();
} | [
"public",
"void",
"stream",
"(",
"OutputStream",
"os",
",",
"HeadersAmp",
"headers",
",",
"String",
"from",
",",
"long",
"qId",
",",
"String",
"address",
",",
"String",
"methodName",
",",
"PodRef",
"podCaller",
",",
"ResultStream",
"<",
"?",
">",
"result",
... | Sends a stream message to a given address | [
"Sends",
"a",
"stream",
"message",
"to",
"a",
"given",
"address"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/hamp/OutHamp.java#L287-L325 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.insert | int insert(Row row,
byte []sourceBuffer,
int sourceOffset,
BlobOutputStream []blobs)
{
int rowHead = _rowHead;
int blobTail = _blobTail;
int rowLength = row.length();
rowHead -= rowLength;
// return false if the block is full
if (rowHead < blobTail) {
return -1;
}
byte []buffer = _buffer;
System.arraycopy(sourceBuffer, sourceOffset,
buffer, rowHead,
rowLength);
// XXX: timestamp
buffer[rowHead] = (byte) ((buffer[rowHead] & ~CODE_MASK) | INSERT);
blobTail = row.insertBlobs(buffer, rowHead, blobTail, blobs);
// System.out.println("HEXL: " + Hex.toHex(buffer, rowFirst, rowLength));
// if inline blobs can't fit, return false
if (blobTail < 0) {
return -1;
}
setBlobTail(blobTail);
rowHead(rowHead);
validateBlock(row);
return rowHead;
} | java | int insert(Row row,
byte []sourceBuffer,
int sourceOffset,
BlobOutputStream []blobs)
{
int rowHead = _rowHead;
int blobTail = _blobTail;
int rowLength = row.length();
rowHead -= rowLength;
// return false if the block is full
if (rowHead < blobTail) {
return -1;
}
byte []buffer = _buffer;
System.arraycopy(sourceBuffer, sourceOffset,
buffer, rowHead,
rowLength);
// XXX: timestamp
buffer[rowHead] = (byte) ((buffer[rowHead] & ~CODE_MASK) | INSERT);
blobTail = row.insertBlobs(buffer, rowHead, blobTail, blobs);
// System.out.println("HEXL: " + Hex.toHex(buffer, rowFirst, rowLength));
// if inline blobs can't fit, return false
if (blobTail < 0) {
return -1;
}
setBlobTail(blobTail);
rowHead(rowHead);
validateBlock(row);
return rowHead;
} | [
"int",
"insert",
"(",
"Row",
"row",
",",
"byte",
"[",
"]",
"sourceBuffer",
",",
"int",
"sourceOffset",
",",
"BlobOutputStream",
"[",
"]",
"blobs",
")",
"{",
"int",
"rowHead",
"=",
"_rowHead",
";",
"int",
"blobTail",
"=",
"_blobTail",
";",
"int",
"rowLeng... | Inserts a new row into the block.
@param row the row schema
@param source the source bytes for the new row
@param sourceOffset the row offset into the source buffer
@param blobs the blobs from the source
@return false if the insert failed due to lack of space | [
"Inserts",
"a",
"new",
"row",
"into",
"the",
"block",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L133-L173 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.remove | boolean remove(RowCursor cursor)
{
int rowHead = _rowHead;
int blobTail = _blobTail;
rowHead -= cursor.removeLength();
if (rowHead < blobTail) {
return false;
}
byte []buffer = _buffer;
// buffer[rowHead] = REMOVE;
cursor.getRemove(buffer, rowHead);
// cursor.getKey(buffer, rowHead + ColumnState.LENGTH);
rowHead(rowHead);
validateBlock(cursor.row());
return true;
} | java | boolean remove(RowCursor cursor)
{
int rowHead = _rowHead;
int blobTail = _blobTail;
rowHead -= cursor.removeLength();
if (rowHead < blobTail) {
return false;
}
byte []buffer = _buffer;
// buffer[rowHead] = REMOVE;
cursor.getRemove(buffer, rowHead);
// cursor.getKey(buffer, rowHead + ColumnState.LENGTH);
rowHead(rowHead);
validateBlock(cursor.row());
return true;
} | [
"boolean",
"remove",
"(",
"RowCursor",
"cursor",
")",
"{",
"int",
"rowHead",
"=",
"_rowHead",
";",
"int",
"blobTail",
"=",
"_blobTail",
";",
"rowHead",
"-=",
"cursor",
".",
"removeLength",
"(",
")",
";",
"if",
"(",
"rowHead",
"<",
"blobTail",
")",
"{",
... | Removes a key by adding a remove entry to the row.
The remove is represented as a delta entry so checkpoints can be
written asynchronously.
@return false if the new record cannot fit into the block. | [
"Removes",
"a",
"key",
"by",
"adding",
"a",
"remove",
"entry",
"to",
"the",
"row",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L183-L206 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.findAndFill | int findAndFill(RowCursor cursor)
{
int ptr = find(cursor);
if (ptr >= 0) {
cursor.setRow(_buffer, ptr);
cursor.setLeafBlock(this, ptr);
}
return ptr;
} | java | int findAndFill(RowCursor cursor)
{
int ptr = find(cursor);
if (ptr >= 0) {
cursor.setRow(_buffer, ptr);
cursor.setLeafBlock(this, ptr);
}
return ptr;
} | [
"int",
"findAndFill",
"(",
"RowCursor",
"cursor",
")",
"{",
"int",
"ptr",
"=",
"find",
"(",
"cursor",
")",
";",
"if",
"(",
"ptr",
">=",
"0",
")",
"{",
"cursor",
".",
"setRow",
"(",
"_buffer",
",",
"ptr",
")",
";",
"cursor",
".",
"setLeafBlock",
"("... | Searches for a row matching the cursor's key in the block.
If the key is found, fill the cursor with the row. | [
"Searches",
"for",
"a",
"row",
"matching",
"the",
"cursor",
"s",
"key",
"in",
"the",
"block",
".",
"If",
"the",
"key",
"is",
"found",
"fill",
"the",
"cursor",
"with",
"the",
"row",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L212-L222 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.find | int find(RowCursor cursor)
{
int rowOffset = _rowHead;
int sortOffset = _rowSortHead;
int rowLength = cursor.length();
int removeLength = cursor.removeLength();
byte []buffer = _buffer;
while (rowOffset < sortOffset) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
if (cursor.compareKeyRow(buffer, rowOffset) == 0) {
return rowOffset;
}
else {
rowOffset += rowLength;
break;
}
case INSERT_DEAD:
rowOffset += rowLength;
break;
case REMOVE:
if (cursor.compareKeyRemove(buffer, rowOffset) == 0) {
// return PageLeafImpl.INDEX_REMOVED;
return rowOffset;
}
else {
rowOffset += removeLength;
break;
}
default:
throw new IllegalStateException(L.l("Corrupted block {0} offset {1} code {2}\n",
this, rowOffset, code));
}
}
if (sortOffset < BLOCK_SIZE) {
return findSorted(cursor);
}
return PageLeafImpl.INDEX_UNMATCH;
} | java | int find(RowCursor cursor)
{
int rowOffset = _rowHead;
int sortOffset = _rowSortHead;
int rowLength = cursor.length();
int removeLength = cursor.removeLength();
byte []buffer = _buffer;
while (rowOffset < sortOffset) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
if (cursor.compareKeyRow(buffer, rowOffset) == 0) {
return rowOffset;
}
else {
rowOffset += rowLength;
break;
}
case INSERT_DEAD:
rowOffset += rowLength;
break;
case REMOVE:
if (cursor.compareKeyRemove(buffer, rowOffset) == 0) {
// return PageLeafImpl.INDEX_REMOVED;
return rowOffset;
}
else {
rowOffset += removeLength;
break;
}
default:
throw new IllegalStateException(L.l("Corrupted block {0} offset {1} code {2}\n",
this, rowOffset, code));
}
}
if (sortOffset < BLOCK_SIZE) {
return findSorted(cursor);
}
return PageLeafImpl.INDEX_UNMATCH;
} | [
"int",
"find",
"(",
"RowCursor",
"cursor",
")",
"{",
"int",
"rowOffset",
"=",
"_rowHead",
";",
"int",
"sortOffset",
"=",
"_rowSortHead",
";",
"int",
"rowLength",
"=",
"cursor",
".",
"length",
"(",
")",
";",
"int",
"removeLength",
"=",
"cursor",
".",
"rem... | Searches for a row matching the cursor's key. | [
"Searches",
"for",
"a",
"row",
"matching",
"the",
"cursor",
"s",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L227-L275 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.first | boolean first(RowCursor minCursor,
RowCursor resultCursor,
boolean isMatch)
{
int ptr = _rowHead;
int rowLength = resultCursor.length();
int removeLength = resultCursor.removeLength();
int sortOffset = _rowSortHead;
byte []buffer = _buffer;
while (ptr < sortOffset) {
int code = buffer[ptr] & CODE_MASK;
int minCmp;
int cmp;
switch (code) {
case INSERT:
if ((minCmp = minCursor.compareKeyRow(buffer, ptr)) <= 0
&& ((cmp = resultCursor.compareKeyRow(buffer, ptr)) > 0
|| cmp == 0 && ! isMatch)) {
fillMatch(ptr, resultCursor);
if (minCmp == 0) {
return true;
}
isMatch = true;
}
ptr += rowLength;
break;
case INSERT_DEAD:
ptr += rowLength;
break;
case REMOVE:
if ((minCmp = minCursor.compareKeyRemove(buffer, ptr)) <= 0
&& ((cmp = resultCursor.compareKeyRemove(buffer, ptr)) > 0
|| cmp == 0 && ! isMatch)) {
resultCursor.setRemove(buffer, ptr);
//resultCursor.setKey(buffer, ptr + 1);
if (minCmp == 0) {
return true;
}
isMatch = true;
}
ptr += removeLength;
break;
default:
System.out.println("BROKEN_ENTRY:");
return false;
}
}
if (sortOffset < BLOCK_SIZE) {
return findFirstSorted(minCursor, resultCursor, isMatch);
}
else {
return isMatch;
}
} | java | boolean first(RowCursor minCursor,
RowCursor resultCursor,
boolean isMatch)
{
int ptr = _rowHead;
int rowLength = resultCursor.length();
int removeLength = resultCursor.removeLength();
int sortOffset = _rowSortHead;
byte []buffer = _buffer;
while (ptr < sortOffset) {
int code = buffer[ptr] & CODE_MASK;
int minCmp;
int cmp;
switch (code) {
case INSERT:
if ((minCmp = minCursor.compareKeyRow(buffer, ptr)) <= 0
&& ((cmp = resultCursor.compareKeyRow(buffer, ptr)) > 0
|| cmp == 0 && ! isMatch)) {
fillMatch(ptr, resultCursor);
if (minCmp == 0) {
return true;
}
isMatch = true;
}
ptr += rowLength;
break;
case INSERT_DEAD:
ptr += rowLength;
break;
case REMOVE:
if ((minCmp = minCursor.compareKeyRemove(buffer, ptr)) <= 0
&& ((cmp = resultCursor.compareKeyRemove(buffer, ptr)) > 0
|| cmp == 0 && ! isMatch)) {
resultCursor.setRemove(buffer, ptr);
//resultCursor.setKey(buffer, ptr + 1);
if (minCmp == 0) {
return true;
}
isMatch = true;
}
ptr += removeLength;
break;
default:
System.out.println("BROKEN_ENTRY:");
return false;
}
}
if (sortOffset < BLOCK_SIZE) {
return findFirstSorted(minCursor, resultCursor, isMatch);
}
else {
return isMatch;
}
} | [
"boolean",
"first",
"(",
"RowCursor",
"minCursor",
",",
"RowCursor",
"resultCursor",
",",
"boolean",
"isMatch",
")",
"{",
"int",
"ptr",
"=",
"_rowHead",
";",
"int",
"rowLength",
"=",
"resultCursor",
".",
"length",
"(",
")",
";",
"int",
"removeLength",
"=",
... | Finds the row with the smallest key larger than minCursor
and fills the cursor. | [
"Finds",
"the",
"row",
"with",
"the",
"smallest",
"key",
"larger",
"than",
"minCursor",
"and",
"fills",
"the",
"cursor",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L330-L397 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.findFirstSorted | private boolean findFirstSorted(RowCursor minCursor,
RowCursor resultCursor,
boolean isMatch)
{
int rowOffset = _rowSortHead;
int rowLength = resultCursor.length();
int cmp = resultCursor.compareKey(_keyMinSort, 0);
if (cmp < 0 || cmp == 0 && isMatch) {
return isMatch;
}
int minCmp = minCursor.compareKey(_keyMaxSort, 0);
if (minCmp > 0) {
return isMatch;
}
minCmp = minCursor.compareKey(_keyMinSort, 0);
if (minCmp <= 0) {
fillMatch(BLOCK_SIZE - rowLength, resultCursor);
return true;
}
int length = (BLOCK_SIZE - rowOffset) / rowLength - 1;
// rowOffset += rowLength;
while (length > 0) {
int pivot = length / 2;
int pivotOffset = rowOffset + pivot * rowLength;
// if minCursor is in this block, test if the row is greater
minCmp = minCursor.compareKeyRow(_buffer, pivotOffset);
if (minCmp == 0) {
return fillMatch(pivotOffset, resultCursor);
}
else if (minCmp > 0) {
length = pivot;
continue;
}
// test row against current min
cmp = resultCursor.compareKeyRow(_buffer, pivotOffset);
if (cmp > 0) {
// it's a better result, copy and search for smaller
isMatch = true;
fillMatch(pivotOffset, resultCursor);
}
// search for smaller
rowOffset = pivotOffset + rowLength;
length = length - pivot - 1;
}
return isMatch;
} | java | private boolean findFirstSorted(RowCursor minCursor,
RowCursor resultCursor,
boolean isMatch)
{
int rowOffset = _rowSortHead;
int rowLength = resultCursor.length();
int cmp = resultCursor.compareKey(_keyMinSort, 0);
if (cmp < 0 || cmp == 0 && isMatch) {
return isMatch;
}
int minCmp = minCursor.compareKey(_keyMaxSort, 0);
if (minCmp > 0) {
return isMatch;
}
minCmp = minCursor.compareKey(_keyMinSort, 0);
if (minCmp <= 0) {
fillMatch(BLOCK_SIZE - rowLength, resultCursor);
return true;
}
int length = (BLOCK_SIZE - rowOffset) / rowLength - 1;
// rowOffset += rowLength;
while (length > 0) {
int pivot = length / 2;
int pivotOffset = rowOffset + pivot * rowLength;
// if minCursor is in this block, test if the row is greater
minCmp = minCursor.compareKeyRow(_buffer, pivotOffset);
if (minCmp == 0) {
return fillMatch(pivotOffset, resultCursor);
}
else if (minCmp > 0) {
length = pivot;
continue;
}
// test row against current min
cmp = resultCursor.compareKeyRow(_buffer, pivotOffset);
if (cmp > 0) {
// it's a better result, copy and search for smaller
isMatch = true;
fillMatch(pivotOffset, resultCursor);
}
// search for smaller
rowOffset = pivotOffset + rowLength;
length = length - pivot - 1;
}
return isMatch;
} | [
"private",
"boolean",
"findFirstSorted",
"(",
"RowCursor",
"minCursor",
",",
"RowCursor",
"resultCursor",
",",
"boolean",
"isMatch",
")",
"{",
"int",
"rowOffset",
"=",
"_rowSortHead",
";",
"int",
"rowLength",
"=",
"resultCursor",
".",
"length",
"(",
")",
";",
... | In a sorted block, find the minimum key less than the currentResult
and greater than the min.
The sort is reverse order. The smallest value is at the end.
@param minCursor the minimum allowed key value for the search
@param resultCursor the current best match for the search
@param isMatch true if the current resultCursor is a match | [
"In",
"a",
"sorted",
"block",
"find",
"the",
"minimum",
"key",
"less",
"than",
"the",
"currentResult",
"and",
"greater",
"than",
"the",
"min",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L409-L472 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.getFirstKey | byte[] getFirstKey(TableKelp table)
{
int keyOffset = table.getKeyOffset();
int keyLength = table.getKeyLength();
int offset = _rowHead + keyOffset;
byte []key = new byte[keyLength];
byte []buffer = getBuffer();
System.arraycopy(buffer, offset, key, 0, keyLength);
return key;
} | java | byte[] getFirstKey(TableKelp table)
{
int keyOffset = table.getKeyOffset();
int keyLength = table.getKeyLength();
int offset = _rowHead + keyOffset;
byte []key = new byte[keyLength];
byte []buffer = getBuffer();
System.arraycopy(buffer, offset, key, 0, keyLength);
return key;
} | [
"byte",
"[",
"]",
"getFirstKey",
"(",
"TableKelp",
"table",
")",
"{",
"int",
"keyOffset",
"=",
"table",
".",
"getKeyOffset",
"(",
")",
";",
"int",
"keyLength",
"=",
"table",
".",
"getKeyLength",
"(",
")",
";",
"int",
"offset",
"=",
"_rowHead",
"+",
"ke... | Returns the first key in the block.
XXX: ??? since the keys are unsorted, why is this valuable | [
"Returns",
"the",
"first",
"key",
"in",
"the",
"block",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L487-L500 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.fillEntryTree | void fillEntryTree(Set<PageLeafEntry> entries,
Row row)
{
int ptr = _rowHead;
byte []buffer = _buffer;
while (ptr < BLOCK_SIZE) {
int code = buffer[ptr] & CODE_MASK;
int len = getLength(code, row);
if (code == INSERT || code == REMOVE) {
PageLeafEntry entry = new PageLeafEntry(this, row, ptr, len, code);
entries.add(entry);
}
ptr += len;
}
} | java | void fillEntryTree(Set<PageLeafEntry> entries,
Row row)
{
int ptr = _rowHead;
byte []buffer = _buffer;
while (ptr < BLOCK_SIZE) {
int code = buffer[ptr] & CODE_MASK;
int len = getLength(code, row);
if (code == INSERT || code == REMOVE) {
PageLeafEntry entry = new PageLeafEntry(this, row, ptr, len, code);
entries.add(entry);
}
ptr += len;
}
} | [
"void",
"fillEntryTree",
"(",
"Set",
"<",
"PageLeafEntry",
">",
"entries",
",",
"Row",
"row",
")",
"{",
"int",
"ptr",
"=",
"_rowHead",
";",
"byte",
"[",
"]",
"buffer",
"=",
"_buffer",
";",
"while",
"(",
"ptr",
"<",
"BLOCK_SIZE",
")",
"{",
"int",
"cod... | Fills the entry tree map with entries from the block. | [
"Fills",
"the",
"entry",
"tree",
"map",
"with",
"entries",
"from",
"the",
"block",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L505-L524 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.validateBlock | void validateBlock(Row row)
{
if (! row.getDatabase().isValidate()) {
return;
}
int rowHead = _rowHead;
int blobTail = _blobTail;
if (rowHead < blobTail) {
throw new IllegalStateException(this
+ " rowHead:" + rowHead
+ " blobTail:" + blobTail);
}
int rowOffset = _rowHead;
byte []buffer = _buffer;
while (rowOffset < BLOCK_SIZE) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
row.validate(buffer, rowOffset, rowHead, blobTail);
break;
case INSERT_DEAD:
case REMOVE:
break;
default:
throw new IllegalStateException(this + " " + rowOffset + " " + code + " unknown code");
}
int len = getLength(code, row);
if (len < 0 || len + rowOffset > BLOCK_SIZE) {
throw new IllegalStateException(this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len");
}
rowOffset += len;
}
} | java | void validateBlock(Row row)
{
if (! row.getDatabase().isValidate()) {
return;
}
int rowHead = _rowHead;
int blobTail = _blobTail;
if (rowHead < blobTail) {
throw new IllegalStateException(this
+ " rowHead:" + rowHead
+ " blobTail:" + blobTail);
}
int rowOffset = _rowHead;
byte []buffer = _buffer;
while (rowOffset < BLOCK_SIZE) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
row.validate(buffer, rowOffset, rowHead, blobTail);
break;
case INSERT_DEAD:
case REMOVE:
break;
default:
throw new IllegalStateException(this + " " + rowOffset + " " + code + " unknown code");
}
int len = getLength(code, row);
if (len < 0 || len + rowOffset > BLOCK_SIZE) {
throw new IllegalStateException(this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len");
}
rowOffset += len;
}
} | [
"void",
"validateBlock",
"(",
"Row",
"row",
")",
"{",
"if",
"(",
"!",
"row",
".",
"getDatabase",
"(",
")",
".",
"isValidate",
"(",
")",
")",
"{",
"return",
";",
"}",
"int",
"rowHead",
"=",
"_rowHead",
";",
"int",
"blobTail",
"=",
"_blobTail",
";",
... | Validate the block, checking that row lengths and values are sensible. | [
"Validate",
"the",
"block",
"checking",
"that",
"row",
"lengths",
"and",
"values",
"are",
"sensible",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L529-L572 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.fillDeltaEntries | void fillDeltaEntries(Set<PageLeafEntry> entries,
Row row,
int tail)
{
int rowOffset = _rowHead;
byte []buffer = _buffer;
while (rowOffset < tail) {
int code = buffer[rowOffset] & CODE_MASK;
int len = getLength(code, row);
if (code == INSERT || code == REMOVE) {
PageLeafEntry entry = new PageLeafEntry(this, row, rowOffset, len, code);
entries.add(entry);
}
rowOffset += len;
}
} | java | void fillDeltaEntries(Set<PageLeafEntry> entries,
Row row,
int tail)
{
int rowOffset = _rowHead;
byte []buffer = _buffer;
while (rowOffset < tail) {
int code = buffer[rowOffset] & CODE_MASK;
int len = getLength(code, row);
if (code == INSERT || code == REMOVE) {
PageLeafEntry entry = new PageLeafEntry(this, row, rowOffset, len, code);
entries.add(entry);
}
rowOffset += len;
}
} | [
"void",
"fillDeltaEntries",
"(",
"Set",
"<",
"PageLeafEntry",
">",
"entries",
",",
"Row",
"row",
",",
"int",
"tail",
")",
"{",
"int",
"rowOffset",
"=",
"_rowHead",
";",
"byte",
"[",
"]",
"buffer",
"=",
"_buffer",
";",
"while",
"(",
"rowOffset",
"<",
"t... | Fill the entry set from the tree map. | [
"Fill",
"the",
"entry",
"set",
"from",
"the",
"tree",
"map",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L577-L597 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.writeCheckpointFull | void writeCheckpointFull(OutputStream os, int rowHead)
throws IOException
{
BitsUtil.writeInt16(os, _blobTail);
os.write(_buffer, 0, _blobTail);
rowHead = Math.max(rowHead, _rowHead);
int rowLength = _buffer.length - rowHead;
BitsUtil.writeInt16(os, rowLength);
os.write(_buffer, rowHead, rowLength);
} | java | void writeCheckpointFull(OutputStream os, int rowHead)
throws IOException
{
BitsUtil.writeInt16(os, _blobTail);
os.write(_buffer, 0, _blobTail);
rowHead = Math.max(rowHead, _rowHead);
int rowLength = _buffer.length - rowHead;
BitsUtil.writeInt16(os, rowLength);
os.write(_buffer, rowHead, rowLength);
} | [
"void",
"writeCheckpointFull",
"(",
"OutputStream",
"os",
",",
"int",
"rowHead",
")",
"throws",
"IOException",
"{",
"BitsUtil",
".",
"writeInt16",
"(",
"os",
",",
"_blobTail",
")",
";",
"os",
".",
"write",
"(",
"_buffer",
",",
"0",
",",
"_blobTail",
")",
... | Writes the block to the checkpoint stream.
Because of timing, the requested rowHead might be for an older
checkpoint of the block, if new rows have arrived since the request.
<pre><code>
b16 - inline blob length (blobTail)
<n> - inline blob data
b16 - row data length (block_size - row_head)
<m> - row data
</code></pre>
@param rowHead the requested row head | [
"Writes",
"the",
"block",
"to",
"the",
"checkpoint",
"stream",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L698-L710 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.readCheckpointFull | void readCheckpointFull(InputStream is)
throws IOException
{
_blobTail = BitsUtil.readInt16(is);
if (_blobTail < 0 || _buffer.length < _blobTail) {
throw new IllegalStateException("Invalid blob tail: " + _blobTail
//+ " pos=" + (is.getPosition() - 2)
+ " " + this);
}
byte []buffer = _buffer;
IoUtil.readAll(is, buffer, 0, _blobTail);
int rowLength = BitsUtil.readInt16(is);
rowHead(_buffer.length - rowLength);
int rowHead = rowHead();
if (rowHead < getBlobTail() || buffer.length < rowHead) {
throw new IllegalStateException(L.l("Invalid row-head={0} blob-tail={1}",
rowHead(), getBlobTail()));
}
IoUtil.readAll(is, buffer, rowHead, buffer.length - rowHead);
// validateBlock(row);
} | java | void readCheckpointFull(InputStream is)
throws IOException
{
_blobTail = BitsUtil.readInt16(is);
if (_blobTail < 0 || _buffer.length < _blobTail) {
throw new IllegalStateException("Invalid blob tail: " + _blobTail
//+ " pos=" + (is.getPosition() - 2)
+ " " + this);
}
byte []buffer = _buffer;
IoUtil.readAll(is, buffer, 0, _blobTail);
int rowLength = BitsUtil.readInt16(is);
rowHead(_buffer.length - rowLength);
int rowHead = rowHead();
if (rowHead < getBlobTail() || buffer.length < rowHead) {
throw new IllegalStateException(L.l("Invalid row-head={0} blob-tail={1}",
rowHead(), getBlobTail()));
}
IoUtil.readAll(is, buffer, rowHead, buffer.length - rowHead);
// validateBlock(row);
} | [
"void",
"readCheckpointFull",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"_blobTail",
"=",
"BitsUtil",
".",
"readInt16",
"(",
"is",
")",
";",
"if",
"(",
"_blobTail",
"<",
"0",
"||",
"_buffer",
".",
"length",
"<",
"_blobTail",
")",
"{",
... | Reads a full block checkpoint.
<pre><code>
blobLen int16
blobData {blobLen}
rowLen int16
rowData {rowLen}
</code></pre> | [
"Reads",
"a",
"full",
"block",
"checkpoint",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L722-L750 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/inbox/InboxBase.java | InboxBase.shutdown | @Override
public void shutdown(ShutdownModeAmp mode)
{
QueryMap queryMap = _queryMapRef.get();
if (queryMap != null) {
queryMap.close();
}
} | java | @Override
public void shutdown(ShutdownModeAmp mode)
{
QueryMap queryMap = _queryMapRef.get();
if (queryMap != null) {
queryMap.close();
}
} | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
"ShutdownModeAmp",
"mode",
")",
"{",
"QueryMap",
"queryMap",
"=",
"_queryMapRef",
".",
"get",
"(",
")",
";",
"if",
"(",
"queryMap",
"!=",
"null",
")",
"{",
"queryMap",
".",
"close",
"(",
")",
";",
"}"... | Closes the mailbox | [
"Closes",
"the",
"mailbox"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/inbox/InboxBase.java#L207-L215 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.add | public void add(int i)
{
if (_data.length <= _size)
expand(_size + 1);
_data[_size++] = i;
} | java | public void add(int i)
{
if (_data.length <= _size)
expand(_size + 1);
_data[_size++] = i;
} | [
"public",
"void",
"add",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"_data",
".",
"length",
"<=",
"_size",
")",
"expand",
"(",
"_size",
"+",
"1",
")",
";",
"_data",
"[",
"_size",
"++",
"]",
"=",
"i",
";",
"}"
] | Adds an integer to the array. | [
"Adds",
"an",
"integer",
"to",
"the",
"array",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L75-L81 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.add | public void add(IntArray array)
{
if (_data.length <= array._size)
expand(_size + array._size);
for (int i = 0; i < array._size; i++)
_data[_size++] = array._data[i];
} | java | public void add(IntArray array)
{
if (_data.length <= array._size)
expand(_size + array._size);
for (int i = 0; i < array._size; i++)
_data[_size++] = array._data[i];
} | [
"public",
"void",
"add",
"(",
"IntArray",
"array",
")",
"{",
"if",
"(",
"_data",
".",
"length",
"<=",
"array",
".",
"_size",
")",
"expand",
"(",
"_size",
"+",
"array",
".",
"_size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ar... | Appends the integers in array to the end of this array. | [
"Appends",
"the",
"integers",
"in",
"array",
"to",
"the",
"end",
"of",
"this",
"array",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L86-L93 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.add | public void add(int i, int value)
{
expand(_size + 1);
System.arraycopy(_data, i, _data, i + 1, _size - i);
_data[i] = value;
_size++;
} | java | public void add(int i, int value)
{
expand(_size + 1);
System.arraycopy(_data, i, _data, i + 1, _size - i);
_data[i] = value;
_size++;
} | [
"public",
"void",
"add",
"(",
"int",
"i",
",",
"int",
"value",
")",
"{",
"expand",
"(",
"_size",
"+",
"1",
")",
";",
"System",
".",
"arraycopy",
"(",
"_data",
",",
"i",
",",
"_data",
",",
"i",
"+",
"1",
",",
"_size",
"-",
"i",
")",
";",
"_dat... | Inserts an integer into the array. | [
"Inserts",
"an",
"integer",
"into",
"the",
"array",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L97-L104 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.setLength | public void setLength(int size)
{
expand(size);
for (int i = _size; i < size; i++)
_data[i] = 0;
_size = size;
} | java | public void setLength(int size)
{
expand(size);
for (int i = _size; i < size; i++)
_data[i] = 0;
_size = size;
} | [
"public",
"void",
"setLength",
"(",
"int",
"size",
")",
"{",
"expand",
"(",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"_size",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"_data",
"[",
"i",
"]",
"=",
"0",
";",
"_size",
"=",
"size",
";",
... | Sets the length of the array, filling with zero if necessary. | [
"Sets",
"the",
"length",
"of",
"the",
"array",
"filling",
"with",
"zero",
"if",
"necessary",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L117-L125 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.contains | public boolean contains(int test)
{
int []data = _data;
for (int i = _size - 1; i >= 0; i--) {
if (data[i] == test)
return true;
}
return false;
} | java | public boolean contains(int test)
{
int []data = _data;
for (int i = _size - 1; i >= 0; i--) {
if (data[i] == test)
return true;
}
return false;
} | [
"public",
"boolean",
"contains",
"(",
"int",
"test",
")",
"{",
"int",
"[",
"]",
"data",
"=",
"_data",
";",
"for",
"(",
"int",
"i",
"=",
"_size",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"data",
"[",
"i",
"]",
"=="... | Returns true if the array contains and integer equal to test. | [
"Returns",
"true",
"if",
"the",
"array",
"contains",
"and",
"integer",
"equal",
"to",
"test",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L168-L178 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.isSubset | public boolean isSubset(IntArray subset)
{
int []subData = subset._data;
for (int i = subset._size - 1; i >= 0; i--) {
if (! contains(subData[i]))
return false;
}
return true;
} | java | public boolean isSubset(IntArray subset)
{
int []subData = subset._data;
for (int i = subset._size - 1; i >= 0; i--) {
if (! contains(subData[i]))
return false;
}
return true;
} | [
"public",
"boolean",
"isSubset",
"(",
"IntArray",
"subset",
")",
"{",
"int",
"[",
"]",
"subData",
"=",
"subset",
".",
"_data",
";",
"for",
"(",
"int",
"i",
"=",
"subset",
".",
"_size",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"i... | True if all the integers in subset are contained in the array. | [
"True",
"if",
"all",
"the",
"integers",
"in",
"subset",
"are",
"contained",
"in",
"the",
"array",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L182-L192 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IntArray.java | IntArray.union | public void union(IntArray newArray)
{
for (int i = 0; i < newArray._size; i++) {
if (! contains(newArray._data[i]))
add(newArray._data[i]);
}
} | java | public void union(IntArray newArray)
{
for (int i = 0; i < newArray._size; i++) {
if (! contains(newArray._data[i]))
add(newArray._data[i]);
}
} | [
"public",
"void",
"union",
"(",
"IntArray",
"newArray",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newArray",
".",
"_size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"contains",
"(",
"newArray",
".",
"_data",
"[",
"i",
"]",
")"... | Adds the members of newArray to the list if they are not already
members of the array. | [
"Adds",
"the",
"members",
"of",
"newArray",
"to",
"the",
"list",
"if",
"they",
"are",
"not",
"already",
"members",
"of",
"the",
"array",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IntArray.java#L197-L203 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java | AgreementRestEntity.getAgreementById | @GET
@Path("{id}")
public IAgreement getAgreementById(@PathParam("id") String agreementId) throws NotFoundException {
logger.debug("StartOf getAgreementById REQUEST for /agreements/" + agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
IAgreement agreement = agreementRestHelper.getAgreementByID(agreementId);
if (agreement==null){
logger.info("getAgreementById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementById");
return agreement;
} | java | @GET
@Path("{id}")
public IAgreement getAgreementById(@PathParam("id") String agreementId) throws NotFoundException {
logger.debug("StartOf getAgreementById REQUEST for /agreements/" + agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
IAgreement agreement = agreementRestHelper.getAgreementByID(agreementId);
if (agreement==null){
logger.info("getAgreementById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementById");
return agreement;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"{id}\"",
")",
"public",
"IAgreement",
"getAgreementById",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"String",
"agreementId",
")",
"throws",
"NotFoundException",
"{",
"logger",
".",
"debug",
"(",
"\"StartOf getAgreementById REQUEST... | Gets the information of an specific agreement. If the agreement it is not
in the database, it returns 404 with empty payload
<pre>
GET /agreements/{id}
Request:
GET /agreements HTTP/1.1
Response:
HTTP/1.1 200 OK
Content-type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<wsag:Agreement>...</wsag:Agreement>
Example: <li>curl
http://localhost:8080/sla-service/agreements/agreement04</li>
@param id
of the agreement
@return XML information with the different details of the agreement
@throws NotFoundException | [
"Gets",
"the",
"information",
"of",
"an",
"specific",
"agreement",
".",
"If",
"the",
"agreement",
"it",
"is",
"not",
"in",
"the",
"database",
"it",
"returns",
"404",
"with",
"empty",
"payload"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java#L215-L229 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java | AgreementRestEntity.getAgreementContextById | @GET
@Path("{id}/context")
public eu.atos.sla.parser.data.wsag.Context getAgreementContextById(@PathParam("id") String agreementId) throws NotFoundException, InternalException {
logger.debug("StartOf getAgreementContextById REQUEST for /agreements/{}/context", agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
eu.atos.sla.parser.data.wsag.Context context;
try {
context = agreementRestHelper.getAgreementContextByID(agreementId);
} catch (InternalHelperException e) {
logger.error("getAgreementContextById InternalException", e);
throw new InternalException(e.getMessage());
}
if (context==null){
logger.info("getAgreementContextById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementContextById");
return context;
} | java | @GET
@Path("{id}/context")
public eu.atos.sla.parser.data.wsag.Context getAgreementContextById(@PathParam("id") String agreementId) throws NotFoundException, InternalException {
logger.debug("StartOf getAgreementContextById REQUEST for /agreements/{}/context", agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
eu.atos.sla.parser.data.wsag.Context context;
try {
context = agreementRestHelper.getAgreementContextByID(agreementId);
} catch (InternalHelperException e) {
logger.error("getAgreementContextById InternalException", e);
throw new InternalException(e.getMessage());
}
if (context==null){
logger.info("getAgreementContextById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementContextById");
return context;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"{id}/context\"",
")",
"public",
"eu",
".",
"atos",
".",
"sla",
".",
"parser",
".",
"data",
".",
"wsag",
".",
"Context",
"getAgreementContextById",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"String",
"agreementId",
")",
"... | Gets the context information of an specific agreement.
<pre>
GET /agreements/{id}
Request:
GET /agreements HTTP/1.1
Response:
HTTP/1.1 200 OK
Content-type: application/xml
Example: <li>curl
http://localhost:8080/sla-service/agreements/context/agreement04</li>
@param id of the agreement
@return XML information with the different details of the context
@throws NotFoundException
@throws InternalException | [
"Gets",
"the",
"context",
"information",
"of",
"an",
"specific",
"agreement",
"."
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java#L257-L276 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/SelectManagerFactoryJni.java | SelectManagerFactoryJni.createJni | public static PollTcpManager createJni()
{
try {
/*
Class<?> jniSelectManager = SelectManagerJni.class;
Method method = jniSelectManager.getMethod("create");
*/
return (PollTcpManager) SelectManagerJni.create();
} catch (Throwable e) {
// catch Throwable because of possible linking errors
log.finer(e.toString());
}
return null;
} | java | public static PollTcpManager createJni()
{
try {
/*
Class<?> jniSelectManager = SelectManagerJni.class;
Method method = jniSelectManager.getMethod("create");
*/
return (PollTcpManager) SelectManagerJni.create();
} catch (Throwable e) {
// catch Throwable because of possible linking errors
log.finer(e.toString());
}
return null;
} | [
"public",
"static",
"PollTcpManager",
"createJni",
"(",
")",
"{",
"try",
"{",
"/*\n Class<?> jniSelectManager = SelectManagerJni.class;\n \n Method method = jniSelectManager.getMethod(\"create\");\n */",
"return",
"(",
"PollTcpManager",
")",
"SelectManagerJni",
".",... | Sets the timeout. | [
"Sets",
"the",
"timeout",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/SelectManagerFactoryJni.java#L47-L63 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/network/balance/ClientNetworkState.java | ClientNetworkState.onFail | public void onFail()
{
_lastFailTime = CurrentTime.currentTime();
if (_firstFailTime == 0) {
_firstFailTime = _lastFailTime;
}
_firstSuccessTime = 0;
toState(State.FAIL);
long recoverTimeout = _dynamicRecoverTimeout.get();
long nextRecoverTimeout = Math.min(recoverTimeout + 1000L, _recoverTimeout);
_dynamicRecoverTimeout.compareAndSet(recoverTimeout, nextRecoverTimeout);
} | java | public void onFail()
{
_lastFailTime = CurrentTime.currentTime();
if (_firstFailTime == 0) {
_firstFailTime = _lastFailTime;
}
_firstSuccessTime = 0;
toState(State.FAIL);
long recoverTimeout = _dynamicRecoverTimeout.get();
long nextRecoverTimeout = Math.min(recoverTimeout + 1000L, _recoverTimeout);
_dynamicRecoverTimeout.compareAndSet(recoverTimeout, nextRecoverTimeout);
} | [
"public",
"void",
"onFail",
"(",
")",
"{",
"_lastFailTime",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
";",
"if",
"(",
"_firstFailTime",
"==",
"0",
")",
"{",
"_firstFailTime",
"=",
"_lastFailTime",
";",
"}",
"_firstSuccessTime",
"=",
"0",
";",
"toSt... | Called when the connection fails. | [
"Called",
"when",
"the",
"connection",
"fails",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/network/balance/ClientNetworkState.java#L164-L180 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/network/balance/ClientNetworkState.java | ClientNetworkState.startConnection | public boolean startConnection()
{
State state = _state.get();
if (state.isActive()) {
// when active, always start a connection
_connectionCount.incrementAndGet();
return true;
}
long now = CurrentTime.currentTime();
long lastFailTime = _lastFailTime;
long recoverTimeout = _dynamicRecoverTimeout.get();
if (now < lastFailTime + recoverTimeout) {
// if the fail recover hasn't timed out, return false
return false;
}
// when fail, only start a single connection
int count;
do {
count = _connectionCount.get();
if (count > 0) {
return false;
}
} while (! _connectionCount.compareAndSet(count, count + 1));
return true;
} | java | public boolean startConnection()
{
State state = _state.get();
if (state.isActive()) {
// when active, always start a connection
_connectionCount.incrementAndGet();
return true;
}
long now = CurrentTime.currentTime();
long lastFailTime = _lastFailTime;
long recoverTimeout = _dynamicRecoverTimeout.get();
if (now < lastFailTime + recoverTimeout) {
// if the fail recover hasn't timed out, return false
return false;
}
// when fail, only start a single connection
int count;
do {
count = _connectionCount.get();
if (count > 0) {
return false;
}
} while (! _connectionCount.compareAndSet(count, count + 1));
return true;
} | [
"public",
"boolean",
"startConnection",
"(",
")",
"{",
"State",
"state",
"=",
"_state",
".",
"get",
"(",
")",
";",
"if",
"(",
"state",
".",
"isActive",
"(",
")",
")",
"{",
"// when active, always start a connection",
"_connectionCount",
".",
"incrementAndGet",
... | Start a new connection. Returns true if the connection can be
started. | [
"Start",
"a",
"new",
"connection",
".",
"Returns",
"true",
"if",
"the",
"connection",
"can",
"be",
"started",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/network/balance/ClientNetworkState.java#L186-L219 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java | CodeEnhancer.addShort | public void addShort(int offset, int value)
{
insertCode(offset, 2);
_code.set(offset + 0, value >> 8);
_code.set(offset + 1, value);
} | java | public void addShort(int offset, int value)
{
insertCode(offset, 2);
_code.set(offset + 0, value >> 8);
_code.set(offset + 1, value);
} | [
"public",
"void",
"addShort",
"(",
"int",
"offset",
",",
"int",
"value",
")",
"{",
"insertCode",
"(",
"offset",
",",
"2",
")",
";",
"_code",
".",
"set",
"(",
"offset",
"+",
"0",
",",
"value",
">>",
"8",
")",
";",
"_code",
".",
"set",
"(",
"offset... | Adds a short to the code. | [
"Adds",
"a",
"short",
"to",
"the",
"code",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java#L127-L133 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java | CodeEnhancer.add | public void add(int offset, byte []buffer, int bufOffset, int length)
{
insertCode(offset, length);
_code.set(offset, buffer, bufOffset, length);
} | java | public void add(int offset, byte []buffer, int bufOffset, int length)
{
insertCode(offset, length);
_code.set(offset, buffer, bufOffset, length);
} | [
"public",
"void",
"add",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufOffset",
",",
"int",
"length",
")",
"{",
"insertCode",
"(",
"offset",
",",
"length",
")",
";",
"_code",
".",
"set",
"(",
"offset",
",",
"buffer",
",",
"... | Adds a byte to the code. | [
"Adds",
"a",
"byte",
"to",
"the",
"code",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java#L138-L143 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java | CodeEnhancer.update | public void update()
{
byte []code = new byte[_code.size()];
System.arraycopy(_code.getBuffer(), 0, code, 0, _code.size());
_codeAttr.setCode(code);
if (_changeLength) {
// XXX: really need more sophisticated solution
ArrayList<Attribute> attrList = getCodeAttribute().getAttributes();
for (int i = attrList.size() - 1; i >= 0; i--) {
Attribute attr = attrList.get(i);
if (attr.getName().equals("LineNumberTable"))
attrList.remove(i);
}
}
} | java | public void update()
{
byte []code = new byte[_code.size()];
System.arraycopy(_code.getBuffer(), 0, code, 0, _code.size());
_codeAttr.setCode(code);
if (_changeLength) {
// XXX: really need more sophisticated solution
ArrayList<Attribute> attrList = getCodeAttribute().getAttributes();
for (int i = attrList.size() - 1; i >= 0; i--) {
Attribute attr = attrList.get(i);
if (attr.getName().equals("LineNumberTable"))
attrList.remove(i);
}
}
} | [
"public",
"void",
"update",
"(",
")",
"{",
"byte",
"[",
"]",
"code",
"=",
"new",
"byte",
"[",
"_code",
".",
"size",
"(",
")",
"]",
";",
"System",
".",
"arraycopy",
"(",
"_code",
".",
"getBuffer",
"(",
")",
",",
"0",
",",
"code",
",",
"0",
",",
... | Updates the code. | [
"Updates",
"the",
"code",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeEnhancer.java#L309-L327 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java | ServiceRefLinkFactory.createLinkService | public ServiceRefAmp createLinkService(String path, PodRef podCaller)
{
StubLink actorLink;
String address = _scheme + "//" + _serviceRefOut.address() + path;
ServiceRefAmp parentRef = _actorOut.getServiceRef();
if (_queryMapRef != null) {
//String addressSelf = "/system";
//ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef();
actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut);
}
else {
actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut);
}
ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address);
// ServiceRefClient needed to maintain workers, cloud/0420
ServiceRefAmp clientRef = new ServiceRefClient(address,
linkRef.stub(),
linkRef.inbox());
actorLink.initSelfRef(clientRef);
return clientRef;
} | java | public ServiceRefAmp createLinkService(String path, PodRef podCaller)
{
StubLink actorLink;
String address = _scheme + "//" + _serviceRefOut.address() + path;
ServiceRefAmp parentRef = _actorOut.getServiceRef();
if (_queryMapRef != null) {
//String addressSelf = "/system";
//ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef();
actorLink = new StubLinkUnidir(_manager, path, parentRef, _queryMapRef, podCaller, _actorOut);
}
else {
actorLink = new StubLink(_manager, path, parentRef, podCaller, _actorOut);
}
ServiceRefAmp linkRef = _serviceRefOut.pin(actorLink, address);
// ServiceRefClient needed to maintain workers, cloud/0420
ServiceRefAmp clientRef = new ServiceRefClient(address,
linkRef.stub(),
linkRef.inbox());
actorLink.initSelfRef(clientRef);
return clientRef;
} | [
"public",
"ServiceRefAmp",
"createLinkService",
"(",
"String",
"path",
",",
"PodRef",
"podCaller",
")",
"{",
"StubLink",
"actorLink",
";",
"String",
"address",
"=",
"_scheme",
"+",
"\"//\"",
"+",
"_serviceRefOut",
".",
"address",
"(",
")",
"+",
"path",
";",
... | Return the serviceRef for a foreign path and calling pod.
@param path the service path on the foreign server
@param podCaller the name of the calling pod. | [
"Return",
"the",
"serviceRef",
"for",
"a",
"foreign",
"path",
"and",
"calling",
"pod",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/amp/remote/ServiceRefLinkFactory.java#L86-L115 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/IdentityGenerator.java | IdentityGenerator.get | public long get()
{
long now = CurrentTime.currentTime() / 1000;
long oldSequence;
long newSequence;
do {
oldSequence = _sequence.get();
long oldTime = oldSequence >>> _timeOffset;
if (oldTime != now) {
newSequence = ((now << _timeOffset)
+ (randomLong() & _sequenceRandomMask));
}
else {
// relatively prime increment will use the whole sequence space
newSequence = oldSequence + _sequenceIncrement;
}
} while (! _sequence.compareAndSet(oldSequence, newSequence));
long id = ((now << _timeOffset)
| _node
| (newSequence & _sequenceMask));
return id;
} | java | public long get()
{
long now = CurrentTime.currentTime() / 1000;
long oldSequence;
long newSequence;
do {
oldSequence = _sequence.get();
long oldTime = oldSequence >>> _timeOffset;
if (oldTime != now) {
newSequence = ((now << _timeOffset)
+ (randomLong() & _sequenceRandomMask));
}
else {
// relatively prime increment will use the whole sequence space
newSequence = oldSequence + _sequenceIncrement;
}
} while (! _sequence.compareAndSet(oldSequence, newSequence));
long id = ((now << _timeOffset)
| _node
| (newSequence & _sequenceMask));
return id;
} | [
"public",
"long",
"get",
"(",
")",
"{",
"long",
"now",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
"/",
"1000",
";",
"long",
"oldSequence",
";",
"long",
"newSequence",
";",
"do",
"{",
"oldSequence",
"=",
"_sequence",
".",
"get",
"(",
")",
";",
... | Returns the next id. | [
"Returns",
"the",
"next",
"id",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/IdentityGenerator.java#L112-L139 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java | KbServerSideException.fromThrowable | public static KbServerSideException fromThrowable(Throwable cause) {
return (cause instanceof KbServerSideException)
? (KbServerSideException) cause
: new KbServerSideException(cause);
} | java | public static KbServerSideException fromThrowable(Throwable cause) {
return (cause instanceof KbServerSideException)
? (KbServerSideException) cause
: new KbServerSideException(cause);
} | [
"public",
"static",
"KbServerSideException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbServerSideException",
")",
"?",
"(",
"KbServerSideException",
")",
"cause",
":",
"new",
"KbServerSideException",
"(",
"cause",
... | Converts a Throwable to a KbServerSideException. If the Throwable is a
KbServerSideException, it will be passed through unmodified; otherwise, it will be wrapped
in a new KbServerSideException.
@param cause the Throwable to convert
@return a KbServerSideException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbServerSideException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbServerSideException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"KbSe... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java#L45-L49 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java | KbServerSideException.fromThrowable | public static KbServerSideException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage()))
? (KbServerSideException) cause
: new KbServerSideException(message, cause);
} | java | public static KbServerSideException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage()))
? (KbServerSideException) cause
: new KbServerSideException(message, cause);
} | [
"public",
"static",
"KbServerSideException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbServerSideException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessa... | Converts a Throwable to a KbServerSideException with the specified detail message. If the
Throwable is a KbServerSideException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbServerSideException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbServerSideException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbServerSideException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbServerSideException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java#L62-L66 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java | KbTypeConflictException.fromThrowable | public static KbTypeConflictException fromThrowable(Throwable cause) {
return (cause instanceof KbTypeConflictException)
? (KbTypeConflictException) cause
: new KbTypeConflictException(cause);
} | java | public static KbTypeConflictException fromThrowable(Throwable cause) {
return (cause instanceof KbTypeConflictException)
? (KbTypeConflictException) cause
: new KbTypeConflictException(cause);
} | [
"public",
"static",
"KbTypeConflictException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbTypeConflictException",
")",
"?",
"(",
"KbTypeConflictException",
")",
"cause",
":",
"new",
"KbTypeConflictException",
"(",
"c... | Converts a Throwable to a KbTypeConflictException. If the Throwable is a
KbTypeConflictException, it will be passed through unmodified; otherwise, it will be wrapped
in a new KbTypeConflictException.
@param cause the Throwable to convert
@return a KbTypeConflictException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbTypeConflictException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbTypeConflictException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java#L51-L55 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java | KbTypeConflictException.fromThrowable | public static KbTypeConflictException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage()))
? (KbTypeConflictException) cause
: new KbTypeConflictException(message, cause);
} | java | public static KbTypeConflictException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage()))
? (KbTypeConflictException) cause
: new KbTypeConflictException(message, cause);
} | [
"public",
"static",
"KbTypeConflictException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbTypeConflictException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getM... | Converts a Throwable to a KbTypeConflictException with the specified detail message. If the
Throwable is a KbTypeConflictException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbTypeConflictException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbTypeConflictException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbTypeConflictException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbTypeConflictException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"t... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java#L68-L72 | train |
xebia-france/xebia-servlet-extras | src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java | ExpiresFilter.intsToCommaDelimitedString | protected static String intsToCommaDelimitedString(int[] ints) {
if (ints == null) {
return "";
}
StringBuilder result = new StringBuilder();
for (int i = 0; i < ints.length; i++) {
result.append(ints[i]);
if (i < (ints.length - 1)) {
result.append(", ");
}
}
return result.toString();
} | java | protected static String intsToCommaDelimitedString(int[] ints) {
if (ints == null) {
return "";
}
StringBuilder result = new StringBuilder();
for (int i = 0; i < ints.length; i++) {
result.append(ints[i]);
if (i < (ints.length - 1)) {
result.append(", ");
}
}
return result.toString();
} | [
"protected",
"static",
"String",
"intsToCommaDelimitedString",
"(",
"int",
"[",
"]",
"ints",
")",
"{",
"if",
"(",
"ints",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(... | Convert an array of ints into a comma delimited string | [
"Convert",
"an",
"array",
"of",
"ints",
"into",
"a",
"comma",
"delimited",
"string"
] | b263636fc78f8794dde57d92b835edb5e95ce379 | https://github.com/xebia-france/xebia-servlet-extras/blob/b263636fc78f8794dde57d92b835edb5e95ce379/src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java#L1129-L1143 | train |
xebia-france/xebia-servlet-extras | src/main/java/fr/xebia/servlet/filter/SecuredRemoteAddressFilter.java | SecuredRemoteAddressFilter.init | public void init(FilterConfig filterConfig) throws ServletException {
String comaDelimitedSecuredRemoteAddresses = filterConfig.getInitParameter(SECURED_REMOTE_ADDRESSES_PARAMETER);
if (comaDelimitedSecuredRemoteAddresses != null) {
setSecuredRemoteAdresses(comaDelimitedSecuredRemoteAddresses);
}
} | java | public void init(FilterConfig filterConfig) throws ServletException {
String comaDelimitedSecuredRemoteAddresses = filterConfig.getInitParameter(SECURED_REMOTE_ADDRESSES_PARAMETER);
if (comaDelimitedSecuredRemoteAddresses != null) {
setSecuredRemoteAdresses(comaDelimitedSecuredRemoteAddresses);
}
} | [
"public",
"void",
"init",
"(",
"FilterConfig",
"filterConfig",
")",
"throws",
"ServletException",
"{",
"String",
"comaDelimitedSecuredRemoteAddresses",
"=",
"filterConfig",
".",
"getInitParameter",
"(",
"SECURED_REMOTE_ADDRESSES_PARAMETER",
")",
";",
"if",
"(",
"comaDelim... | Compile the secured remote addresses patterns. | [
"Compile",
"the",
"secured",
"remote",
"addresses",
"patterns",
"."
] | b263636fc78f8794dde57d92b835edb5e95ce379 | https://github.com/xebia-france/xebia-servlet-extras/blob/b263636fc78f8794dde57d92b835edb5e95ce379/src/main/java/fr/xebia/servlet/filter/SecuredRemoteAddressFilter.java#L205-L210 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryException.java | QueryException.fromThrowable | public static QueryException fromThrowable(Throwable cause) {
return (cause instanceof QueryException)
? (QueryException) cause
: new QueryException(cause);
} | java | public static QueryException fromThrowable(Throwable cause) {
return (cause instanceof QueryException)
? (QueryException) cause
: new QueryException(cause);
} | [
"public",
"static",
"QueryException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"QueryException",
")",
"?",
"(",
"QueryException",
")",
"cause",
":",
"new",
"QueryException",
"(",
"cause",
")",
";",
"}"
] | Converts a Throwable to a QueryException. If the Throwable is a QueryException, it will be
passed through unmodified; otherwise, it will be wrapped in a new QueryException.
@param cause the Throwable to convert
@return a QueryException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"QueryException",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryException.java#L42-L46 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryException.java | QueryException.fromThrowable | public static QueryException fromThrowable(String message, Throwable cause) {
return (cause instanceof QueryException && Objects.equals(message, cause.getMessage()))
? (QueryException) cause
: new QueryException(message, cause);
} | java | public static QueryException fromThrowable(String message, Throwable cause) {
return (cause instanceof QueryException && Objects.equals(message, cause.getMessage()))
? (QueryException) cause
: new QueryException(message, cause);
} | [
"public",
"static",
"QueryException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"QueryException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
... | Converts a Throwable to a QueryException with the specified detail message. If the Throwable is
a QueryException and if the Throwable's message is identical to the one supplied, the Throwable
will be passed through unmodified; otherwise, it will be wrapped in a new QueryException with
the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a QueryException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
"s... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryException.java#L59-L63 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java | SessionServiceException.fromThrowable | public static SessionServiceException fromThrowable(Class interfaceClass, Throwable cause) {
return (cause instanceof SessionServiceException
&& Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass()))
? (SessionServiceException) cause
: new SessionServiceException(interfaceClass, cause);
} | java | public static SessionServiceException fromThrowable(Class interfaceClass, Throwable cause) {
return (cause instanceof SessionServiceException
&& Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass()))
? (SessionServiceException) cause
: new SessionServiceException(interfaceClass, cause);
} | [
"public",
"static",
"SessionServiceException",
"fromThrowable",
"(",
"Class",
"interfaceClass",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionServiceException",
"&&",
"Objects",
".",
"equals",
"(",
"interfaceClass",
",",
"(",
"("... | Converts a Throwable to a SessionServiceException. If the Throwable is a
SessionServiceException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionServiceException.
@param cause the Throwable to convert
@param interfaceClass
@return a SessionServiceException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionServiceException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionServiceException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java#L45-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java | SessionServiceException.fromThrowable | public static SessionServiceException fromThrowable(Class interfaceClass, String message, Throwable cause) {
return (cause instanceof SessionServiceException
&& Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass())
&& Objects.equals(message, cause.getMessage()))
? (SessionServiceException) cause
: new SessionServiceException(interfaceClass, message, cause);
} | java | public static SessionServiceException fromThrowable(Class interfaceClass, String message, Throwable cause) {
return (cause instanceof SessionServiceException
&& Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass())
&& Objects.equals(message, cause.getMessage()))
? (SessionServiceException) cause
: new SessionServiceException(interfaceClass, message, cause);
} | [
"public",
"static",
"SessionServiceException",
"fromThrowable",
"(",
"Class",
"interfaceClass",
",",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionServiceException",
"&&",
"Objects",
".",
"equals",
"(",
"inte... | Converts a Throwable to a SessionServiceException with the specified detail message. If the
Throwable is a SessionServiceException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionServiceException with the detail message.
@param cause the Throwable to convert
@param interfaceClass
@param message the specified detail message
@return a SessionServiceException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionServiceException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionServiceException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"t... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionServiceException.java#L64-L70 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java | KbTypeException.fromThrowable | public static KbTypeException fromThrowable(Throwable cause) {
return (cause instanceof KbTypeException)
? (KbTypeException) cause
: new KbTypeException(cause);
} | java | public static KbTypeException fromThrowable(Throwable cause) {
return (cause instanceof KbTypeException)
? (KbTypeException) cause
: new KbTypeException(cause);
} | [
"public",
"static",
"KbTypeException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbTypeException",
")",
"?",
"(",
"KbTypeException",
")",
"cause",
":",
"new",
"KbTypeException",
"(",
"cause",
")",
";",
"}"
] | Converts a Throwable to a KbTypeException. If the Throwable is a
KbTypeException, it will be passed through unmodified; otherwise, it will be wrapped
in a new KbTypeException.
@param cause the Throwable to convert
@return a KbTypeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbTypeException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbTypeException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"KbTypeException"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java#L46-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java | KbTypeException.fromThrowable | public static KbTypeException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbTypeException && Objects.equals(message, cause.getMessage()))
? (KbTypeException) cause
: new KbTypeException(message, cause);
} | java | public static KbTypeException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbTypeException && Objects.equals(message, cause.getMessage()))
? (KbTypeException) cause
: new KbTypeException(message, cause);
} | [
"public",
"static",
"KbTypeException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbTypeException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
... | Converts a Throwable to a KbTypeException with the specified detail message. If the
Throwable is a KbTypeException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbTypeException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbTypeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbTypeException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbTypeException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java#L63-L67 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java | SessionCommunicationException.fromThrowable | public static SessionCommunicationException fromThrowable(Throwable cause) {
return (cause instanceof SessionCommunicationException)
? (SessionCommunicationException) cause
: new SessionCommunicationException(cause);
} | java | public static SessionCommunicationException fromThrowable(Throwable cause) {
return (cause instanceof SessionCommunicationException)
? (SessionCommunicationException) cause
: new SessionCommunicationException(cause);
} | [
"public",
"static",
"SessionCommunicationException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionCommunicationException",
")",
"?",
"(",
"SessionCommunicationException",
")",
"cause",
":",
"new",
"SessionCommunicatio... | Converts a Throwable to a SessionCommunicationException. If the Throwable is a
SessionCommunicationException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionCommunicationException.
@param cause the Throwable to convert
@return a SessionCommunicationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionCommunicationException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionCommunicationException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java#L45-L49 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java | SessionCommunicationException.fromThrowable | public static SessionCommunicationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage()))
? (SessionCommunicationException) cause
: new SessionCommunicationException(message, cause);
} | java | public static SessionCommunicationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage()))
? (SessionCommunicationException) cause
: new SessionCommunicationException(message, cause);
} | [
"public",
"static",
"SessionCommunicationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionCommunicationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
... | Converts a Throwable to a SessionCommunicationException with the specified detail message. If the
Throwable is a SessionCommunicationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionCommunicationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionCommunicationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionCommunicationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionCommunicationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java#L62-L66 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java | QueryConstructionException.fromThrowable | public static QueryConstructionException fromThrowable(Throwable cause) {
return (cause instanceof QueryConstructionException)
? (QueryConstructionException) cause
: new QueryConstructionException(cause);
} | java | public static QueryConstructionException fromThrowable(Throwable cause) {
return (cause instanceof QueryConstructionException)
? (QueryConstructionException) cause
: new QueryConstructionException(cause);
} | [
"public",
"static",
"QueryConstructionException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"QueryConstructionException",
")",
"?",
"(",
"QueryConstructionException",
")",
"cause",
":",
"new",
"QueryConstructionException",... | Converts a Throwable to a QueryConstructionException. If the Throwable is a
QueryConstructionException, it will be passed through unmodified; otherwise, it will be wrapped
in a new QueryConstructionException.
@param cause the Throwable to convert
@return a QueryConstructionException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryConstructionException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryConstructionException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java#L44-L48 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java | QueryConstructionException.fromThrowable | public static QueryConstructionException fromThrowable(String message, Throwable cause) {
return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage()))
? (QueryConstructionException) cause
: new QueryConstructionException(message, cause);
} | java | public static QueryConstructionException fromThrowable(String message, Throwable cause) {
return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage()))
? (QueryConstructionException) cause
: new QueryConstructionException(message, cause);
} | [
"public",
"static",
"QueryConstructionException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"QueryConstructionException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
... | Converts a Throwable to a QueryConstructionException with the specified detail message. If the
Throwable is a QueryConstructionException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new QueryConstructionException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a QueryConstructionException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryConstructionException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryConstructionException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java#L61-L65 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java | SessionManagerException.fromThrowable | public static SessionManagerException fromThrowable(Throwable cause) {
return (cause instanceof SessionManagerException)
? (SessionManagerException) cause
: new SessionManagerException(cause);
} | java | public static SessionManagerException fromThrowable(Throwable cause) {
return (cause instanceof SessionManagerException)
? (SessionManagerException) cause
: new SessionManagerException(cause);
} | [
"public",
"static",
"SessionManagerException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerException",
")",
"?",
"(",
"SessionManagerException",
")",
"cause",
":",
"new",
"SessionManagerException",
"(",
"c... | Converts a Throwable to a SessionManagerException. If the Throwable is a
SessionManagerException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionManagerException.
@param cause the Throwable to convert
@return a SessionManagerException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java#L45-L49 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java | SessionManagerException.fromThrowable | public static SessionManagerException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | java | public static SessionManagerException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | [
"public",
"static",
"SessionManagerException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getM... | Converts a Throwable to a SessionManagerException with the specified detail message. If the
Throwable is a SessionManagerException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionManagerException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionManagerException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"t... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java#L62-L66 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java | InvalidFormulaInContextException.fromThrowable | public static InvalidFormulaInContextException fromThrowable(Throwable cause) {
return (cause instanceof InvalidFormulaInContextException)
? (InvalidFormulaInContextException) cause
: new InvalidFormulaInContextException(cause);
} | java | public static InvalidFormulaInContextException fromThrowable(Throwable cause) {
return (cause instanceof InvalidFormulaInContextException)
? (InvalidFormulaInContextException) cause
: new InvalidFormulaInContextException(cause);
} | [
"public",
"static",
"InvalidFormulaInContextException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"InvalidFormulaInContextException",
")",
"?",
"(",
"InvalidFormulaInContextException",
")",
"cause",
":",
"new",
"InvalidFor... | Converts a Throwable to a InvalidFormulaInContextException. If the Throwable is a
InvalidFormulaInContextException, it will be passed through unmodified; otherwise, it will be wrapped
in a new InvalidFormulaInContextException.
@param cause the Throwable to convert
@return a InvalidFormulaInContextException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"InvalidFormulaInContextException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"InvalidFormulaInContextException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java#L46-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java | InvalidFormulaInContextException.fromThrowable | public static InvalidFormulaInContextException fromThrowable(String message, Throwable cause) {
return (cause instanceof InvalidFormulaInContextException && Objects.equals(message, cause.getMessage()))
? (InvalidFormulaInContextException) cause
: new InvalidFormulaInContextException(message, cause);
} | java | public static InvalidFormulaInContextException fromThrowable(String message, Throwable cause) {
return (cause instanceof InvalidFormulaInContextException && Objects.equals(message, cause.getMessage()))
? (InvalidFormulaInContextException) cause
: new InvalidFormulaInContextException(message, cause);
} | [
"public",
"static",
"InvalidFormulaInContextException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"InvalidFormulaInContextException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"caus... | Converts a Throwable to a InvalidFormulaInContextException with the specified detail message. If the
Throwable is a InvalidFormulaInContextException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new InvalidFormulaInContextException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a InvalidFormulaInContextException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"InvalidFormulaInContextException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"InvalidFormulaInContextException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identi... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java#L63-L67 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java | InvalidNameException.fromThrowable | public static InvalidNameException fromThrowable(Throwable cause) {
return (cause instanceof InvalidNameException)
? (InvalidNameException) cause
: new InvalidNameException(cause);
} | java | public static InvalidNameException fromThrowable(Throwable cause) {
return (cause instanceof InvalidNameException)
? (InvalidNameException) cause
: new InvalidNameException(cause);
} | [
"public",
"static",
"InvalidNameException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"InvalidNameException",
")",
"?",
"(",
"InvalidNameException",
")",
"cause",
":",
"new",
"InvalidNameException",
"(",
"cause",
")"... | Converts a Throwable to a InvalidNameException. If the Throwable is a
InvalidNameException, it will be passed through unmodified; otherwise, it will be wrapped
in a new InvalidNameException.
@param cause the Throwable to convert
@return a InvalidNameException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"InvalidNameException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"InvalidNameException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"Invali... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java#L47-L51 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java | InvalidNameException.fromThrowable | public static InvalidNameException fromThrowable(String message, Throwable cause) {
return (cause instanceof InvalidNameException && Objects.equals(message, cause.getMessage()))
? (InvalidNameException) cause
: new InvalidNameException(message, cause);
} | java | public static InvalidNameException fromThrowable(String message, Throwable cause) {
return (cause instanceof InvalidNameException && Objects.equals(message, cause.getMessage()))
? (InvalidNameException) cause
: new InvalidNameException(message, cause);
} | [
"public",
"static",
"InvalidNameException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"InvalidNameException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage... | Converts a Throwable to a InvalidNameException with the specified detail message. If the
Throwable is a InvalidNameException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new InvalidNameException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a InvalidNameException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"InvalidNameException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"InvalidNameException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java#L64-L68 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java | SessionConfigurationException.fromThrowable | public static SessionConfigurationException fromThrowable(Throwable cause) {
return (cause instanceof SessionConfigurationException)
? (SessionConfigurationException) cause
: new SessionConfigurationException(cause);
} | java | public static SessionConfigurationException fromThrowable(Throwable cause) {
return (cause instanceof SessionConfigurationException)
? (SessionConfigurationException) cause
: new SessionConfigurationException(cause);
} | [
"public",
"static",
"SessionConfigurationException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionConfigurationException",
")",
"?",
"(",
"SessionConfigurationException",
")",
"cause",
":",
"new",
"SessionConfiguratio... | Converts a Throwable to a SessionConfigurationException. If the Throwable is a
SessionConfigurationException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionConfigurationException.
@param cause the Throwable to convert
@return a SessionConfigurationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionConfigurationException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionConfigurationException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java#L45-L49 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java | SessionConfigurationException.fromThrowable | public static SessionConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionConfigurationException) cause
: new SessionConfigurationException(message, cause);
} | java | public static SessionConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionConfigurationException) cause
: new SessionConfigurationException(message, cause);
} | [
"public",
"static",
"SessionConfigurationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionConfigurationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
... | Converts a Throwable to a SessionConfigurationException with the specified detail message. If the
Throwable is a SessionConfigurationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionConfigurationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionConfigurationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionConfigurationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionConfigurationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionConfigurationException.java#L62-L66 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java | SessionInitializationException.fromThrowable | public static SessionInitializationException fromThrowable(Throwable cause) {
return (cause instanceof SessionInitializationException)
? (SessionInitializationException) cause
: new SessionInitializationException(cause);
} | java | public static SessionInitializationException fromThrowable(Throwable cause) {
return (cause instanceof SessionInitializationException)
? (SessionInitializationException) cause
: new SessionInitializationException(cause);
} | [
"public",
"static",
"SessionInitializationException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionInitializationException",
")",
"?",
"(",
"SessionInitializationException",
")",
"cause",
":",
"new",
"SessionInitializ... | Converts a Throwable to a SessionInitializationException. If the Throwable is a
SessionInitializationException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionInitializationException.
@param cause the Throwable to convert
@return a SessionInitializationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionInitializationException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionInitializationException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java#L45-L49 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java | SessionInitializationException.fromThrowable | public static SessionInitializationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionInitializationException && Objects.equals(message, cause.getMessage()))
? (SessionInitializationException) cause
: new SessionInitializationException(message, cause);
} | java | public static SessionInitializationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionInitializationException && Objects.equals(message, cause.getMessage()))
? (SessionInitializationException) cause
: new SessionInitializationException(message, cause);
} | [
"public",
"static",
"SessionInitializationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionInitializationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
... | Converts a Throwable to a SessionInitializationException with the specified detail message. If the
Throwable is a SessionInitializationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionInitializationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionInitializationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionInitializationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionInitializationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java#L62-L66 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionException.java | SessionException.fromThrowable | public static SessionException fromThrowable(Throwable cause) {
return (cause instanceof SessionException)
? (SessionException) cause
: new SessionException(cause);
} | java | public static SessionException fromThrowable(Throwable cause) {
return (cause instanceof SessionException)
? (SessionException) cause
: new SessionException(cause);
} | [
"public",
"static",
"SessionException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionException",
")",
"?",
"(",
"SessionException",
")",
"cause",
":",
"new",
"SessionException",
"(",
"cause",
")",
";",
"}"
] | Converts a Throwable to a SessionException. If the Throwable is a
SessionException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionException.
@param cause the Throwable to convert
@return a SessionException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"SessionExcepti... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionException.java#L48-L52 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionException.java | SessionException.fromThrowable | public static SessionException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionException && Objects.equals(message, cause.getMessage()))
? (SessionException) cause
: new SessionException(message, cause);
} | java | public static SessionException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionException && Objects.equals(message, cause.getMessage()))
? (SessionException) cause
: new SessionException(message, cause);
} | [
"public",
"static",
"SessionException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"("... | Converts a Throwable to a SessionException with the specified detail message. If the
Throwable is a SessionException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionException.java#L65-L69 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/VariableArityException.java | VariableArityException.fromThrowable | public static VariableArityException fromThrowable(String message, Throwable cause) {
return (cause instanceof VariableArityException && Objects.equals(message, cause.getMessage()))
? (VariableArityException) cause
: new VariableArityException(message, cause);
} | java | public static VariableArityException fromThrowable(String message, Throwable cause) {
return (cause instanceof VariableArityException && Objects.equals(message, cause.getMessage()))
? (VariableArityException) cause
: new VariableArityException(message, cause);
} | [
"public",
"static",
"VariableArityException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"VariableArityException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMes... | Converts a Throwable to a VariableArityException with the specified detail message. If the
Throwable is a VariableArityException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new VariableArityException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a VariableArityException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"VariableArityException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"VariableArityException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/VariableArityException.java#L50-L54 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java | KbObjectNotFoundException.fromThrowable | public static KbObjectNotFoundException fromThrowable(Throwable cause) {
return (cause instanceof KbObjectNotFoundException)
? (KbObjectNotFoundException) cause
: new KbObjectNotFoundException(cause);
} | java | public static KbObjectNotFoundException fromThrowable(Throwable cause) {
return (cause instanceof KbObjectNotFoundException)
? (KbObjectNotFoundException) cause
: new KbObjectNotFoundException(cause);
} | [
"public",
"static",
"KbObjectNotFoundException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbObjectNotFoundException",
")",
"?",
"(",
"KbObjectNotFoundException",
")",
"cause",
":",
"new",
"KbObjectNotFoundException",
"... | Converts a Throwable to a KbObjectNotFoundException. If the Throwable is a
KbObjectNotFoundException, it will be passed through unmodified; otherwise, it will be wrapped
in a new KbObjectNotFoundException.
@param cause the Throwable to convert
@return a KbObjectNotFoundException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbObjectNotFoundException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbObjectNotFoundException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java#L48-L52 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java | KbObjectNotFoundException.fromThrowable | public static KbObjectNotFoundException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbObjectNotFoundException && Objects.equals(message, cause.getMessage()))
? (KbObjectNotFoundException) cause
: new KbObjectNotFoundException(message, cause);
} | java | public static KbObjectNotFoundException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbObjectNotFoundException && Objects.equals(message, cause.getMessage()))
? (KbObjectNotFoundException) cause
: new KbObjectNotFoundException(message, cause);
} | [
"public",
"static",
"KbObjectNotFoundException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbObjectNotFoundException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"... | Converts a Throwable to a KbObjectNotFoundException with the specified detail message. If the
Throwable is a KbObjectNotFoundException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbObjectNotFoundException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbObjectNotFoundException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbObjectNotFoundException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbObjectNotFoundException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java#L65-L69 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java | KbRuntimeException.fromThrowable | public static KbRuntimeException fromThrowable(Throwable cause) {
return (cause instanceof KbRuntimeException)
? (KbRuntimeException) cause
: new KbRuntimeException(cause);
} | java | public static KbRuntimeException fromThrowable(Throwable cause) {
return (cause instanceof KbRuntimeException)
? (KbRuntimeException) cause
: new KbRuntimeException(cause);
} | [
"public",
"static",
"KbRuntimeException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbRuntimeException",
")",
"?",
"(",
"KbRuntimeException",
")",
"cause",
":",
"new",
"KbRuntimeException",
"(",
"cause",
")",
";",... | Converts a Throwable to a KbRuntimeException. If the Throwable is a
KbRuntimeException, it will be passed through unmodified; otherwise, it will be wrapped
in a new KbRuntimeException.
@param cause the Throwable to convert
@return a KbRuntimeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbRuntimeException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbRuntimeException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"KbRuntimeE... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java#L51-L55 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java | KbRuntimeException.fromThrowable | public static KbRuntimeException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbRuntimeException && Objects.equals(message, cause.getMessage()))
? (KbRuntimeException) cause
: new KbRuntimeException(message, cause);
} | java | public static KbRuntimeException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbRuntimeException && Objects.equals(message, cause.getMessage()))
? (KbRuntimeException) cause
: new KbRuntimeException(message, cause);
} | [
"public",
"static",
"KbRuntimeException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbRuntimeException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
... | Converts a Throwable to a KbRuntimeException with the specified detail message. If the
Throwable is a KbRuntimeException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbRuntimeException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbRuntimeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbRuntimeException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbRuntimeException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"on... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java#L68-L72 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/StaleKbObjectException.java | StaleKbObjectException.fromThrowable | public static StaleKbObjectException fromThrowable(Throwable cause) {
return (cause instanceof StaleKbObjectException)
? (StaleKbObjectException) cause
: new StaleKbObjectException(cause);
} | java | public static StaleKbObjectException fromThrowable(Throwable cause) {
return (cause instanceof StaleKbObjectException)
? (StaleKbObjectException) cause
: new StaleKbObjectException(cause);
} | [
"public",
"static",
"StaleKbObjectException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"StaleKbObjectException",
")",
"?",
"(",
"StaleKbObjectException",
")",
"cause",
":",
"new",
"StaleKbObjectException",
"(",
"cause... | Converts a Throwable to a StaleKbObjectException. If the Throwable is a
StaleKbObjectException, it will be passed through unmodified; otherwise, it will be wrapped
in a new StaleKbObjectException.
@param cause the Throwable to convert
@return a StaleKbObjectException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"StaleKbObjectException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"StaleKbObjectException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"St... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/StaleKbObjectException.java#L58-L62 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/StaleKbObjectException.java | StaleKbObjectException.fromThrowable | public static StaleKbObjectException fromThrowable(String message, Throwable cause) {
return (cause instanceof StaleKbObjectException && Objects.equals(message, cause.getMessage()))
? (StaleKbObjectException) cause
: new StaleKbObjectException(message, cause);
} | java | public static StaleKbObjectException fromThrowable(String message, Throwable cause) {
return (cause instanceof StaleKbObjectException && Objects.equals(message, cause.getMessage()))
? (StaleKbObjectException) cause
: new StaleKbObjectException(message, cause);
} | [
"public",
"static",
"StaleKbObjectException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"StaleKbObjectException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMes... | Converts a Throwable to a StaleKbObjectException with the specified detail message. If the
Throwable is a StaleKbObjectException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new StaleKbObjectException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a StaleKbObjectException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"StaleKbObjectException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"StaleKbObjectException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/StaleKbObjectException.java#L75-L79 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/OpenCycUnsupportedFeatureException.java | OpenCycUnsupportedFeatureException.fromThrowable | public static OpenCycUnsupportedFeatureException fromThrowable(Throwable cause) {
return (cause instanceof OpenCycUnsupportedFeatureException)
? (OpenCycUnsupportedFeatureException) cause
: new OpenCycUnsupportedFeatureException(cause);
} | java | public static OpenCycUnsupportedFeatureException fromThrowable(Throwable cause) {
return (cause instanceof OpenCycUnsupportedFeatureException)
? (OpenCycUnsupportedFeatureException) cause
: new OpenCycUnsupportedFeatureException(cause);
} | [
"public",
"static",
"OpenCycUnsupportedFeatureException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"OpenCycUnsupportedFeatureException",
")",
"?",
"(",
"OpenCycUnsupportedFeatureException",
")",
"cause",
":",
"new",
"Open... | Converts a Throwable to a OpenCycUnsupportedFeatureException. If the Throwable is a
OpenCycUnsupportedFeatureException, it will be passed through unmodified; otherwise, it will be wrapped
in a new OpenCycUnsupportedFeatureException.
@param cause the Throwable to convert
@return a OpenCycUnsupportedFeatureException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"OpenCycUnsupportedFeatureException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"OpenCycUnsupportedFeatureException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/OpenCycUnsupportedFeatureException.java#L46-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/OpenCycUnsupportedFeatureException.java | OpenCycUnsupportedFeatureException.fromThrowable | public static OpenCycUnsupportedFeatureException fromThrowable(String message, Throwable cause) {
return (cause instanceof OpenCycUnsupportedFeatureException && Objects.equals(message, cause.getMessage()))
? (OpenCycUnsupportedFeatureException) cause
: new OpenCycUnsupportedFeatureException(message, cause);
} | java | public static OpenCycUnsupportedFeatureException fromThrowable(String message, Throwable cause) {
return (cause instanceof OpenCycUnsupportedFeatureException && Objects.equals(message, cause.getMessage()))
? (OpenCycUnsupportedFeatureException) cause
: new OpenCycUnsupportedFeatureException(message, cause);
} | [
"public",
"static",
"OpenCycUnsupportedFeatureException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"OpenCycUnsupportedFeatureException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"... | Converts a Throwable to a OpenCycUnsupportedFeatureException with the specified detail message. If the
Throwable is a OpenCycUnsupportedFeatureException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new OpenCycUnsupportedFeatureException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a OpenCycUnsupportedFeatureException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"OpenCycUnsupportedFeatureException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"OpenCycUnsupportedFeatureException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"id... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/OpenCycUnsupportedFeatureException.java#L63-L67 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/CreateException.java | CreateException.fromThrowable | public static CreateException fromThrowable(Throwable cause) {
return (cause instanceof CreateException)
? (CreateException) cause
: new CreateException(cause);
} | java | public static CreateException fromThrowable(Throwable cause) {
return (cause instanceof CreateException)
? (CreateException) cause
: new CreateException(cause);
} | [
"public",
"static",
"CreateException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"CreateException",
")",
"?",
"(",
"CreateException",
")",
"cause",
":",
"new",
"CreateException",
"(",
"cause",
")",
";",
"}"
] | Converts a Throwable to a CreateException. If the Throwable is a
CreateException, it will be passed through unmodified; otherwise, it will be wrapped
in a new CreateException.
@param cause the Throwable to convert
@return a CreateException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"CreateException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"CreateException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"CreateException"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/CreateException.java#L47-L51 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/CreateException.java | CreateException.fromThrowable | public static CreateException fromThrowable(String message, Throwable cause) {
return (cause instanceof CreateException && Objects.equals(message, cause.getMessage()))
? (CreateException) cause
: new CreateException(message, cause);
} | java | public static CreateException fromThrowable(String message, Throwable cause) {
return (cause instanceof CreateException && Objects.equals(message, cause.getMessage()))
? (CreateException) cause
: new CreateException(message, cause);
} | [
"public",
"static",
"CreateException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"CreateException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
... | Converts a Throwable to a CreateException with the specified detail message. If the
Throwable is a CreateException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new CreateException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a CreateException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"CreateException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"CreateException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/CreateException.java#L64-L68 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerConfigurationException.java | SessionManagerConfigurationException.fromThrowable | public static SessionManagerConfigurationException fromThrowable(Throwable cause) {
return (cause instanceof SessionManagerConfigurationException)
? (SessionManagerConfigurationException) cause
: new SessionManagerConfigurationException(cause);
} | java | public static SessionManagerConfigurationException fromThrowable(Throwable cause) {
return (cause instanceof SessionManagerConfigurationException)
? (SessionManagerConfigurationException) cause
: new SessionManagerConfigurationException(cause);
} | [
"public",
"static",
"SessionManagerConfigurationException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerConfigurationException",
")",
"?",
"(",
"SessionManagerConfigurationException",
")",
"cause",
":",
"new",
... | Converts a Throwable to a SessionManagerConfigurationException. If the Throwable is a
SessionManagerConfigurationException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionManagerConfigurationException.
@param cause the Throwable to convert
@return a SessionManagerConfigurationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerConfigurationException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerConfigurationException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerConfigurationException.java#L46-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerConfigurationException.java | SessionManagerConfigurationException.fromThrowable | public static SessionManagerConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionManagerConfigurationException) cause
: new SessionManagerConfigurationException(message, cause);
} | java | public static SessionManagerConfigurationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerConfigurationException && Objects.equals(message, cause.getMessage()))
? (SessionManagerConfigurationException) cause
: new SessionManagerConfigurationException(message, cause);
} | [
"public",
"static",
"SessionManagerConfigurationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerConfigurationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",... | Converts a Throwable to a SessionManagerConfigurationException with the specified detail message. If the
Throwable is a SessionManagerConfigurationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionManagerConfigurationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionManagerConfigurationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerConfigurationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerConfigurationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerConfigurationException.java#L63-L67 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/CycAddressImpl.java | CycAddressImpl.isAPortOffset | private static boolean isAPortOffset(int offset) {
return (offset == STANDARD_ASCII_PORT_OFFSET)
|| (offset == STANDARD_HTTP_PORT_OFFSET)
|| (offset == STANDARD_SERVLET_PORT_OFFSET)
|| (offset == STANDARD_CFASL_PORT_OFFSET);
} | java | private static boolean isAPortOffset(int offset) {
return (offset == STANDARD_ASCII_PORT_OFFSET)
|| (offset == STANDARD_HTTP_PORT_OFFSET)
|| (offset == STANDARD_SERVLET_PORT_OFFSET)
|| (offset == STANDARD_CFASL_PORT_OFFSET);
} | [
"private",
"static",
"boolean",
"isAPortOffset",
"(",
"int",
"offset",
")",
"{",
"return",
"(",
"offset",
"==",
"STANDARD_ASCII_PORT_OFFSET",
")",
"||",
"(",
"offset",
"==",
"STANDARD_HTTP_PORT_OFFSET",
")",
"||",
"(",
"offset",
"==",
"STANDARD_SERVLET_PORT_OFFSET",... | Tests whether an int is a known port offset.
@param offset
@return | [
"Tests",
"whether",
"an",
"int",
"is",
"a",
"known",
"port",
"offset",
"."
] | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/CycAddressImpl.java#L84-L89 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java | SessionCommandException.fromThrowable | public static SessionCommandException fromThrowable(Throwable cause) {
return (cause instanceof SessionCommandException)
? (SessionCommandException) cause
: new SessionCommandException(cause);
} | java | public static SessionCommandException fromThrowable(Throwable cause) {
return (cause instanceof SessionCommandException)
? (SessionCommandException) cause
: new SessionCommandException(cause);
} | [
"public",
"static",
"SessionCommandException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionCommandException",
")",
"?",
"(",
"SessionCommandException",
")",
"cause",
":",
"new",
"SessionCommandException",
"(",
"c... | Converts a Throwable to a SessionCommandException. If the Throwable is a
SessionCommandException, it will be passed through unmodified; otherwise, it will be wrapped
in a new SessionCommandException.
@param cause the Throwable to convert
@return a SessionCommandException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionCommandException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionCommandException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java#L46-L50 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java | SessionCommandException.fromThrowable | public static SessionCommandException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommandException && Objects.equals(message, cause.getMessage()))
? (SessionCommandException) cause
: new SessionCommandException(message, cause);
} | java | public static SessionCommandException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommandException && Objects.equals(message, cause.getMessage()))
? (SessionCommandException) cause
: new SessionCommandException(message, cause);
} | [
"public",
"static",
"SessionCommandException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionCommandException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getM... | Converts a Throwable to a SessionCommandException with the specified detail message. If the
Throwable is a SessionCommandException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionCommandException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionCommandException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionCommandException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionCommandException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"t... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java#L63-L67 | train |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/UnsupportedCycOperationException.java | UnsupportedCycOperationException.fromThrowable | public static UnsupportedCycOperationException fromThrowable(Throwable cause) {
return (cause instanceof UnsupportedCycOperationException)
? (UnsupportedCycOperationException) cause
: new UnsupportedCycOperationException(cause);
} | java | public static UnsupportedCycOperationException fromThrowable(Throwable cause) {
return (cause instanceof UnsupportedCycOperationException)
? (UnsupportedCycOperationException) cause
: new UnsupportedCycOperationException(cause);
} | [
"public",
"static",
"UnsupportedCycOperationException",
"fromThrowable",
"(",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"UnsupportedCycOperationException",
")",
"?",
"(",
"UnsupportedCycOperationException",
")",
"cause",
":",
"new",
"Unsupporte... | Converts a Throwable to a UnsupportedCycOperationException. If the Throwable is a
UnsupportedCycOperationException, it will be passed through unmodified; otherwise, it will be wrapped
in a new UnsupportedCycOperationException.
@param cause the Throwable to convert
@return a UnsupportedCycOperationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"UnsupportedCycOperationException",
".",
"If",
"the",
"Throwable",
"is",
"a",
"UnsupportedCycOperationException",
"it",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
... | 1d52affabc4635e3715a059e38741712cbdbf2d5 | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/UnsupportedCycOperationException.java#L44-L48 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.