id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
139,900 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/remote/jdbc/RemoteResultSetImpl.java | RemoteResultSetImpl.close | @Override
public void close() throws RemoteException {
s.close();
if (rconn.getAutoCommit())
rconn.commit();
else
rconn.endStatement();
} | java | @Override
public void close() throws RemoteException {
s.close();
if (rconn.getAutoCommit())
rconn.commit();
else
rconn.endStatement();
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"RemoteException",
"{",
"s",
".",
"close",
"(",
")",
";",
"if",
"(",
"rconn",
".",
"getAutoCommit",
"(",
")",
")",
"rconn",
".",
"commit",
"(",
")",
";",
"else",
"rconn",
".",
"endStatement",
"(",
")",
";",
"}"
] | Closes the result set by closing its scan.
@see org.vanilladb.core.remote.jdbc.RemoteResultSet#close() | [
"Closes",
"the",
"result",
"set",
"by",
"closing",
"its",
"scan",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteResultSetImpl.java#L157-L164 |
139,901 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/multibuffer/ChunkScan.java | ChunkScan.next | @Override
public boolean next() {
while (true) {
if (rp.next())
return true;
if (current == endBlkNum)
return false;
moveToBlock(current + 1);
}
} | java | @Override
public boolean next() {
while (true) {
if (rp.next())
return true;
if (current == endBlkNum)
return false;
moveToBlock(current + 1);
}
} | [
"@",
"Override",
"public",
"boolean",
"next",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"rp",
".",
"next",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"current",
"==",
"endBlkNum",
")",
"return",
"false",
";",
"moveToBlock",
"(",
"current",
"+",
"1",
")",
";",
"}",
"}"
] | Moves to the next record in the current block of the chunk. If there are
no more records, then make the next block be current. If there are no
more blocks in the chunk, return false.
@see Scan#next() | [
"Moves",
"to",
"the",
"next",
"record",
"in",
"the",
"current",
"block",
"of",
"the",
"chunk",
".",
"If",
"there",
"are",
"no",
"more",
"records",
"then",
"make",
"the",
"next",
"block",
"be",
"current",
".",
"If",
"there",
"are",
"no",
"more",
"blocks",
"in",
"the",
"chunk",
"return",
"false",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/multibuffer/ChunkScan.java#L80-L89 |
139,902 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/Type.java | Type.newInstance | public static Type newInstance(int sqlType) {
switch (sqlType) {
case (java.sql.Types.INTEGER):
return INTEGER;
case (java.sql.Types.BIGINT):
return BIGINT;
case (java.sql.Types.DOUBLE):
return DOUBLE;
case (java.sql.Types.VARCHAR):
return VARCHAR;
}
throw new UnsupportedOperationException("Unspported SQL type: "
+ sqlType);
} | java | public static Type newInstance(int sqlType) {
switch (sqlType) {
case (java.sql.Types.INTEGER):
return INTEGER;
case (java.sql.Types.BIGINT):
return BIGINT;
case (java.sql.Types.DOUBLE):
return DOUBLE;
case (java.sql.Types.VARCHAR):
return VARCHAR;
}
throw new UnsupportedOperationException("Unspported SQL type: "
+ sqlType);
} | [
"public",
"static",
"Type",
"newInstance",
"(",
"int",
"sqlType",
")",
"{",
"switch",
"(",
"sqlType",
")",
"{",
"case",
"(",
"java",
".",
"sql",
".",
"Types",
".",
"INTEGER",
")",
":",
"return",
"INTEGER",
";",
"case",
"(",
"java",
".",
"sql",
".",
"Types",
".",
"BIGINT",
")",
":",
"return",
"BIGINT",
";",
"case",
"(",
"java",
".",
"sql",
".",
"Types",
".",
"DOUBLE",
")",
":",
"return",
"DOUBLE",
";",
"case",
"(",
"java",
".",
"sql",
".",
"Types",
".",
"VARCHAR",
")",
":",
"return",
"VARCHAR",
";",
"}",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Unspported SQL type: \"",
"+",
"sqlType",
")",
";",
"}"
] | Constructs a new instance corresponding to the specified SQL type.
@param sqlType
the corresponding SQL type
@return a new instance corresponding to the specified SQL type | [
"Constructs",
"a",
"new",
"instance",
"corresponding",
"to",
"the",
"specified",
"SQL",
"type",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/Type.java#L38-L51 |
139,903 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java | BufferMgr.pin | public Buffer pin(BlockId blk) {
// Try to find out if this block has been pinned by this transaction
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount++;
return pinnedBuff.buffer;
}
// This transaction has pinned too many buffers
if (pinnedBuffers.size() == BUFFER_POOL_SIZE)
throw new BufferAbortException();
// Pinning process
try {
Buffer buff;
long timestamp = System.currentTimeMillis();
boolean waitedBeforeGotBuffer = false;
// Try to pin a buffer or the pinned buffer for the given BlockId
buff = bufferPool.pin(blk);
// If there is no such buffer or no available buffer,
// wait for it
if (buff == null) {
waitedBeforeGotBuffer = true;
synchronized (bufferPool) {
waitingThreads.add(Thread.currentThread());
while (buff == null && !waitingTooLong(timestamp)) {
bufferPool.wait(MAX_TIME);
if (waitingThreads.get(0).equals(Thread.currentThread()))
buff = bufferPool.pin(blk);
}
waitingThreads.remove(Thread.currentThread());
}
}
// If it still has no buffer after a long wait,
// release and re-pin all buffers it has
if (buff == null) {
repin();
buff = pin(blk);
} else {
pinnedBuffers.put(buff.block(), new PinnedBuffer(buff));
}
// TODO: Add some comment here
if (waitedBeforeGotBuffer) {
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
return buff;
} catch (InterruptedException e) {
throw new BufferAbortException();
}
} | java | public Buffer pin(BlockId blk) {
// Try to find out if this block has been pinned by this transaction
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount++;
return pinnedBuff.buffer;
}
// This transaction has pinned too many buffers
if (pinnedBuffers.size() == BUFFER_POOL_SIZE)
throw new BufferAbortException();
// Pinning process
try {
Buffer buff;
long timestamp = System.currentTimeMillis();
boolean waitedBeforeGotBuffer = false;
// Try to pin a buffer or the pinned buffer for the given BlockId
buff = bufferPool.pin(blk);
// If there is no such buffer or no available buffer,
// wait for it
if (buff == null) {
waitedBeforeGotBuffer = true;
synchronized (bufferPool) {
waitingThreads.add(Thread.currentThread());
while (buff == null && !waitingTooLong(timestamp)) {
bufferPool.wait(MAX_TIME);
if (waitingThreads.get(0).equals(Thread.currentThread()))
buff = bufferPool.pin(blk);
}
waitingThreads.remove(Thread.currentThread());
}
}
// If it still has no buffer after a long wait,
// release and re-pin all buffers it has
if (buff == null) {
repin();
buff = pin(blk);
} else {
pinnedBuffers.put(buff.block(), new PinnedBuffer(buff));
}
// TODO: Add some comment here
if (waitedBeforeGotBuffer) {
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
return buff;
} catch (InterruptedException e) {
throw new BufferAbortException();
}
} | [
"public",
"Buffer",
"pin",
"(",
"BlockId",
"blk",
")",
"{",
"// Try to find out if this block has been pinned by this transaction\r",
"PinnedBuffer",
"pinnedBuff",
"=",
"pinnedBuffers",
".",
"get",
"(",
"blk",
")",
";",
"if",
"(",
"pinnedBuff",
"!=",
"null",
")",
"{",
"pinnedBuff",
".",
"pinnedCount",
"++",
";",
"return",
"pinnedBuff",
".",
"buffer",
";",
"}",
"// This transaction has pinned too many buffers\r",
"if",
"(",
"pinnedBuffers",
".",
"size",
"(",
")",
"==",
"BUFFER_POOL_SIZE",
")",
"throw",
"new",
"BufferAbortException",
"(",
")",
";",
"// Pinning process\r",
"try",
"{",
"Buffer",
"buff",
";",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"waitedBeforeGotBuffer",
"=",
"false",
";",
"// Try to pin a buffer or the pinned buffer for the given BlockId\r",
"buff",
"=",
"bufferPool",
".",
"pin",
"(",
"blk",
")",
";",
"// If there is no such buffer or no available buffer,\r",
"// wait for it\r",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"waitedBeforeGotBuffer",
"=",
"true",
";",
"synchronized",
"(",
"bufferPool",
")",
"{",
"waitingThreads",
".",
"add",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"while",
"(",
"buff",
"==",
"null",
"&&",
"!",
"waitingTooLong",
"(",
"timestamp",
")",
")",
"{",
"bufferPool",
".",
"wait",
"(",
"MAX_TIME",
")",
";",
"if",
"(",
"waitingThreads",
".",
"get",
"(",
"0",
")",
".",
"equals",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
")",
"buff",
"=",
"bufferPool",
".",
"pin",
"(",
"blk",
")",
";",
"}",
"waitingThreads",
".",
"remove",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"}",
"}",
"// If it still has no buffer after a long wait,\r",
"// release and re-pin all buffers it has\r",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"repin",
"(",
")",
";",
"buff",
"=",
"pin",
"(",
"blk",
")",
";",
"}",
"else",
"{",
"pinnedBuffers",
".",
"put",
"(",
"buff",
".",
"block",
"(",
")",
",",
"new",
"PinnedBuffer",
"(",
"buff",
")",
")",
";",
"}",
"// TODO: Add some comment here\r",
"if",
"(",
"waitedBeforeGotBuffer",
")",
"{",
"synchronized",
"(",
"bufferPool",
")",
"{",
"bufferPool",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"return",
"buff",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"BufferAbortException",
"(",
")",
";",
"}",
"}"
] | Pins a buffer to the specified block, potentially waiting until a buffer
becomes available. If no buffer becomes available within a fixed time
period, then repins all currently holding blocks.
@param blk
a block ID
@return the buffer pinned to that block | [
"Pins",
"a",
"buffer",
"to",
"the",
"specified",
"block",
"potentially",
"waiting",
"until",
"a",
"buffer",
"becomes",
"available",
".",
"If",
"no",
"buffer",
"becomes",
"available",
"within",
"a",
"fixed",
"time",
"period",
"then",
"repins",
"all",
"currently",
"holding",
"blocks",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L108-L166 |
139,904 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java | BufferMgr.pinNew | public Buffer pinNew(String fileName, PageFormatter fmtr) {
if (pinnedBuffers.size() == BUFFER_POOL_SIZE)
throw new BufferAbortException();
try {
Buffer buff;
long timestamp = System.currentTimeMillis();
boolean waitedBeforeGotBuffer = false;
// Try to pin a buffer or the pinned buffer for the given BlockId
buff = bufferPool.pinNew(fileName, fmtr);
// If there is no such buffer or no available buffer,
// wait for it
if (buff == null) {
waitedBeforeGotBuffer = true;
synchronized (bufferPool) {
waitingThreads.add(Thread.currentThread());
while (buff == null && !waitingTooLong(timestamp)) {
bufferPool.wait(MAX_TIME);
if (waitingThreads.get(0).equals(Thread.currentThread()))
buff = bufferPool.pinNew(fileName, fmtr);
}
waitingThreads.remove(Thread.currentThread());
}
}
// If it still has no buffer after a long wait,
// release and re-pin all buffers it has
if (buff == null) {
repin();
buff = pinNew(fileName, fmtr);
} else {
pinnedBuffers.put(buff.block(), new PinnedBuffer(buff));
}
// TODO: Add some comment here
if (waitedBeforeGotBuffer) {
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
return buff;
} catch (InterruptedException e) {
throw new BufferAbortException();
}
} | java | public Buffer pinNew(String fileName, PageFormatter fmtr) {
if (pinnedBuffers.size() == BUFFER_POOL_SIZE)
throw new BufferAbortException();
try {
Buffer buff;
long timestamp = System.currentTimeMillis();
boolean waitedBeforeGotBuffer = false;
// Try to pin a buffer or the pinned buffer for the given BlockId
buff = bufferPool.pinNew(fileName, fmtr);
// If there is no such buffer or no available buffer,
// wait for it
if (buff == null) {
waitedBeforeGotBuffer = true;
synchronized (bufferPool) {
waitingThreads.add(Thread.currentThread());
while (buff == null && !waitingTooLong(timestamp)) {
bufferPool.wait(MAX_TIME);
if (waitingThreads.get(0).equals(Thread.currentThread()))
buff = bufferPool.pinNew(fileName, fmtr);
}
waitingThreads.remove(Thread.currentThread());
}
}
// If it still has no buffer after a long wait,
// release and re-pin all buffers it has
if (buff == null) {
repin();
buff = pinNew(fileName, fmtr);
} else {
pinnedBuffers.put(buff.block(), new PinnedBuffer(buff));
}
// TODO: Add some comment here
if (waitedBeforeGotBuffer) {
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
return buff;
} catch (InterruptedException e) {
throw new BufferAbortException();
}
} | [
"public",
"Buffer",
"pinNew",
"(",
"String",
"fileName",
",",
"PageFormatter",
"fmtr",
")",
"{",
"if",
"(",
"pinnedBuffers",
".",
"size",
"(",
")",
"==",
"BUFFER_POOL_SIZE",
")",
"throw",
"new",
"BufferAbortException",
"(",
")",
";",
"try",
"{",
"Buffer",
"buff",
";",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"waitedBeforeGotBuffer",
"=",
"false",
";",
"// Try to pin a buffer or the pinned buffer for the given BlockId\r",
"buff",
"=",
"bufferPool",
".",
"pinNew",
"(",
"fileName",
",",
"fmtr",
")",
";",
"// If there is no such buffer or no available buffer,\r",
"// wait for it\r",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"waitedBeforeGotBuffer",
"=",
"true",
";",
"synchronized",
"(",
"bufferPool",
")",
"{",
"waitingThreads",
".",
"add",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"while",
"(",
"buff",
"==",
"null",
"&&",
"!",
"waitingTooLong",
"(",
"timestamp",
")",
")",
"{",
"bufferPool",
".",
"wait",
"(",
"MAX_TIME",
")",
";",
"if",
"(",
"waitingThreads",
".",
"get",
"(",
"0",
")",
".",
"equals",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
")",
"buff",
"=",
"bufferPool",
".",
"pinNew",
"(",
"fileName",
",",
"fmtr",
")",
";",
"}",
"waitingThreads",
".",
"remove",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"}",
"}",
"// If it still has no buffer after a long wait,\r",
"// release and re-pin all buffers it has\r",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"repin",
"(",
")",
";",
"buff",
"=",
"pinNew",
"(",
"fileName",
",",
"fmtr",
")",
";",
"}",
"else",
"{",
"pinnedBuffers",
".",
"put",
"(",
"buff",
".",
"block",
"(",
")",
",",
"new",
"PinnedBuffer",
"(",
"buff",
")",
")",
";",
"}",
"// TODO: Add some comment here\r",
"if",
"(",
"waitedBeforeGotBuffer",
")",
"{",
"synchronized",
"(",
"bufferPool",
")",
"{",
"bufferPool",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"return",
"buff",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"BufferAbortException",
"(",
")",
";",
"}",
"}"
] | Pins a buffer to a new block in the specified file, potentially waiting
until a buffer becomes available. If no buffer becomes available within a
fixed time period, then repins all currently holding blocks.
@param fileName
the name of the file
@param fmtr
the formatter used to initialize the page
@return the buffer pinned to that block | [
"Pins",
"a",
"buffer",
"to",
"a",
"new",
"block",
"in",
"the",
"specified",
"file",
"potentially",
"waiting",
"until",
"a",
"buffer",
"becomes",
"available",
".",
"If",
"no",
"buffer",
"becomes",
"available",
"within",
"a",
"fixed",
"time",
"period",
"then",
"repins",
"all",
"currently",
"holding",
"blocks",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L179-L228 |
139,905 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java | BufferMgr.unpin | public void unpin(Buffer buff) {
BlockId blk = buff.block();
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount--;
if (pinnedBuff.pinnedCount == 0) {
bufferPool.unpin(buff);
pinnedBuffers.remove(blk);
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
}
} | java | public void unpin(Buffer buff) {
BlockId blk = buff.block();
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount--;
if (pinnedBuff.pinnedCount == 0) {
bufferPool.unpin(buff);
pinnedBuffers.remove(blk);
synchronized (bufferPool) {
bufferPool.notifyAll();
}
}
}
} | [
"public",
"void",
"unpin",
"(",
"Buffer",
"buff",
")",
"{",
"BlockId",
"blk",
"=",
"buff",
".",
"block",
"(",
")",
";",
"PinnedBuffer",
"pinnedBuff",
"=",
"pinnedBuffers",
".",
"get",
"(",
"blk",
")",
";",
"if",
"(",
"pinnedBuff",
"!=",
"null",
")",
"{",
"pinnedBuff",
".",
"pinnedCount",
"--",
";",
"if",
"(",
"pinnedBuff",
".",
"pinnedCount",
"==",
"0",
")",
"{",
"bufferPool",
".",
"unpin",
"(",
"buff",
")",
";",
"pinnedBuffers",
".",
"remove",
"(",
"blk",
")",
";",
"synchronized",
"(",
"bufferPool",
")",
"{",
"bufferPool",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Unpins the specified buffer. If the buffer's pin count becomes 0, then
the threads on the wait list are notified.
@param buff
the buffer to be unpinned | [
"Unpins",
"the",
"specified",
"buffer",
".",
"If",
"the",
"buffer",
"s",
"pin",
"count",
"becomes",
"0",
"then",
"the",
"threads",
"on",
"the",
"wait",
"list",
"are",
"notified",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L237-L253 |
139,906 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java | BufferMgr.repin | private void repin() {
if (logger.isLoggable(Level.WARNING))
logger.warning("Tx." + txNum + " is re-pinning all buffers");
try {
// Copy the set of pinned buffers to avoid ConcurrentModificationException
List<BlockId> blksToBeRepinned = new LinkedList<BlockId>();
Map<BlockId, Integer> pinCounts = new HashMap<BlockId, Integer>();
List<Buffer> buffersToBeUnpinned = new LinkedList<Buffer>();
// Record the buffers to be un-pinned and the blocks to be re-pinned
for (Entry<BlockId, PinnedBuffer> entry : pinnedBuffers.entrySet()) {
blksToBeRepinned.add(entry.getKey());
pinCounts.put(entry.getKey(), entry.getValue().pinnedCount);
buffersToBeUnpinned.add(entry.getValue().buffer);
}
// Un-pin all buffers it has
for (Buffer buf : buffersToBeUnpinned)
unpin(buf);
// Wait other threads pinning blocks
synchronized (bufferPool) {
bufferPool.wait(MAX_TIME);
}
// Re-pin all blocks
for (BlockId blk : blksToBeRepinned)
pin(blk);
} catch (InterruptedException e) {
e.printStackTrace();
}
} | java | private void repin() {
if (logger.isLoggable(Level.WARNING))
logger.warning("Tx." + txNum + " is re-pinning all buffers");
try {
// Copy the set of pinned buffers to avoid ConcurrentModificationException
List<BlockId> blksToBeRepinned = new LinkedList<BlockId>();
Map<BlockId, Integer> pinCounts = new HashMap<BlockId, Integer>();
List<Buffer> buffersToBeUnpinned = new LinkedList<Buffer>();
// Record the buffers to be un-pinned and the blocks to be re-pinned
for (Entry<BlockId, PinnedBuffer> entry : pinnedBuffers.entrySet()) {
blksToBeRepinned.add(entry.getKey());
pinCounts.put(entry.getKey(), entry.getValue().pinnedCount);
buffersToBeUnpinned.add(entry.getValue().buffer);
}
// Un-pin all buffers it has
for (Buffer buf : buffersToBeUnpinned)
unpin(buf);
// Wait other threads pinning blocks
synchronized (bufferPool) {
bufferPool.wait(MAX_TIME);
}
// Re-pin all blocks
for (BlockId blk : blksToBeRepinned)
pin(blk);
} catch (InterruptedException e) {
e.printStackTrace();
}
} | [
"private",
"void",
"repin",
"(",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"WARNING",
")",
")",
"logger",
".",
"warning",
"(",
"\"Tx.\"",
"+",
"txNum",
"+",
"\" is re-pinning all buffers\"",
")",
";",
"try",
"{",
"// Copy the set of pinned buffers to avoid ConcurrentModificationException\r",
"List",
"<",
"BlockId",
">",
"blksToBeRepinned",
"=",
"new",
"LinkedList",
"<",
"BlockId",
">",
"(",
")",
";",
"Map",
"<",
"BlockId",
",",
"Integer",
">",
"pinCounts",
"=",
"new",
"HashMap",
"<",
"BlockId",
",",
"Integer",
">",
"(",
")",
";",
"List",
"<",
"Buffer",
">",
"buffersToBeUnpinned",
"=",
"new",
"LinkedList",
"<",
"Buffer",
">",
"(",
")",
";",
"// Record the buffers to be un-pinned and the blocks to be re-pinned\r",
"for",
"(",
"Entry",
"<",
"BlockId",
",",
"PinnedBuffer",
">",
"entry",
":",
"pinnedBuffers",
".",
"entrySet",
"(",
")",
")",
"{",
"blksToBeRepinned",
".",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"pinCounts",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
".",
"pinnedCount",
")",
";",
"buffersToBeUnpinned",
".",
"add",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"buffer",
")",
";",
"}",
"// Un-pin all buffers it has\r",
"for",
"(",
"Buffer",
"buf",
":",
"buffersToBeUnpinned",
")",
"unpin",
"(",
"buf",
")",
";",
"// Wait other threads pinning blocks\r",
"synchronized",
"(",
"bufferPool",
")",
"{",
"bufferPool",
".",
"wait",
"(",
"MAX_TIME",
")",
";",
"}",
"// Re-pin all blocks\r",
"for",
"(",
"BlockId",
"blk",
":",
"blksToBeRepinned",
")",
"pin",
"(",
"blk",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Unpins all currently pinned buffers of the calling transaction and repins
them. | [
"Unpins",
"all",
"currently",
"pinned",
"buffers",
"of",
"the",
"calling",
"transaction",
"and",
"repins",
"them",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L298-L330 |
139,907 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.offsetMap | public static Map<String, Integer> offsetMap(Schema sch) {
int pos = 0;
Map<String, Integer> offsetMap = new HashMap<String, Integer>();
for (String fldname : sch.fields()) {
offsetMap.put(fldname, pos);
pos += Page.maxSize(sch.type(fldname));
}
return offsetMap;
} | java | public static Map<String, Integer> offsetMap(Schema sch) {
int pos = 0;
Map<String, Integer> offsetMap = new HashMap<String, Integer>();
for (String fldname : sch.fields()) {
offsetMap.put(fldname, pos);
pos += Page.maxSize(sch.type(fldname));
}
return offsetMap;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"offsetMap",
"(",
"Schema",
"sch",
")",
"{",
"int",
"pos",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"Integer",
">",
"offsetMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"String",
"fldname",
":",
"sch",
".",
"fields",
"(",
")",
")",
"{",
"offsetMap",
".",
"put",
"(",
"fldname",
",",
"pos",
")",
";",
"pos",
"+=",
"Page",
".",
"maxSize",
"(",
"sch",
".",
"type",
"(",
"fldname",
")",
")",
";",
"}",
"return",
"offsetMap",
";",
"}"
] | Returns the map of field name to offset of a specified schema.
@param sch
the table's schema
@return the offset map | [
"Returns",
"the",
"map",
"of",
"field",
"name",
"to",
"offset",
"of",
"a",
"specified",
"schema",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L90-L98 |
139,908 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.recordSize | public static int recordSize(Schema sch) {
int pos = 0;
for (String fldname : sch.fields())
pos += Page.maxSize(sch.type(fldname));
return pos < MIN_REC_SIZE ? MIN_REC_SIZE : pos;
} | java | public static int recordSize(Schema sch) {
int pos = 0;
for (String fldname : sch.fields())
pos += Page.maxSize(sch.type(fldname));
return pos < MIN_REC_SIZE ? MIN_REC_SIZE : pos;
} | [
"public",
"static",
"int",
"recordSize",
"(",
"Schema",
"sch",
")",
"{",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"String",
"fldname",
":",
"sch",
".",
"fields",
"(",
")",
")",
"pos",
"+=",
"Page",
".",
"maxSize",
"(",
"sch",
".",
"type",
"(",
"fldname",
")",
")",
";",
"return",
"pos",
"<",
"MIN_REC_SIZE",
"?",
"MIN_REC_SIZE",
":",
"pos",
";",
"}"
] | Returns the number of bytes required to store a record with the specified
schema in disk.
@param sch
the table's schema
@return the size of a record, in bytes | [
"Returns",
"the",
"number",
"of",
"bytes",
"required",
"to",
"store",
"a",
"record",
"with",
"the",
"specified",
"schema",
"in",
"disk",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L108-L113 |
139,909 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.getVal | public Constant getVal(String fldName) {
int position = fieldPos(fldName);
return getVal(position, ti.schema().type(fldName));
} | java | public Constant getVal(String fldName) {
int position = fieldPos(fldName);
return getVal(position, ti.schema().type(fldName));
} | [
"public",
"Constant",
"getVal",
"(",
"String",
"fldName",
")",
"{",
"int",
"position",
"=",
"fieldPos",
"(",
"fldName",
")",
";",
"return",
"getVal",
"(",
"position",
",",
"ti",
".",
"schema",
"(",
")",
".",
"type",
"(",
"fldName",
")",
")",
";",
"}"
] | Returns the value stored in the specified field of this record.
@param fldName
the name of the field.
@return the constant stored in that field | [
"Returns",
"the",
"value",
"stored",
"in",
"the",
"specified",
"field",
"of",
"this",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L187-L190 |
139,910 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.setVal | public void setVal(String fldName, Constant val) {
int position = fieldPos(fldName);
setVal(position, val);
} | java | public void setVal(String fldName, Constant val) {
int position = fieldPos(fldName);
setVal(position, val);
} | [
"public",
"void",
"setVal",
"(",
"String",
"fldName",
",",
"Constant",
"val",
")",
"{",
"int",
"position",
"=",
"fieldPos",
"(",
"fldName",
")",
";",
"setVal",
"(",
"position",
",",
"val",
")",
";",
"}"
] | Stores a value at the specified field of this record.
@param fldName
the name of the field
@param val
the constant value stored in that field | [
"Stores",
"a",
"value",
"at",
"the",
"specified",
"field",
"of",
"this",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L200-L203 |
139,911 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.delete | public void delete(RecordId nextDeletedSlot) {
Constant flag = EMPTY_CONST;
setVal(currentPos(), flag);
setNextDeletedSlotId(nextDeletedSlot);
} | java | public void delete(RecordId nextDeletedSlot) {
Constant flag = EMPTY_CONST;
setVal(currentPos(), flag);
setNextDeletedSlotId(nextDeletedSlot);
} | [
"public",
"void",
"delete",
"(",
"RecordId",
"nextDeletedSlot",
")",
"{",
"Constant",
"flag",
"=",
"EMPTY_CONST",
";",
"setVal",
"(",
"currentPos",
"(",
")",
",",
"flag",
")",
";",
"setNextDeletedSlotId",
"(",
"nextDeletedSlot",
")",
";",
"}"
] | Deletes the current record. Deletion is performed by marking the record
as "deleted" and setting the content as a pointer points to next deleted
slot.
@param nextDeletedSlot
the record is of next deleted slot | [
"Deletes",
"the",
"current",
"record",
".",
"Deletion",
"is",
"performed",
"by",
"marking",
"the",
"record",
"as",
"deleted",
"and",
"setting",
"the",
"content",
"as",
"a",
"pointer",
"points",
"to",
"next",
"deleted",
"slot",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L214-L218 |
139,912 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.insertIntoTheCurrentSlot | public boolean insertIntoTheCurrentSlot() {
if (!getVal(currentPos(), INTEGER).equals(EMPTY_CONST))
return false;
setVal(currentPos(), INUSE_CONST);
return true;
} | java | public boolean insertIntoTheCurrentSlot() {
if (!getVal(currentPos(), INTEGER).equals(EMPTY_CONST))
return false;
setVal(currentPos(), INUSE_CONST);
return true;
} | [
"public",
"boolean",
"insertIntoTheCurrentSlot",
"(",
")",
"{",
"if",
"(",
"!",
"getVal",
"(",
"currentPos",
"(",
")",
",",
"INTEGER",
")",
".",
"equals",
"(",
"EMPTY_CONST",
")",
")",
"return",
"false",
";",
"setVal",
"(",
"currentPos",
"(",
")",
",",
"INUSE_CONST",
")",
";",
"return",
"true",
";",
"}"
] | Marks the current slot as in-used.
@return true, if it succeed. If the slot has been occupied, return false. | [
"Marks",
"the",
"current",
"slot",
"as",
"in",
"-",
"used",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L225-L231 |
139,913 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.insertIntoNextEmptySlot | public boolean insertIntoNextEmptySlot() {
boolean found = searchFor(EMPTY);
if (found) {
Constant flag = INUSE_CONST;
setVal(currentPos(), flag);
}
return found;
} | java | public boolean insertIntoNextEmptySlot() {
boolean found = searchFor(EMPTY);
if (found) {
Constant flag = INUSE_CONST;
setVal(currentPos(), flag);
}
return found;
} | [
"public",
"boolean",
"insertIntoNextEmptySlot",
"(",
")",
"{",
"boolean",
"found",
"=",
"searchFor",
"(",
"EMPTY",
")",
";",
"if",
"(",
"found",
")",
"{",
"Constant",
"flag",
"=",
"INUSE_CONST",
";",
"setVal",
"(",
"currentPos",
"(",
")",
",",
"flag",
")",
";",
"}",
"return",
"found",
";",
"}"
] | Inserts a new, blank record somewhere in the page. Return false if there
were no available slots.
@return false if the insertion was not possible | [
"Inserts",
"a",
"new",
"blank",
"record",
"somewhere",
"in",
"the",
"page",
".",
"Return",
"false",
"if",
"there",
"were",
"no",
"available",
"slots",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L239-L246 |
139,914 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.insertIntoDeletedSlot | public RecordId insertIntoDeletedSlot() {
RecordId nds = getNextDeletedSlotId();
// Important: Erase the free chain information.
// If we didn't do this, it would crash when
// a tx try to set a VARCHAR at this position
// since the getVal would get negative size.
setNextDeletedSlotId(new RecordId(new BlockId("", 0), 0));
Constant flag = INUSE_CONST;
setVal(currentPos(), flag);
return nds;
} | java | public RecordId insertIntoDeletedSlot() {
RecordId nds = getNextDeletedSlotId();
// Important: Erase the free chain information.
// If we didn't do this, it would crash when
// a tx try to set a VARCHAR at this position
// since the getVal would get negative size.
setNextDeletedSlotId(new RecordId(new BlockId("", 0), 0));
Constant flag = INUSE_CONST;
setVal(currentPos(), flag);
return nds;
} | [
"public",
"RecordId",
"insertIntoDeletedSlot",
"(",
")",
"{",
"RecordId",
"nds",
"=",
"getNextDeletedSlotId",
"(",
")",
";",
"// Important: Erase the free chain information.\r",
"// If we didn't do this, it would crash when\r",
"// a tx try to set a VARCHAR at this position\r",
"// since the getVal would get negative size.\r",
"setNextDeletedSlotId",
"(",
"new",
"RecordId",
"(",
"new",
"BlockId",
"(",
"\"\"",
",",
"0",
")",
",",
"0",
")",
")",
";",
"Constant",
"flag",
"=",
"INUSE_CONST",
";",
"setVal",
"(",
"currentPos",
"(",
")",
",",
"flag",
")",
";",
"return",
"nds",
";",
"}"
] | Inserts a new, blank record into this deleted slot and return the record
id of the next one.
@return the record id of the next deleted slot | [
"Inserts",
"a",
"new",
"blank",
"record",
"into",
"this",
"deleted",
"slot",
"and",
"return",
"the",
"record",
"id",
"of",
"the",
"next",
"one",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L254-L264 |
139,915 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordPage.java | RecordPage.runAllSlot | public void runAllSlot() {
moveToId(0);
System.out.println("== runAllSlot start at " + currentSlot + " ==");
while (isValidSlot()) {
if (currentSlot % 10 == 0)
System.out.print(currentSlot + ": ");
int flag = (Integer) getVal(currentPos(), INTEGER).asJavaVal();
System.out.print(flag + " ");
if ((currentSlot + 1) % 10 == 0)
System.out.println();
currentSlot++;
}
System.out.println("== runAllSlot end at " + currentSlot + " ==");
} | java | public void runAllSlot() {
moveToId(0);
System.out.println("== runAllSlot start at " + currentSlot + " ==");
while (isValidSlot()) {
if (currentSlot % 10 == 0)
System.out.print(currentSlot + ": ");
int flag = (Integer) getVal(currentPos(), INTEGER).asJavaVal();
System.out.print(flag + " ");
if ((currentSlot + 1) % 10 == 0)
System.out.println();
currentSlot++;
}
System.out.println("== runAllSlot end at " + currentSlot + " ==");
} | [
"public",
"void",
"runAllSlot",
"(",
")",
"{",
"moveToId",
"(",
"0",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"== runAllSlot start at \"",
"+",
"currentSlot",
"+",
"\" ==\"",
")",
";",
"while",
"(",
"isValidSlot",
"(",
")",
")",
"{",
"if",
"(",
"currentSlot",
"%",
"10",
"==",
"0",
")",
"System",
".",
"out",
".",
"print",
"(",
"currentSlot",
"+",
"\": \"",
")",
";",
"int",
"flag",
"=",
"(",
"Integer",
")",
"getVal",
"(",
"currentPos",
"(",
")",
",",
"INTEGER",
")",
".",
"asJavaVal",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"flag",
"+",
"\" \"",
")",
";",
"if",
"(",
"(",
"currentSlot",
"+",
"1",
")",
"%",
"10",
"==",
"0",
")",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"currentSlot",
"++",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"== runAllSlot end at \"",
"+",
"currentSlot",
"+",
"\" ==\"",
")",
";",
"}"
] | Print all Slot IN_USE or EMPTY, for debugging | [
"Print",
"all",
"Slot",
"IN_USE",
"or",
"EMPTY",
"for",
"debugging"
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L297-L310 |
139,916 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.startCollecting | public synchronized void startCollecting() {
paused = false;
if (thread != null)
return;
packages = new CountMap<String>(MAX_PACKAGES);
selfMethods = new CountMap<String>(MAX_METHODS);
stackMethods = new CountMap<String>(MAX_METHODS);
lines = new CountMap<String>(MAX_LINES);
total = 0;
started = true;
thread = new Thread(this);
thread.setName("Profiler");
thread.setDaemon(true);
thread.start();
} | java | public synchronized void startCollecting() {
paused = false;
if (thread != null)
return;
packages = new CountMap<String>(MAX_PACKAGES);
selfMethods = new CountMap<String>(MAX_METHODS);
stackMethods = new CountMap<String>(MAX_METHODS);
lines = new CountMap<String>(MAX_LINES);
total = 0;
started = true;
thread = new Thread(this);
thread.setName("Profiler");
thread.setDaemon(true);
thread.start();
} | [
"public",
"synchronized",
"void",
"startCollecting",
"(",
")",
"{",
"paused",
"=",
"false",
";",
"if",
"(",
"thread",
"!=",
"null",
")",
"return",
";",
"packages",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"MAX_PACKAGES",
")",
";",
"selfMethods",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"MAX_METHODS",
")",
";",
"stackMethods",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"MAX_METHODS",
")",
";",
"lines",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"MAX_LINES",
")",
";",
"total",
"=",
"0",
";",
"started",
"=",
"true",
";",
"thread",
"=",
"new",
"Thread",
"(",
"this",
")",
";",
"thread",
".",
"setName",
"(",
"\"Profiler\"",
")",
";",
"thread",
".",
"setDaemon",
"(",
"true",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"}"
] | Start collecting profiling data. | [
"Start",
"collecting",
"profiling",
"data",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L81-L97 |
139,917 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.stopCollecting | public synchronized void stopCollecting() {
started = false;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
// ignore
}
thread = null;
}
} | java | public synchronized void stopCollecting() {
started = false;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
// ignore
}
thread = null;
}
} | [
"public",
"synchronized",
"void",
"stopCollecting",
"(",
")",
"{",
"started",
"=",
"false",
";",
"if",
"(",
"thread",
"!=",
"null",
")",
"{",
"try",
"{",
"thread",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// ignore\r",
"}",
"thread",
"=",
"null",
";",
"}",
"}"
] | Stop collecting. | [
"Stop",
"collecting",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L102-L112 |
139,918 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.getPackageCsv | public String getPackageCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Package,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(packages.keySet())) {
int percent = 100 * packages.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(percent).append(LINE_SEPARATOR);
}
return buff.toString();
} | java | public String getPackageCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Package,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(packages.keySet())) {
int percent = 100 * packages.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(percent).append(LINE_SEPARATOR);
}
return buff.toString();
} | [
"public",
"String",
"getPackageCsv",
"(",
")",
"{",
"stopCollecting",
"(",
")",
";",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buff",
".",
"append",
"(",
"\"Package,Self\"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"for",
"(",
"String",
"k",
":",
"new",
"TreeSet",
"<",
"String",
">",
"(",
"packages",
".",
"keySet",
"(",
")",
")",
")",
"{",
"int",
"percent",
"=",
"100",
"*",
"packages",
".",
"get",
"(",
"k",
")",
"/",
"Math",
".",
"max",
"(",
"total",
",",
"1",
")",
";",
"buff",
".",
"append",
"(",
"k",
")",
".",
"append",
"(",
"\",\"",
")",
".",
"append",
"(",
"percent",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"}",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}"
] | Stop and obtain the self execution time of packages, each as a row in CSV
format.
@return the execution time of packages in CSV format | [
"Stop",
"and",
"obtain",
"the",
"self",
"execution",
"time",
"of",
"packages",
"each",
"as",
"a",
"row",
"in",
"CSV",
"format",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L291-L300 |
139,919 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.getTopMethods | public String getTopMethods(int num) {
stopCollecting();
CountMap<String> selfms = new CountMap<String>(selfMethods);
CountMap<String> stackms = new CountMap<String>(stackMethods);
StringBuilder buff = new StringBuilder();
buff.append("Top methods over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
.append(total).append(" counts:").append(LINE_SEPARATOR);
buff.append("Rank\tSelf\tStack\tMethod").append(LINE_SEPARATOR);
for (int i = 0, n = 0; selfms.size() > 0 && n < num; i++) {
int highest = 0;
List<Map.Entry<String, Integer>> bests = new ArrayList<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> el : selfms.entrySet()) {
if (el.getValue() > highest) {
bests.clear();
bests.add(el);
highest = el.getValue();
} else if (el.getValue() == highest) {
bests.add(el);
}
}
for (Map.Entry<String, Integer> e : bests) {
selfms.remove(e.getKey());
int selfPercent = 100 * highest / Math.max(total, 1);
int stackPercent = 100 * stackms.remove(e.getKey()) / Math.max(total, 1);
buff.append(i + 1).append("\t").append(selfPercent).append("%\t").append(stackPercent).append("%\t")
.append(e.getKey()).append(LINE_SEPARATOR);
n++;
}
}
return buff.toString();
} | java | public String getTopMethods(int num) {
stopCollecting();
CountMap<String> selfms = new CountMap<String>(selfMethods);
CountMap<String> stackms = new CountMap<String>(stackMethods);
StringBuilder buff = new StringBuilder();
buff.append("Top methods over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
.append(total).append(" counts:").append(LINE_SEPARATOR);
buff.append("Rank\tSelf\tStack\tMethod").append(LINE_SEPARATOR);
for (int i = 0, n = 0; selfms.size() > 0 && n < num; i++) {
int highest = 0;
List<Map.Entry<String, Integer>> bests = new ArrayList<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> el : selfms.entrySet()) {
if (el.getValue() > highest) {
bests.clear();
bests.add(el);
highest = el.getValue();
} else if (el.getValue() == highest) {
bests.add(el);
}
}
for (Map.Entry<String, Integer> e : bests) {
selfms.remove(e.getKey());
int selfPercent = 100 * highest / Math.max(total, 1);
int stackPercent = 100 * stackms.remove(e.getKey()) / Math.max(total, 1);
buff.append(i + 1).append("\t").append(selfPercent).append("%\t").append(stackPercent).append("%\t")
.append(e.getKey()).append(LINE_SEPARATOR);
n++;
}
}
return buff.toString();
} | [
"public",
"String",
"getTopMethods",
"(",
"int",
"num",
")",
"{",
"stopCollecting",
"(",
")",
";",
"CountMap",
"<",
"String",
">",
"selfms",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"selfMethods",
")",
";",
"CountMap",
"<",
"String",
">",
"stackms",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"stackMethods",
")",
";",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buff",
".",
"append",
"(",
"\"Top methods over \"",
")",
".",
"append",
"(",
"time",
")",
".",
"append",
"(",
"\" ms (\"",
")",
".",
"append",
"(",
"pauseTime",
")",
".",
"append",
"(",
"\" ms paused), with \"",
")",
".",
"append",
"(",
"total",
")",
".",
"append",
"(",
"\" counts:\"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"buff",
".",
"append",
"(",
"\"Rank\\tSelf\\tStack\\tMethod\"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"0",
";",
"selfms",
".",
"size",
"(",
")",
">",
"0",
"&&",
"n",
"<",
"num",
";",
"i",
"++",
")",
"{",
"int",
"highest",
"=",
"0",
";",
"List",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"bests",
"=",
"new",
"ArrayList",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"el",
":",
"selfms",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"el",
".",
"getValue",
"(",
")",
">",
"highest",
")",
"{",
"bests",
".",
"clear",
"(",
")",
";",
"bests",
".",
"add",
"(",
"el",
")",
";",
"highest",
"=",
"el",
".",
"getValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"el",
".",
"getValue",
"(",
")",
"==",
"highest",
")",
"{",
"bests",
".",
"add",
"(",
"el",
")",
";",
"}",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"e",
":",
"bests",
")",
"{",
"selfms",
".",
"remove",
"(",
"e",
".",
"getKey",
"(",
")",
")",
";",
"int",
"selfPercent",
"=",
"100",
"*",
"highest",
"/",
"Math",
".",
"max",
"(",
"total",
",",
"1",
")",
";",
"int",
"stackPercent",
"=",
"100",
"*",
"stackms",
".",
"remove",
"(",
"e",
".",
"getKey",
"(",
")",
")",
"/",
"Math",
".",
"max",
"(",
"total",
",",
"1",
")",
";",
"buff",
".",
"append",
"(",
"i",
"+",
"1",
")",
".",
"append",
"(",
"\"\\t\"",
")",
".",
"append",
"(",
"selfPercent",
")",
".",
"append",
"(",
"\"%\\t\"",
")",
".",
"append",
"(",
"stackPercent",
")",
".",
"append",
"(",
"\"%\\t\"",
")",
".",
"append",
"(",
"e",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"n",
"++",
";",
"}",
"}",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}"
] | Stop and obtain the top methods, ordered by their self execution time.
@param num
number of top methods
@return the top methods | [
"Stop",
"and",
"obtain",
"the",
"top",
"methods",
"ordered",
"by",
"their",
"self",
"execution",
"time",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L310-L340 |
139,920 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.getMethodCsv | public String getMethodCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Method,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(selfMethods.keySet())) {
int percent = 100 * selfMethods.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(percent).append(LINE_SEPARATOR);
}
return buff.toString();
} | java | public String getMethodCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Method,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(selfMethods.keySet())) {
int percent = 100 * selfMethods.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(percent).append(LINE_SEPARATOR);
}
return buff.toString();
} | [
"public",
"String",
"getMethodCsv",
"(",
")",
"{",
"stopCollecting",
"(",
")",
";",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buff",
".",
"append",
"(",
"\"Method,Self\"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"for",
"(",
"String",
"k",
":",
"new",
"TreeSet",
"<",
"String",
">",
"(",
"selfMethods",
".",
"keySet",
"(",
")",
")",
")",
"{",
"int",
"percent",
"=",
"100",
"*",
"selfMethods",
".",
"get",
"(",
"k",
")",
"/",
"Math",
".",
"max",
"(",
"total",
",",
"1",
")",
";",
"buff",
".",
"append",
"(",
"k",
")",
".",
"append",
"(",
"\",\"",
")",
".",
"append",
"(",
"percent",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"}",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}"
] | Stop and obtain the self execution time of methods, each as a row in CSV
format.
@return the execution time of methods in CSV format | [
"Stop",
"and",
"obtain",
"the",
"self",
"execution",
"time",
"of",
"methods",
"each",
"as",
"a",
"row",
"in",
"CSV",
"format",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L348-L357 |
139,921 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/util/Profiler.java | Profiler.getTopLines | public String getTopLines(int num) {
stopCollecting();
CountMap<String> ls = new CountMap<String>(lines);
StringBuilder buff = new StringBuilder();
buff.append("Top lines over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
.append(total).append(" counts:").append(LINE_SEPARATOR);
for (int i = 0, n = 0; ls.size() > 0 && n < num; i++) {
int highest = 0;
List<Map.Entry<String, Integer>> bests = new ArrayList<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> el : ls.entrySet()) {
if (el.getValue() > highest) {
bests.clear();
bests.add(el);
highest = el.getValue();
} else if (el.getValue() == highest) {
bests.add(el);
}
}
for (Map.Entry<String, Integer> e : bests) {
ls.remove(e.getKey());
int percent = 100 * highest / Math.max(total, 1);
buff.append("Rank: ").append(i + 1).append(", Self: ").append(percent).append("%, Trace: ")
.append(LINE_SEPARATOR).append(e.getKey()).append(LINE_SEPARATOR);
n++;
}
}
return buff.toString();
} | java | public String getTopLines(int num) {
stopCollecting();
CountMap<String> ls = new CountMap<String>(lines);
StringBuilder buff = new StringBuilder();
buff.append("Top lines over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
.append(total).append(" counts:").append(LINE_SEPARATOR);
for (int i = 0, n = 0; ls.size() > 0 && n < num; i++) {
int highest = 0;
List<Map.Entry<String, Integer>> bests = new ArrayList<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> el : ls.entrySet()) {
if (el.getValue() > highest) {
bests.clear();
bests.add(el);
highest = el.getValue();
} else if (el.getValue() == highest) {
bests.add(el);
}
}
for (Map.Entry<String, Integer> e : bests) {
ls.remove(e.getKey());
int percent = 100 * highest / Math.max(total, 1);
buff.append("Rank: ").append(i + 1).append(", Self: ").append(percent).append("%, Trace: ")
.append(LINE_SEPARATOR).append(e.getKey()).append(LINE_SEPARATOR);
n++;
}
}
return buff.toString();
} | [
"public",
"String",
"getTopLines",
"(",
"int",
"num",
")",
"{",
"stopCollecting",
"(",
")",
";",
"CountMap",
"<",
"String",
">",
"ls",
"=",
"new",
"CountMap",
"<",
"String",
">",
"(",
"lines",
")",
";",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buff",
".",
"append",
"(",
"\"Top lines over \"",
")",
".",
"append",
"(",
"time",
")",
".",
"append",
"(",
"\" ms (\"",
")",
".",
"append",
"(",
"pauseTime",
")",
".",
"append",
"(",
"\" ms paused), with \"",
")",
".",
"append",
"(",
"total",
")",
".",
"append",
"(",
"\" counts:\"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"0",
";",
"ls",
".",
"size",
"(",
")",
">",
"0",
"&&",
"n",
"<",
"num",
";",
"i",
"++",
")",
"{",
"int",
"highest",
"=",
"0",
";",
"List",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"bests",
"=",
"new",
"ArrayList",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"el",
":",
"ls",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"el",
".",
"getValue",
"(",
")",
">",
"highest",
")",
"{",
"bests",
".",
"clear",
"(",
")",
";",
"bests",
".",
"add",
"(",
"el",
")",
";",
"highest",
"=",
"el",
".",
"getValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"el",
".",
"getValue",
"(",
")",
"==",
"highest",
")",
"{",
"bests",
".",
"add",
"(",
"el",
")",
";",
"}",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"e",
":",
"bests",
")",
"{",
"ls",
".",
"remove",
"(",
"e",
".",
"getKey",
"(",
")",
")",
";",
"int",
"percent",
"=",
"100",
"*",
"highest",
"/",
"Math",
".",
"max",
"(",
"total",
",",
"1",
")",
";",
"buff",
".",
"append",
"(",
"\"Rank: \"",
")",
".",
"append",
"(",
"i",
"+",
"1",
")",
".",
"append",
"(",
"\", Self: \"",
")",
".",
"append",
"(",
"percent",
")",
".",
"append",
"(",
"\"%, Trace: \"",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
".",
"append",
"(",
"e",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"LINE_SEPARATOR",
")",
";",
"n",
"++",
";",
"}",
"}",
"return",
"buff",
".",
"toString",
"(",
")",
";",
"}"
] | Stop and obtain the top lines, ordered by their execution time.
@param num
number of top lines
@return the top lines | [
"Stop",
"and",
"obtain",
"the",
"top",
"lines",
"ordered",
"by",
"their",
"execution",
"time",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L367-L394 |
139,922 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java | IndexMgr.createIndex | public void createIndex(String idxName, String tblName, List<String> fldNames,
IndexType idxType, Transaction tx) {
// Add the index infos to the index catalog
RecordFile rf = idxTi.open(tx, true);
rf.insert();
rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName));
rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName));
rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger()));
rf.close();
// Add the field names to the key catalog
rf = keyTi.open(tx, true);
for (String fldName : fldNames) {
rf.insert();
rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName));
rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName));
rf.close();
}
updateCache(new IndexInfo(idxName, tblName, fldNames, idxType));
} | java | public void createIndex(String idxName, String tblName, List<String> fldNames,
IndexType idxType, Transaction tx) {
// Add the index infos to the index catalog
RecordFile rf = idxTi.open(tx, true);
rf.insert();
rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName));
rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName));
rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger()));
rf.close();
// Add the field names to the key catalog
rf = keyTi.open(tx, true);
for (String fldName : fldNames) {
rf.insert();
rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName));
rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName));
rf.close();
}
updateCache(new IndexInfo(idxName, tblName, fldNames, idxType));
} | [
"public",
"void",
"createIndex",
"(",
"String",
"idxName",
",",
"String",
"tblName",
",",
"List",
"<",
"String",
">",
"fldNames",
",",
"IndexType",
"idxType",
",",
"Transaction",
"tx",
")",
"{",
"// Add the index infos to the index catalog\r",
"RecordFile",
"rf",
"=",
"idxTi",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"rf",
".",
"insert",
"(",
")",
";",
"rf",
".",
"setVal",
"(",
"ICAT_IDXNAME",
",",
"new",
"VarcharConstant",
"(",
"idxName",
")",
")",
";",
"rf",
".",
"setVal",
"(",
"ICAT_TBLNAME",
",",
"new",
"VarcharConstant",
"(",
"tblName",
")",
")",
";",
"rf",
".",
"setVal",
"(",
"ICAT_IDXTYPE",
",",
"new",
"IntegerConstant",
"(",
"idxType",
".",
"toInteger",
"(",
")",
")",
")",
";",
"rf",
".",
"close",
"(",
")",
";",
"// Add the field names to the key catalog\r",
"rf",
"=",
"keyTi",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"for",
"(",
"String",
"fldName",
":",
"fldNames",
")",
"{",
"rf",
".",
"insert",
"(",
")",
";",
"rf",
".",
"setVal",
"(",
"KCAT_IDXNAME",
",",
"new",
"VarcharConstant",
"(",
"idxName",
")",
")",
";",
"rf",
".",
"setVal",
"(",
"KCAT_KEYNAME",
",",
"new",
"VarcharConstant",
"(",
"fldName",
")",
")",
";",
"rf",
".",
"close",
"(",
")",
";",
"}",
"updateCache",
"(",
"new",
"IndexInfo",
"(",
"idxName",
",",
"tblName",
",",
"fldNames",
",",
"idxType",
")",
")",
";",
"}"
] | Creates an index of the specified type for the specified field. A unique
ID is assigned to this index, and its information is stored in the idxcat
table.
@param idxName
the name of the index
@param tblName
the name of the indexed table
@param fldNames
the name of the indexed field
@param idxType
the index type of the indexed field
@param tx
the calling transaction | [
"Creates",
"an",
"index",
"of",
"the",
"specified",
"type",
"for",
"the",
"specified",
"field",
".",
"A",
"unique",
"ID",
"is",
"assigned",
"to",
"this",
"index",
"and",
"its",
"information",
"is",
"stored",
"in",
"the",
"idxcat",
"table",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java#L132-L153 |
139,923 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java | IndexMgr.getIndexInfo | public List<IndexInfo> getIndexInfo(String tblName, String fldName, Transaction tx) {
// Check the cache
if (!loadedTables.contains(tblName)) {
readFromFile(tblName, tx);
}
// Fetch from the cache
Map<String, List<IndexInfo>> iiMap = iiMapByTblAndFlds.get(tblName);
if (iiMap == null)
return Collections.emptyList(); // avoid object creation
List<IndexInfo> iiList = iiMap.get(fldName);
if (iiList == null)
return Collections.emptyList(); // avoid object creation
// Defense copy
return new LinkedList<IndexInfo>(iiList);
} | java | public List<IndexInfo> getIndexInfo(String tblName, String fldName, Transaction tx) {
// Check the cache
if (!loadedTables.contains(tblName)) {
readFromFile(tblName, tx);
}
// Fetch from the cache
Map<String, List<IndexInfo>> iiMap = iiMapByTblAndFlds.get(tblName);
if (iiMap == null)
return Collections.emptyList(); // avoid object creation
List<IndexInfo> iiList = iiMap.get(fldName);
if (iiList == null)
return Collections.emptyList(); // avoid object creation
// Defense copy
return new LinkedList<IndexInfo>(iiList);
} | [
"public",
"List",
"<",
"IndexInfo",
">",
"getIndexInfo",
"(",
"String",
"tblName",
",",
"String",
"fldName",
",",
"Transaction",
"tx",
")",
"{",
"// Check the cache\r",
"if",
"(",
"!",
"loadedTables",
".",
"contains",
"(",
"tblName",
")",
")",
"{",
"readFromFile",
"(",
"tblName",
",",
"tx",
")",
";",
"}",
"// Fetch from the cache\r",
"Map",
"<",
"String",
",",
"List",
"<",
"IndexInfo",
">",
">",
"iiMap",
"=",
"iiMapByTblAndFlds",
".",
"get",
"(",
"tblName",
")",
";",
"if",
"(",
"iiMap",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"// avoid object creation\r",
"List",
"<",
"IndexInfo",
">",
"iiList",
"=",
"iiMap",
".",
"get",
"(",
"fldName",
")",
";",
"if",
"(",
"iiList",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"// avoid object creation\r",
"// Defense copy\r",
"return",
"new",
"LinkedList",
"<",
"IndexInfo",
">",
"(",
"iiList",
")",
";",
"}"
] | Returns a map containing the index info for all indexes on the specified
table.
@param tblName
the name of the table
@param fldName
the name of the search field
@param tx
the context of executing transaction
@return a map of IndexInfo objects, keyed by their field names | [
"Returns",
"a",
"map",
"containing",
"the",
"index",
"info",
"for",
"all",
"indexes",
"on",
"the",
"specified",
"table",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java#L182-L198 |
139,924 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java | IndexMgr.getIndexInfoByName | public IndexInfo getIndexInfoByName(String idxName, Transaction tx) {
// Fetch from the cache
IndexInfo ii = iiMapByIdxNames.get(idxName);
if (ii != null)
return ii;
// Read from the catalog files
String tblName = null;
List<String> fldNames = new LinkedList<String>();
IndexType idxType = null;
// Find the index in the index catalog
RecordFile rf = idxTi.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
if (((String) rf.getVal(ICAT_IDXNAME).asJavaVal()).equals(idxName)) {
tblName = (String) rf.getVal(ICAT_TBLNAME).asJavaVal();
int idxtypeVal = (Integer) rf.getVal(ICAT_IDXTYPE).asJavaVal();
idxType = IndexType.fromInteger(idxtypeVal);
break;
}
}
rf.close();
if (tblName == null)
return null;
// Find the corresponding field names
rf = keyTi.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
if (((String) rf.getVal(KCAT_IDXNAME).asJavaVal()).equals(idxName)) {
fldNames.add((String) rf.getVal(KCAT_KEYNAME).asJavaVal());
}
}
rf.close();
// Materialize IndexInfos
ii = new IndexInfo(idxName, tblName, fldNames, idxType);
updateCache(ii);
return ii;
} | java | public IndexInfo getIndexInfoByName(String idxName, Transaction tx) {
// Fetch from the cache
IndexInfo ii = iiMapByIdxNames.get(idxName);
if (ii != null)
return ii;
// Read from the catalog files
String tblName = null;
List<String> fldNames = new LinkedList<String>();
IndexType idxType = null;
// Find the index in the index catalog
RecordFile rf = idxTi.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
if (((String) rf.getVal(ICAT_IDXNAME).asJavaVal()).equals(idxName)) {
tblName = (String) rf.getVal(ICAT_TBLNAME).asJavaVal();
int idxtypeVal = (Integer) rf.getVal(ICAT_IDXTYPE).asJavaVal();
idxType = IndexType.fromInteger(idxtypeVal);
break;
}
}
rf.close();
if (tblName == null)
return null;
// Find the corresponding field names
rf = keyTi.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
if (((String) rf.getVal(KCAT_IDXNAME).asJavaVal()).equals(idxName)) {
fldNames.add((String) rf.getVal(KCAT_KEYNAME).asJavaVal());
}
}
rf.close();
// Materialize IndexInfos
ii = new IndexInfo(idxName, tblName, fldNames, idxType);
updateCache(ii);
return ii;
} | [
"public",
"IndexInfo",
"getIndexInfoByName",
"(",
"String",
"idxName",
",",
"Transaction",
"tx",
")",
"{",
"// Fetch from the cache\r",
"IndexInfo",
"ii",
"=",
"iiMapByIdxNames",
".",
"get",
"(",
"idxName",
")",
";",
"if",
"(",
"ii",
"!=",
"null",
")",
"return",
"ii",
";",
"// Read from the catalog files\r",
"String",
"tblName",
"=",
"null",
";",
"List",
"<",
"String",
">",
"fldNames",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"IndexType",
"idxType",
"=",
"null",
";",
"// Find the index in the index catalog\r",
"RecordFile",
"rf",
"=",
"idxTi",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"rf",
".",
"beforeFirst",
"(",
")",
";",
"while",
"(",
"rf",
".",
"next",
"(",
")",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"ICAT_IDXNAME",
")",
".",
"asJavaVal",
"(",
")",
")",
".",
"equals",
"(",
"idxName",
")",
")",
"{",
"tblName",
"=",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"ICAT_TBLNAME",
")",
".",
"asJavaVal",
"(",
")",
";",
"int",
"idxtypeVal",
"=",
"(",
"Integer",
")",
"rf",
".",
"getVal",
"(",
"ICAT_IDXTYPE",
")",
".",
"asJavaVal",
"(",
")",
";",
"idxType",
"=",
"IndexType",
".",
"fromInteger",
"(",
"idxtypeVal",
")",
";",
"break",
";",
"}",
"}",
"rf",
".",
"close",
"(",
")",
";",
"if",
"(",
"tblName",
"==",
"null",
")",
"return",
"null",
";",
"// Find the corresponding field names\r",
"rf",
"=",
"keyTi",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"rf",
".",
"beforeFirst",
"(",
")",
";",
"while",
"(",
"rf",
".",
"next",
"(",
")",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"KCAT_IDXNAME",
")",
".",
"asJavaVal",
"(",
")",
")",
".",
"equals",
"(",
"idxName",
")",
")",
"{",
"fldNames",
".",
"add",
"(",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"KCAT_KEYNAME",
")",
".",
"asJavaVal",
"(",
")",
")",
";",
"}",
"}",
"rf",
".",
"close",
"(",
")",
";",
"// Materialize IndexInfos\r",
"ii",
"=",
"new",
"IndexInfo",
"(",
"idxName",
",",
"tblName",
",",
"fldNames",
",",
"idxType",
")",
";",
"updateCache",
"(",
"ii",
")",
";",
"return",
"ii",
";",
"}"
] | Returns the requested index info object with the given index name.
@param idxName
the name of the index
@param tx
the calling transaction
@return an IndexInfo object | [
"Returns",
"the",
"requested",
"index",
"info",
"object",
"with",
"the",
"given",
"index",
"name",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java#L209-L251 |
139,925 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/index/IndexInfo.java | IndexInfo.open | public Index open(Transaction tx) {
TableInfo ti = VanillaDb.catalogMgr().getTableInfo(tblName, tx);
if (ti == null)
throw new TableNotFoundException("table '" + tblName
+ "' is not defined in catalog.");
return Index.newInstance(this, new SearchKeyType(ti.schema(), fldNames), tx);
} | java | public Index open(Transaction tx) {
TableInfo ti = VanillaDb.catalogMgr().getTableInfo(tblName, tx);
if (ti == null)
throw new TableNotFoundException("table '" + tblName
+ "' is not defined in catalog.");
return Index.newInstance(this, new SearchKeyType(ti.schema(), fldNames), tx);
} | [
"public",
"Index",
"open",
"(",
"Transaction",
"tx",
")",
"{",
"TableInfo",
"ti",
"=",
"VanillaDb",
".",
"catalogMgr",
"(",
")",
".",
"getTableInfo",
"(",
"tblName",
",",
"tx",
")",
";",
"if",
"(",
"ti",
"==",
"null",
")",
"throw",
"new",
"TableNotFoundException",
"(",
"\"table '\"",
"+",
"tblName",
"+",
"\"' is not defined in catalog.\"",
")",
";",
"return",
"Index",
".",
"newInstance",
"(",
"this",
",",
"new",
"SearchKeyType",
"(",
"ti",
".",
"schema",
"(",
")",
",",
"fldNames",
")",
",",
"tx",
")",
";",
"}"
] | Opens the index described by this object.
@param tx
the context of executing transaction
@return the {@link Index} object associated with this information | [
"Opens",
"the",
"index",
"described",
"by",
"this",
"object",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexInfo.java#L67-L74 |
139,926 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/log/BasicLogRecord.java | BasicLogRecord.nextVal | public Constant nextVal(Type type) {
Constant val = pg.getVal(currentPos, type);
currentPos += Page.size(val);
return val;
} | java | public Constant nextVal(Type type) {
Constant val = pg.getVal(currentPos, type);
currentPos += Page.size(val);
return val;
} | [
"public",
"Constant",
"nextVal",
"(",
"Type",
"type",
")",
"{",
"Constant",
"val",
"=",
"pg",
".",
"getVal",
"(",
"currentPos",
",",
"type",
")",
";",
"currentPos",
"+=",
"Page",
".",
"size",
"(",
"val",
")",
";",
"return",
"val",
";",
"}"
] | Returns the next value of this log record.
@param type
the expected type of the value
@return the next value | [
"Returns",
"the",
"next",
"value",
"of",
"this",
"log",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/BasicLogRecord.java#L61-L65 |
139,927 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/remote/jdbc/RemoteMetaDataImpl.java | RemoteMetaDataImpl.getColumnType | @Override
public int getColumnType(int column) throws RemoteException {
String fldname = getColumnName(column);
return schema.type(fldname).getSqlType();
} | java | @Override
public int getColumnType(int column) throws RemoteException {
String fldname = getColumnName(column);
return schema.type(fldname).getSqlType();
} | [
"@",
"Override",
"public",
"int",
"getColumnType",
"(",
"int",
"column",
")",
"throws",
"RemoteException",
"{",
"String",
"fldname",
"=",
"getColumnName",
"(",
"column",
")",
";",
"return",
"schema",
".",
"type",
"(",
"fldname",
")",
".",
"getSqlType",
"(",
")",
";",
"}"
] | Returns the type of the specified column. The method first finds the name
of the field in that column, and then looks up its type in the schema.
@see org.vanilladb.core.remote.jdbc.RemoteMetaData#getColumnType(int) | [
"Returns",
"the",
"type",
"of",
"the",
"specified",
"column",
".",
"The",
"method",
"first",
"finds",
"the",
"name",
"of",
"the",
"field",
"in",
"that",
"column",
"and",
"then",
"looks",
"up",
"its",
"type",
"in",
"the",
"schema",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteMetaDataImpl.java#L77-L81 |
139,928 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/remote/jdbc/RemoteMetaDataImpl.java | RemoteMetaDataImpl.getColumnDisplaySize | @Override
public int getColumnDisplaySize(int column) throws RemoteException {
String fldname = getColumnName(column);
Type fldtype = schema.type(fldname);
if (fldtype.isFixedSize())
// 6 and 12 digits for int and double respectively
return fldtype.maxSize() * 8 / 5;
return schema.type(fldname).getArgument();
} | java | @Override
public int getColumnDisplaySize(int column) throws RemoteException {
String fldname = getColumnName(column);
Type fldtype = schema.type(fldname);
if (fldtype.isFixedSize())
// 6 and 12 digits for int and double respectively
return fldtype.maxSize() * 8 / 5;
return schema.type(fldname).getArgument();
} | [
"@",
"Override",
"public",
"int",
"getColumnDisplaySize",
"(",
"int",
"column",
")",
"throws",
"RemoteException",
"{",
"String",
"fldname",
"=",
"getColumnName",
"(",
"column",
")",
";",
"Type",
"fldtype",
"=",
"schema",
".",
"type",
"(",
"fldname",
")",
";",
"if",
"(",
"fldtype",
".",
"isFixedSize",
"(",
")",
")",
"// 6 and 12 digits for int and double respectively\r",
"return",
"fldtype",
".",
"maxSize",
"(",
")",
"*",
"8",
"/",
"5",
";",
"return",
"schema",
".",
"type",
"(",
"fldname",
")",
".",
"getArgument",
"(",
")",
";",
"}"
] | Returns the number of characters required to display the specified
column.
@see org.vanilladb.core.remote.jdbc.RemoteMetaData#getColumnDisplaySize(int) | [
"Returns",
"the",
"number",
"of",
"characters",
"required",
"to",
"display",
"the",
"specified",
"column",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteMetaDataImpl.java#L89-L97 |
139,929 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java | IndexJoinScan.next | @Override
public boolean next() {
if (isLhsEmpty)
return false;
if (idx.next()) {
ts.moveToRecordId(idx.getDataRecordId());
return true;
} else if (!(isLhsEmpty = !s.next())) {
resetIndex();
return next();
} else
return false;
} | java | @Override
public boolean next() {
if (isLhsEmpty)
return false;
if (idx.next()) {
ts.moveToRecordId(idx.getDataRecordId());
return true;
} else if (!(isLhsEmpty = !s.next())) {
resetIndex();
return next();
} else
return false;
} | [
"@",
"Override",
"public",
"boolean",
"next",
"(",
")",
"{",
"if",
"(",
"isLhsEmpty",
")",
"return",
"false",
";",
"if",
"(",
"idx",
".",
"next",
"(",
")",
")",
"{",
"ts",
".",
"moveToRecordId",
"(",
"idx",
".",
"getDataRecordId",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"!",
"(",
"isLhsEmpty",
"=",
"!",
"s",
".",
"next",
"(",
")",
")",
")",
"{",
"resetIndex",
"(",
")",
";",
"return",
"next",
"(",
")",
";",
"}",
"else",
"return",
"false",
";",
"}"
] | Moves the scan to the next record. The method moves to the next index
record, if possible. Otherwise, it moves to the next LHS record and the
first index record. If there are no more LHS records, the method returns
false.
@see Scan#next() | [
"Moves",
"the",
"scan",
"to",
"the",
"next",
"record",
".",
"The",
"method",
"moves",
"to",
"the",
"next",
"index",
"record",
"if",
"possible",
".",
"Otherwise",
"it",
"moves",
"to",
"the",
"next",
"LHS",
"record",
"and",
"the",
"first",
"index",
"record",
".",
"If",
"there",
"are",
"no",
"more",
"LHS",
"records",
"the",
"method",
"returns",
"false",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java#L84-L96 |
139,930 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java | IndexJoinScan.getVal | @Override
public Constant getVal(String fldName) {
if (ts.hasField(fldName))
return ts.getVal(fldName);
else
return s.getVal(fldName);
} | java | @Override
public Constant getVal(String fldName) {
if (ts.hasField(fldName))
return ts.getVal(fldName);
else
return s.getVal(fldName);
} | [
"@",
"Override",
"public",
"Constant",
"getVal",
"(",
"String",
"fldName",
")",
"{",
"if",
"(",
"ts",
".",
"hasField",
"(",
"fldName",
")",
")",
"return",
"ts",
".",
"getVal",
"(",
"fldName",
")",
";",
"else",
"return",
"s",
".",
"getVal",
"(",
"fldName",
")",
";",
"}"
] | Returns the Constant value of the specified field.
@see Scan#getVal(java.lang.String) | [
"Returns",
"the",
"Constant",
"value",
"of",
"the",
"specified",
"field",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java#L115-L121 |
139,931 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java | IndexJoinScan.hasField | @Override
public boolean hasField(String fldName) {
return ts.hasField(fldName) || s.hasField(fldName);
} | java | @Override
public boolean hasField(String fldName) {
return ts.hasField(fldName) || s.hasField(fldName);
} | [
"@",
"Override",
"public",
"boolean",
"hasField",
"(",
"String",
"fldName",
")",
"{",
"return",
"ts",
".",
"hasField",
"(",
"fldName",
")",
"||",
"s",
".",
"hasField",
"(",
"fldName",
")",
";",
"}"
] | Returns true if the field is in the schema.
@see Scan#hasField(java.lang.String) | [
"Returns",
"true",
"if",
"the",
"field",
"is",
"in",
"the",
"schema",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java#L128-L131 |
139,932 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/LogicalStartRecord.java | LogicalStartRecord.undo | @Override
public void undo(Transaction tx) {
LogSeqNum lsn = tx.recoveryMgr().logLogicalAbort(this.txNum,this.lsn);
VanillaDb.logMgr().flush(lsn);
} | java | @Override
public void undo(Transaction tx) {
LogSeqNum lsn = tx.recoveryMgr().logLogicalAbort(this.txNum,this.lsn);
VanillaDb.logMgr().flush(lsn);
} | [
"@",
"Override",
"public",
"void",
"undo",
"(",
"Transaction",
"tx",
")",
"{",
"LogSeqNum",
"lsn",
"=",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logLogicalAbort",
"(",
"this",
".",
"txNum",
",",
"this",
".",
"lsn",
")",
";",
"VanillaDb",
".",
"logMgr",
"(",
")",
".",
"flush",
"(",
"lsn",
")",
";",
"}"
] | Appends a Logical Abort Record to indicate the logical operation has be
aborted | [
"Appends",
"a",
"Logical",
"Abort",
"Record",
"to",
"indicate",
"the",
"logical",
"operation",
"has",
"be",
"aborted"
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/LogicalStartRecord.java#L74-L80 |
139,933 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/ViewMgr.java | ViewMgr.getViewNamesByTable | public Collection<String> getViewNamesByTable(String tblName, Transaction tx) {
Collection<String> result = new LinkedList<String>();
TableInfo ti = tblMgr.getTableInfo(VCAT, tx);
RecordFile rf = ti.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
Parser parser = new Parser((String) rf.getVal(VCAT_VDEF).asJavaVal());
if (parser.queryCommand().tables().contains(tblName))
result.add((String) rf.getVal(VCAT_VNAME).asJavaVal());
}
rf.close();
return result;
} | java | public Collection<String> getViewNamesByTable(String tblName, Transaction tx) {
Collection<String> result = new LinkedList<String>();
TableInfo ti = tblMgr.getTableInfo(VCAT, tx);
RecordFile rf = ti.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
Parser parser = new Parser((String) rf.getVal(VCAT_VDEF).asJavaVal());
if (parser.queryCommand().tables().contains(tblName))
result.add((String) rf.getVal(VCAT_VNAME).asJavaVal());
}
rf.close();
return result;
} | [
"public",
"Collection",
"<",
"String",
">",
"getViewNamesByTable",
"(",
"String",
"tblName",
",",
"Transaction",
"tx",
")",
"{",
"Collection",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"TableInfo",
"ti",
"=",
"tblMgr",
".",
"getTableInfo",
"(",
"VCAT",
",",
"tx",
")",
";",
"RecordFile",
"rf",
"=",
"ti",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"rf",
".",
"beforeFirst",
"(",
")",
";",
"while",
"(",
"rf",
".",
"next",
"(",
")",
")",
"{",
"Parser",
"parser",
"=",
"new",
"Parser",
"(",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"VCAT_VDEF",
")",
".",
"asJavaVal",
"(",
")",
")",
";",
"if",
"(",
"parser",
".",
"queryCommand",
"(",
")",
".",
"tables",
"(",
")",
".",
"contains",
"(",
"tblName",
")",
")",
"result",
".",
"add",
"(",
"(",
"String",
")",
"rf",
".",
"getVal",
"(",
"VCAT_VNAME",
")",
".",
"asJavaVal",
"(",
")",
")",
";",
"}",
"rf",
".",
"close",
"(",
")",
";",
"return",
"result",
";",
"}"
] | We may have to come out a better method. | [
"We",
"may",
"have",
"to",
"come",
"out",
"a",
"better",
"method",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/ViewMgr.java#L96-L110 |
139,934 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java | GroupByScan.next | @Override
public boolean next() {
if (!moreGroups)
return false;
if (aggFns != null)
for (AggregationFn fn : aggFns)
fn.processFirst(ss);
groupVal = new GroupValue(ss, groupFlds);
while (moreGroups = ss.next()) {
GroupValue gv = new GroupValue(ss, groupFlds);
if (!groupVal.equals(gv))
break;
if (aggFns != null)
for (AggregationFn fn : aggFns)
fn.processNext(ss);
}
return true;
} | java | @Override
public boolean next() {
if (!moreGroups)
return false;
if (aggFns != null)
for (AggregationFn fn : aggFns)
fn.processFirst(ss);
groupVal = new GroupValue(ss, groupFlds);
while (moreGroups = ss.next()) {
GroupValue gv = new GroupValue(ss, groupFlds);
if (!groupVal.equals(gv))
break;
if (aggFns != null)
for (AggregationFn fn : aggFns)
fn.processNext(ss);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"next",
"(",
")",
"{",
"if",
"(",
"!",
"moreGroups",
")",
"return",
"false",
";",
"if",
"(",
"aggFns",
"!=",
"null",
")",
"for",
"(",
"AggregationFn",
"fn",
":",
"aggFns",
")",
"fn",
".",
"processFirst",
"(",
"ss",
")",
";",
"groupVal",
"=",
"new",
"GroupValue",
"(",
"ss",
",",
"groupFlds",
")",
";",
"while",
"(",
"moreGroups",
"=",
"ss",
".",
"next",
"(",
")",
")",
"{",
"GroupValue",
"gv",
"=",
"new",
"GroupValue",
"(",
"ss",
",",
"groupFlds",
")",
";",
"if",
"(",
"!",
"groupVal",
".",
"equals",
"(",
"gv",
")",
")",
"break",
";",
"if",
"(",
"aggFns",
"!=",
"null",
")",
"for",
"(",
"AggregationFn",
"fn",
":",
"aggFns",
")",
"fn",
".",
"processNext",
"(",
"ss",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Moves to the next group. The key of the group is determined by the group
values at the current record. The method repeatedly reads underlying
records until it encounters a record having a different key. The
aggregation functions are called for each record in the group. The values
of the grouping fields for the group are saved.
@see Scan#next() | [
"Moves",
"to",
"the",
"next",
"group",
".",
"The",
"key",
"of",
"the",
"group",
"is",
"determined",
"by",
"the",
"group",
"values",
"at",
"the",
"current",
"record",
".",
"The",
"method",
"repeatedly",
"reads",
"underlying",
"records",
"until",
"it",
"encounters",
"a",
"record",
"having",
"a",
"different",
"key",
".",
"The",
"aggregation",
"functions",
"are",
"called",
"for",
"each",
"record",
"in",
"the",
"group",
".",
"The",
"values",
"of",
"the",
"grouping",
"fields",
"for",
"the",
"group",
"are",
"saved",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java#L75-L92 |
139,935 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java | GroupByScan.getVal | @Override
public Constant getVal(String fldname) {
if (groupFlds.contains(fldname))
return groupVal.getVal(fldname);
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return fn.value();
throw new RuntimeException("field " + fldname + " not found.");
} | java | @Override
public Constant getVal(String fldname) {
if (groupFlds.contains(fldname))
return groupVal.getVal(fldname);
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return fn.value();
throw new RuntimeException("field " + fldname + " not found.");
} | [
"@",
"Override",
"public",
"Constant",
"getVal",
"(",
"String",
"fldname",
")",
"{",
"if",
"(",
"groupFlds",
".",
"contains",
"(",
"fldname",
")",
")",
"return",
"groupVal",
".",
"getVal",
"(",
"fldname",
")",
";",
"if",
"(",
"aggFns",
"!=",
"null",
")",
"for",
"(",
"AggregationFn",
"fn",
":",
"aggFns",
")",
"if",
"(",
"fn",
".",
"fieldName",
"(",
")",
".",
"equals",
"(",
"fldname",
")",
")",
"return",
"fn",
".",
"value",
"(",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"\"field \"",
"+",
"fldname",
"+",
"\" not found.\"",
")",
";",
"}"
] | Gets the Constant value of the specified field. If the field is a group
field, then its value can be obtained from the saved group value.
Otherwise, the value is obtained from the appropriate aggregation
function.
@see Scan#getVal(java.lang.String) | [
"Gets",
"the",
"Constant",
"value",
"of",
"the",
"specified",
"field",
".",
"If",
"the",
"field",
"is",
"a",
"group",
"field",
"then",
"its",
"value",
"can",
"be",
"obtained",
"from",
"the",
"saved",
"group",
"value",
".",
"Otherwise",
"the",
"value",
"is",
"obtained",
"from",
"the",
"appropriate",
"aggregation",
"function",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java#L112-L121 |
139,936 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java | GroupByScan.hasField | @Override
public boolean hasField(String fldname) {
if (groupFlds.contains(fldname))
return true;
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return true;
return false;
} | java | @Override
public boolean hasField(String fldname) {
if (groupFlds.contains(fldname))
return true;
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return true;
return false;
} | [
"@",
"Override",
"public",
"boolean",
"hasField",
"(",
"String",
"fldname",
")",
"{",
"if",
"(",
"groupFlds",
".",
"contains",
"(",
"fldname",
")",
")",
"return",
"true",
";",
"if",
"(",
"aggFns",
"!=",
"null",
")",
"for",
"(",
"AggregationFn",
"fn",
":",
"aggFns",
")",
"if",
"(",
"fn",
".",
"fieldName",
"(",
")",
".",
"equals",
"(",
"fldname",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Returns true if the specified field is either a grouping field or created
by an aggregation function.
@see Scan#hasField(java.lang.String) | [
"Returns",
"true",
"if",
"the",
"specified",
"field",
"is",
"either",
"a",
"grouping",
"field",
"or",
"created",
"by",
"an",
"aggregation",
"function",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java#L129-L138 |
139,937 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java | BufferPoolMgr.flushAll | void flushAll() {
for (Buffer buff : bufferPool) {
try {
buff.getExternalLock().lock();
buff.flush();
} finally {
buff.getExternalLock().unlock();
}
}
} | java | void flushAll() {
for (Buffer buff : bufferPool) {
try {
buff.getExternalLock().lock();
buff.flush();
} finally {
buff.getExternalLock().unlock();
}
}
} | [
"void",
"flushAll",
"(",
")",
"{",
"for",
"(",
"Buffer",
"buff",
":",
"bufferPool",
")",
"{",
"try",
"{",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"buff",
".",
"flush",
"(",
")",
";",
"}",
"finally",
"{",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}"
] | Flushes all dirty buffers. | [
"Flushes",
"all",
"dirty",
"buffers",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L73-L82 |
139,938 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java | BufferPoolMgr.pin | Buffer pin(BlockId blk) {
// Only the txs acquiring the same block will be blocked
synchronized (prepareAnchor(blk)) {
// Find existing buffer
Buffer buff = findExistingBuffer(blk);
// If there is no such buffer
if (buff == null) {
// Choose Unpinned Buffer
int lastReplacedBuff = this.lastReplacedBuff;
int currBlk = (lastReplacedBuff + 1) % bufferPool.length;
while (currBlk != lastReplacedBuff) {
buff = bufferPool[currBlk];
// Get the lock of buffer if it is free
if (buff.getExternalLock().tryLock()) {
try {
// Check if there is no one use it
if (!buff.isPinned()) {
this.lastReplacedBuff = currBlk;
// Swap
BlockId oldBlk = buff.block();
if (oldBlk != null)
blockMap.remove(oldBlk);
buff.assignToBlock(blk);
blockMap.put(blk, buff);
if (!buff.isPinned())
numAvailable.decrementAndGet();
// Pin this buffer
buff.pin();
return buff;
}
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
currBlk = (currBlk + 1) % bufferPool.length;
}
return null;
// If it exists
} else {
// Get the lock of buffer
buff.getExternalLock().lock();
try {
// Check its block id before pinning since it might be swapped
if (buff.block().equals(blk)) {
if (!buff.isPinned())
numAvailable.decrementAndGet();
buff.pin();
return buff;
}
return pin(blk);
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
}
} | java | Buffer pin(BlockId blk) {
// Only the txs acquiring the same block will be blocked
synchronized (prepareAnchor(blk)) {
// Find existing buffer
Buffer buff = findExistingBuffer(blk);
// If there is no such buffer
if (buff == null) {
// Choose Unpinned Buffer
int lastReplacedBuff = this.lastReplacedBuff;
int currBlk = (lastReplacedBuff + 1) % bufferPool.length;
while (currBlk != lastReplacedBuff) {
buff = bufferPool[currBlk];
// Get the lock of buffer if it is free
if (buff.getExternalLock().tryLock()) {
try {
// Check if there is no one use it
if (!buff.isPinned()) {
this.lastReplacedBuff = currBlk;
// Swap
BlockId oldBlk = buff.block();
if (oldBlk != null)
blockMap.remove(oldBlk);
buff.assignToBlock(blk);
blockMap.put(blk, buff);
if (!buff.isPinned())
numAvailable.decrementAndGet();
// Pin this buffer
buff.pin();
return buff;
}
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
currBlk = (currBlk + 1) % bufferPool.length;
}
return null;
// If it exists
} else {
// Get the lock of buffer
buff.getExternalLock().lock();
try {
// Check its block id before pinning since it might be swapped
if (buff.block().equals(blk)) {
if (!buff.isPinned())
numAvailable.decrementAndGet();
buff.pin();
return buff;
}
return pin(blk);
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
}
} | [
"Buffer",
"pin",
"(",
"BlockId",
"blk",
")",
"{",
"// Only the txs acquiring the same block will be blocked\r",
"synchronized",
"(",
"prepareAnchor",
"(",
"blk",
")",
")",
"{",
"// Find existing buffer\r",
"Buffer",
"buff",
"=",
"findExistingBuffer",
"(",
"blk",
")",
";",
"// If there is no such buffer\r",
"if",
"(",
"buff",
"==",
"null",
")",
"{",
"// Choose Unpinned Buffer\r",
"int",
"lastReplacedBuff",
"=",
"this",
".",
"lastReplacedBuff",
";",
"int",
"currBlk",
"=",
"(",
"lastReplacedBuff",
"+",
"1",
")",
"%",
"bufferPool",
".",
"length",
";",
"while",
"(",
"currBlk",
"!=",
"lastReplacedBuff",
")",
"{",
"buff",
"=",
"bufferPool",
"[",
"currBlk",
"]",
";",
"// Get the lock of buffer if it is free\r",
"if",
"(",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"tryLock",
"(",
")",
")",
"{",
"try",
"{",
"// Check if there is no one use it\r",
"if",
"(",
"!",
"buff",
".",
"isPinned",
"(",
")",
")",
"{",
"this",
".",
"lastReplacedBuff",
"=",
"currBlk",
";",
"// Swap\r",
"BlockId",
"oldBlk",
"=",
"buff",
".",
"block",
"(",
")",
";",
"if",
"(",
"oldBlk",
"!=",
"null",
")",
"blockMap",
".",
"remove",
"(",
"oldBlk",
")",
";",
"buff",
".",
"assignToBlock",
"(",
"blk",
")",
";",
"blockMap",
".",
"put",
"(",
"blk",
",",
"buff",
")",
";",
"if",
"(",
"!",
"buff",
".",
"isPinned",
"(",
")",
")",
"numAvailable",
".",
"decrementAndGet",
"(",
")",
";",
"// Pin this buffer\r",
"buff",
".",
"pin",
"(",
")",
";",
"return",
"buff",
";",
"}",
"}",
"finally",
"{",
"// Release the lock of buffer\r",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"currBlk",
"=",
"(",
"currBlk",
"+",
"1",
")",
"%",
"bufferPool",
".",
"length",
";",
"}",
"return",
"null",
";",
"// If it exists\r",
"}",
"else",
"{",
"// Get the lock of buffer\r",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// Check its block id before pinning since it might be swapped\r",
"if",
"(",
"buff",
".",
"block",
"(",
")",
".",
"equals",
"(",
"blk",
")",
")",
"{",
"if",
"(",
"!",
"buff",
".",
"isPinned",
"(",
")",
")",
"numAvailable",
".",
"decrementAndGet",
"(",
")",
";",
"buff",
".",
"pin",
"(",
")",
";",
"return",
"buff",
";",
"}",
"return",
"pin",
"(",
"blk",
")",
";",
"}",
"finally",
"{",
"// Release the lock of buffer\r",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Pins a buffer to the specified block. If there is already a buffer
assigned to that block then that buffer is used; otherwise, an unpinned
buffer from the pool is chosen. Returns a null value if there are no
available buffers.
@param blk
a block ID
@return the pinned buffer | [
"Pins",
"a",
"buffer",
"to",
"the",
"specified",
"block",
".",
"If",
"there",
"is",
"already",
"a",
"buffer",
"assigned",
"to",
"that",
"block",
"then",
"that",
"buffer",
"is",
"used",
";",
"otherwise",
"an",
"unpinned",
"buffer",
"from",
"the",
"pool",
"is",
"chosen",
".",
"Returns",
"a",
"null",
"value",
"if",
"there",
"are",
"no",
"available",
"buffers",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L113-L178 |
139,939 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java | BufferPoolMgr.unpin | void unpin(Buffer... buffs) {
for (Buffer buff : buffs) {
try {
// Get the lock of buffer
buff.getExternalLock().lock();
buff.unpin();
if (!buff.isPinned())
numAvailable.incrementAndGet();
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
} | java | void unpin(Buffer... buffs) {
for (Buffer buff : buffs) {
try {
// Get the lock of buffer
buff.getExternalLock().lock();
buff.unpin();
if (!buff.isPinned())
numAvailable.incrementAndGet();
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
} | [
"void",
"unpin",
"(",
"Buffer",
"...",
"buffs",
")",
"{",
"for",
"(",
"Buffer",
"buff",
":",
"buffs",
")",
"{",
"try",
"{",
"// Get the lock of buffer\r",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"buff",
".",
"unpin",
"(",
")",
";",
"if",
"(",
"!",
"buff",
".",
"isPinned",
"(",
")",
")",
"numAvailable",
".",
"incrementAndGet",
"(",
")",
";",
"}",
"finally",
"{",
"// Release the lock of buffer\r",
"buff",
".",
"getExternalLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"}"
] | Unpins the specified buffers.
@param buffs
the buffers to be unpinned | [
"Unpins",
"the",
"specified",
"buffers",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L237-L250 |
139,940 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.initializeSystem | public static void initializeSystem(Transaction tx) {
tx.recoveryMgr().recoverSystem(tx);
tx.bufferMgr().flushAll();
VanillaDb.logMgr().removeAndCreateNewLog();
// Add a start record for this transaction
new StartRecord(tx.getTransactionNumber()).writeToLog();
} | java | public static void initializeSystem(Transaction tx) {
tx.recoveryMgr().recoverSystem(tx);
tx.bufferMgr().flushAll();
VanillaDb.logMgr().removeAndCreateNewLog();
// Add a start record for this transaction
new StartRecord(tx.getTransactionNumber()).writeToLog();
} | [
"public",
"static",
"void",
"initializeSystem",
"(",
"Transaction",
"tx",
")",
"{",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"recoverSystem",
"(",
"tx",
")",
";",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"flushAll",
"(",
")",
";",
"VanillaDb",
".",
"logMgr",
"(",
")",
".",
"removeAndCreateNewLog",
"(",
")",
";",
"// Add a start record for this transaction\r",
"new",
"StartRecord",
"(",
"tx",
".",
"getTransactionNumber",
"(",
")",
")",
".",
"writeToLog",
"(",
")",
";",
"}"
] | Goes through the log, rolling back all uncompleted transactions. Flushes
all modified blocks. Finally, writes a quiescent checkpoint record to the
log and flush it. This method should be called only during system
startup, before user transactions begin.
@param tx
the context of executing transaction | [
"Goes",
"through",
"the",
"log",
"rolling",
"back",
"all",
"uncompleted",
"transactions",
".",
"Flushes",
"all",
"modified",
"blocks",
".",
"Finally",
"writes",
"a",
"quiescent",
"checkpoint",
"record",
"to",
"the",
"log",
"and",
"flush",
"it",
".",
"This",
"method",
"should",
"be",
"called",
"only",
"during",
"system",
"startup",
"before",
"user",
"transactions",
"begin",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L59-L66 |
139,941 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.onTxCommit | @Override
public void onTxCommit(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
LogSeqNum lsn = new CommitRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | java | @Override
public void onTxCommit(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
LogSeqNum lsn = new CommitRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | [
"@",
"Override",
"public",
"void",
"onTxCommit",
"(",
"Transaction",
"tx",
")",
"{",
"if",
"(",
"!",
"tx",
".",
"isReadOnly",
"(",
")",
"&&",
"enableLogging",
")",
"{",
"LogSeqNum",
"lsn",
"=",
"new",
"CommitRecord",
"(",
"txNum",
")",
".",
"writeToLog",
"(",
")",
";",
"VanillaDb",
".",
"logMgr",
"(",
")",
".",
"flush",
"(",
"lsn",
")",
";",
"}",
"}"
] | Writes a commit record to the log, and then flushes the log record to
disk.
@param tx
the context of committing transaction | [
"Writes",
"a",
"commit",
"record",
"to",
"the",
"log",
"and",
"then",
"flushes",
"the",
"log",
"record",
"to",
"disk",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L93-L99 |
139,942 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.onTxRollback | @Override
public void onTxRollback(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
rollback(tx);
LogSeqNum lsn = new RollbackRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | java | @Override
public void onTxRollback(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
rollback(tx);
LogSeqNum lsn = new RollbackRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | [
"@",
"Override",
"public",
"void",
"onTxRollback",
"(",
"Transaction",
"tx",
")",
"{",
"if",
"(",
"!",
"tx",
".",
"isReadOnly",
"(",
")",
"&&",
"enableLogging",
")",
"{",
"rollback",
"(",
"tx",
")",
";",
"LogSeqNum",
"lsn",
"=",
"new",
"RollbackRecord",
"(",
"txNum",
")",
".",
"writeToLog",
"(",
")",
";",
"VanillaDb",
".",
"logMgr",
"(",
")",
".",
"flush",
"(",
"lsn",
")",
";",
"}",
"}"
] | Does the roll back process, writes a rollback record to the log, and
flushes the log record to disk. | [
"Does",
"the",
"roll",
"back",
"process",
"writes",
"a",
"rollback",
"record",
"to",
"the",
"log",
"and",
"flushes",
"the",
"log",
"record",
"to",
"disk",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L105-L112 |
139,943 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.logSetVal | public LogSeqNum logSetVal(Buffer buff, int offset, Constant newVal) {
if (enableLogging) {
BlockId blk = buff.block();
if (isTempBlock(blk))
return null;
return new SetValueRecord(txNum, blk, offset, buff.getVal(offset, newVal.getType()), newVal).writeToLog();
} else
return null;
} | java | public LogSeqNum logSetVal(Buffer buff, int offset, Constant newVal) {
if (enableLogging) {
BlockId blk = buff.block();
if (isTempBlock(blk))
return null;
return new SetValueRecord(txNum, blk, offset, buff.getVal(offset, newVal.getType()), newVal).writeToLog();
} else
return null;
} | [
"public",
"LogSeqNum",
"logSetVal",
"(",
"Buffer",
"buff",
",",
"int",
"offset",
",",
"Constant",
"newVal",
")",
"{",
"if",
"(",
"enableLogging",
")",
"{",
"BlockId",
"blk",
"=",
"buff",
".",
"block",
"(",
")",
";",
"if",
"(",
"isTempBlock",
"(",
"blk",
")",
")",
"return",
"null",
";",
"return",
"new",
"SetValueRecord",
"(",
"txNum",
",",
"blk",
",",
"offset",
",",
"buff",
".",
"getVal",
"(",
"offset",
",",
"newVal",
".",
"getType",
"(",
")",
")",
",",
"newVal",
")",
".",
"writeToLog",
"(",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] | Writes a set value record to the log.
@param buff
the buffer containing the page
@param offset
the offset of the value in the page
@param newVal
the value to be written
@return the LSN of the log record, or -1 if updates to temporary files | [
"Writes",
"a",
"set",
"value",
"record",
"to",
"the",
"log",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L142-L150 |
139,944 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java | RecoveryMgr.logLogicalAbort | public LogSeqNum logLogicalAbort(long txNum, LogSeqNum undoNextLSN) {
if (enableLogging) {
return new LogicalAbortRecord(txNum, undoNextLSN).writeToLog();
} else
return null;
} | java | public LogSeqNum logLogicalAbort(long txNum, LogSeqNum undoNextLSN) {
if (enableLogging) {
return new LogicalAbortRecord(txNum, undoNextLSN).writeToLog();
} else
return null;
} | [
"public",
"LogSeqNum",
"logLogicalAbort",
"(",
"long",
"txNum",
",",
"LogSeqNum",
"undoNextLSN",
")",
"{",
"if",
"(",
"enableLogging",
")",
"{",
"return",
"new",
"LogicalAbortRecord",
"(",
"txNum",
",",
"undoNextLSN",
")",
".",
"writeToLog",
"(",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] | Writes a logical abort record into the log.
@param txNum
the number of aborted transaction
@param undoNextLSN
the LSN which the redo the Abort record should jump to
@return the LSN of the log record, or null if recovery manager turns off
the logging | [
"Writes",
"a",
"logical",
"abort",
"record",
"into",
"the",
"log",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L172-L177 |
139,945 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/index/btree/BTreeIndex.java | BTreeIndex.delete | @Override
public void delete(SearchKey key, RecordId dataRecordId, boolean doLogicalLogging) {
if (tx.isReadOnly())
throw new UnsupportedOperationException();
search(new SearchRange(key), SearchPurpose.DELETE);
// log the logical operation starts
if (doLogicalLogging)
tx.recoveryMgr().logLogicalStart();
leaf.delete(dataRecordId);
// log the logical operation ends
if (doLogicalLogging)
tx.recoveryMgr().logIndexDeletionEnd(ii.indexName(), key,
dataRecordId.block().number(), dataRecordId.id());
} | java | @Override
public void delete(SearchKey key, RecordId dataRecordId, boolean doLogicalLogging) {
if (tx.isReadOnly())
throw new UnsupportedOperationException();
search(new SearchRange(key), SearchPurpose.DELETE);
// log the logical operation starts
if (doLogicalLogging)
tx.recoveryMgr().logLogicalStart();
leaf.delete(dataRecordId);
// log the logical operation ends
if (doLogicalLogging)
tx.recoveryMgr().logIndexDeletionEnd(ii.indexName(), key,
dataRecordId.block().number(), dataRecordId.id());
} | [
"@",
"Override",
"public",
"void",
"delete",
"(",
"SearchKey",
"key",
",",
"RecordId",
"dataRecordId",
",",
"boolean",
"doLogicalLogging",
")",
"{",
"if",
"(",
"tx",
".",
"isReadOnly",
"(",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"search",
"(",
"new",
"SearchRange",
"(",
"key",
")",
",",
"SearchPurpose",
".",
"DELETE",
")",
";",
"// log the logical operation starts\r",
"if",
"(",
"doLogicalLogging",
")",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logLogicalStart",
"(",
")",
";",
"leaf",
".",
"delete",
"(",
"dataRecordId",
")",
";",
"// log the logical operation ends\r",
"if",
"(",
"doLogicalLogging",
")",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logIndexDeletionEnd",
"(",
"ii",
".",
"indexName",
"(",
")",
",",
"key",
",",
"dataRecordId",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
",",
"dataRecordId",
".",
"id",
"(",
")",
")",
";",
"}"
] | Deletes the specified index record. The method first traverses the
directory to find the leaf page containing that record; then it deletes
the record from the page. F
@see Index#delete(SearchKey, RecordId, boolean) | [
"Deletes",
"the",
"specified",
"index",
"record",
".",
"The",
"method",
"first",
"traverses",
"the",
"directory",
"to",
"find",
"the",
"leaf",
"page",
"containing",
"that",
"record",
";",
"then",
"it",
"deletes",
"the",
"record",
"from",
"the",
"page",
".",
"F"
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/btree/BTreeIndex.java#L204-L221 |
139,946 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/index/btree/BTreeIndex.java | BTreeIndex.close | @Override
public void close() {
if (leaf != null) {
leaf.close();
leaf = null;
}
dirsMayBeUpdated = null;
} | java | @Override
public void close() {
if (leaf != null) {
leaf.close();
leaf = null;
}
dirsMayBeUpdated = null;
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"leaf",
"!=",
"null",
")",
"{",
"leaf",
".",
"close",
"(",
")",
";",
"leaf",
"=",
"null",
";",
"}",
"dirsMayBeUpdated",
"=",
"null",
";",
"}"
] | Closes the index by closing its open leaf page, if necessary.
@see Index#close() | [
"Closes",
"the",
"index",
"by",
"closing",
"its",
"open",
"leaf",
"page",
"if",
"necessary",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/btree/BTreeIndex.java#L228-L235 |
139,947 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java | StatMgr.getTableStatInfo | public synchronized TableStatInfo getTableStatInfo(TableInfo ti,
Transaction tx) {
if (isRefreshStatOn) {
Integer c = updateCounts.get(ti.tableName());
if (c != null && c > REFRESH_THRESHOLD)
VanillaDb.taskMgr().runTask(
new StatisticsRefreshTask(tx, ti.tableName()));
}
TableStatInfo tsi = tableStats.get(ti.tableName());
if (tsi == null) {
tsi = calcTableStats(ti, tx);
tableStats.put(ti.tableName(), tsi);
}
return tsi;
} | java | public synchronized TableStatInfo getTableStatInfo(TableInfo ti,
Transaction tx) {
if (isRefreshStatOn) {
Integer c = updateCounts.get(ti.tableName());
if (c != null && c > REFRESH_THRESHOLD)
VanillaDb.taskMgr().runTask(
new StatisticsRefreshTask(tx, ti.tableName()));
}
TableStatInfo tsi = tableStats.get(ti.tableName());
if (tsi == null) {
tsi = calcTableStats(ti, tx);
tableStats.put(ti.tableName(), tsi);
}
return tsi;
} | [
"public",
"synchronized",
"TableStatInfo",
"getTableStatInfo",
"(",
"TableInfo",
"ti",
",",
"Transaction",
"tx",
")",
"{",
"if",
"(",
"isRefreshStatOn",
")",
"{",
"Integer",
"c",
"=",
"updateCounts",
".",
"get",
"(",
"ti",
".",
"tableName",
"(",
")",
")",
";",
"if",
"(",
"c",
"!=",
"null",
"&&",
"c",
">",
"REFRESH_THRESHOLD",
")",
"VanillaDb",
".",
"taskMgr",
"(",
")",
".",
"runTask",
"(",
"new",
"StatisticsRefreshTask",
"(",
"tx",
",",
"ti",
".",
"tableName",
"(",
")",
")",
")",
";",
"}",
"TableStatInfo",
"tsi",
"=",
"tableStats",
".",
"get",
"(",
"ti",
".",
"tableName",
"(",
")",
")",
";",
"if",
"(",
"tsi",
"==",
"null",
")",
"{",
"tsi",
"=",
"calcTableStats",
"(",
"ti",
",",
"tx",
")",
";",
"tableStats",
".",
"put",
"(",
"ti",
".",
"tableName",
"(",
")",
",",
"tsi",
")",
";",
"}",
"return",
"tsi",
";",
"}"
] | Returns the statistical information about the specified table.
@param ti
the table's metadata
@param tx
the calling transaction
@return the statistical information about the table | [
"Returns",
"the",
"statistical",
"information",
"about",
"the",
"specified",
"table",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java#L79-L94 |
139,948 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/log/LogIterator.java | LogIterator.hasNext | @Override
public boolean hasNext() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
return currentRec > 0 || blk.number() > 0;
} | java | @Override
public boolean hasNext() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
return currentRec > 0 || blk.number() > 0;
} | [
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"if",
"(",
"!",
"isForward",
")",
"{",
"currentRec",
"=",
"currentRec",
"-",
"pointerSize",
";",
"isForward",
"=",
"true",
";",
"}",
"return",
"currentRec",
">",
"0",
"||",
"blk",
".",
"number",
"(",
")",
">",
"0",
";",
"}"
] | Determines if the current log record is the earliest record in the log
file.
@return true if there is an earlier record | [
"Determines",
"if",
"the",
"current",
"log",
"record",
"is",
"the",
"earliest",
"record",
"in",
"the",
"log",
"file",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/LogIterator.java#L57-L64 |
139,949 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/log/LogIterator.java | LogIterator.next | @Override
public BasicLogRecord next() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
if (currentRec == 0)
moveToNextBlock();
currentRec = (Integer) pg.getVal(currentRec, INTEGER).asJavaVal();
return new BasicLogRecord(pg, new LogSeqNum(blk.number(), currentRec + pointerSize * 2));
} | java | @Override
public BasicLogRecord next() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
if (currentRec == 0)
moveToNextBlock();
currentRec = (Integer) pg.getVal(currentRec, INTEGER).asJavaVal();
return new BasicLogRecord(pg, new LogSeqNum(blk.number(), currentRec + pointerSize * 2));
} | [
"@",
"Override",
"public",
"BasicLogRecord",
"next",
"(",
")",
"{",
"if",
"(",
"!",
"isForward",
")",
"{",
"currentRec",
"=",
"currentRec",
"-",
"pointerSize",
";",
"isForward",
"=",
"true",
";",
"}",
"if",
"(",
"currentRec",
"==",
"0",
")",
"moveToNextBlock",
"(",
")",
";",
"currentRec",
"=",
"(",
"Integer",
")",
"pg",
".",
"getVal",
"(",
"currentRec",
",",
"INTEGER",
")",
".",
"asJavaVal",
"(",
")",
";",
"return",
"new",
"BasicLogRecord",
"(",
"pg",
",",
"new",
"LogSeqNum",
"(",
"blk",
".",
"number",
"(",
")",
",",
"currentRec",
"+",
"pointerSize",
"*",
"2",
")",
")",
";",
"}"
] | Moves to the next log record in reverse order. If the current log record
is the earliest in its block, then the method moves to the next oldest
block, and returns the log record from there.
@return the next earliest log record | [
"Moves",
"to",
"the",
"next",
"log",
"record",
"in",
"reverse",
"order",
".",
"If",
"the",
"current",
"log",
"record",
"is",
"the",
"earliest",
"in",
"its",
"block",
"then",
"the",
"method",
"moves",
"to",
"the",
"next",
"oldest",
"block",
"and",
"returns",
"the",
"log",
"record",
"from",
"there",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/LogIterator.java#L73-L83 |
139,950 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/log/LogIterator.java | LogIterator.moveToNextBlock | private void moveToNextBlock() {
blk = new BlockId(blk.fileName(), blk.number() - 1);
pg.read(blk);
currentRec = (Integer) pg.getVal(LogMgr.LAST_POS, INTEGER).asJavaVal();
} | java | private void moveToNextBlock() {
blk = new BlockId(blk.fileName(), blk.number() - 1);
pg.read(blk);
currentRec = (Integer) pg.getVal(LogMgr.LAST_POS, INTEGER).asJavaVal();
} | [
"private",
"void",
"moveToNextBlock",
"(",
")",
"{",
"blk",
"=",
"new",
"BlockId",
"(",
"blk",
".",
"fileName",
"(",
")",
",",
"blk",
".",
"number",
"(",
")",
"-",
"1",
")",
";",
"pg",
".",
"read",
"(",
"blk",
")",
";",
"currentRec",
"=",
"(",
"Integer",
")",
"pg",
".",
"getVal",
"(",
"LogMgr",
".",
"LAST_POS",
",",
"INTEGER",
")",
".",
"asJavaVal",
"(",
")",
";",
"}"
] | Moves to the next log block in reverse order, and positions it after the
last record in that block. | [
"Moves",
"to",
"the",
"next",
"log",
"block",
"in",
"reverse",
"order",
"and",
"positions",
"it",
"after",
"the",
"last",
"record",
"in",
"that",
"block",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/LogIterator.java#L121-L125 |
139,951 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/log/LogIterator.java | LogIterator.moveToPrevBlock | private void moveToPrevBlock() {
blk = new BlockId(blk.fileName(), blk.number() + 1);
pg.read(blk);
currentRec = 0 + pointerSize;
} | java | private void moveToPrevBlock() {
blk = new BlockId(blk.fileName(), blk.number() + 1);
pg.read(blk);
currentRec = 0 + pointerSize;
} | [
"private",
"void",
"moveToPrevBlock",
"(",
")",
"{",
"blk",
"=",
"new",
"BlockId",
"(",
"blk",
".",
"fileName",
"(",
")",
",",
"blk",
".",
"number",
"(",
")",
"+",
"1",
")",
";",
"pg",
".",
"read",
"(",
"blk",
")",
";",
"currentRec",
"=",
"0",
"+",
"pointerSize",
";",
"}"
] | Moves to the previous log block in reverse order, and positions it after
the last record in that block. | [
"Moves",
"to",
"the",
"previous",
"log",
"block",
"in",
"reverse",
"order",
"and",
"positions",
"it",
"after",
"the",
"last",
"record",
"in",
"that",
"block",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/LogIterator.java#L131-L135 |
139,952 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/predicate/BinaryArithmeticExpression.java | BinaryArithmeticExpression.evaluate | @Override
public Constant evaluate(Record rec) {
return op.evaluate(lhs, rhs, rec);
} | java | @Override
public Constant evaluate(Record rec) {
return op.evaluate(lhs, rhs, rec);
} | [
"@",
"Override",
"public",
"Constant",
"evaluate",
"(",
"Record",
"rec",
")",
"{",
"return",
"op",
".",
"evaluate",
"(",
"lhs",
",",
"rhs",
",",
"rec",
")",
";",
"}"
] | Evaluates the arithmetic expression by computing on the values from the
record.
@see Expression#evaluate(Record) | [
"Evaluates",
"the",
"arithmetic",
"expression",
"by",
"computing",
"on",
"the",
"values",
"from",
"the",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/BinaryArithmeticExpression.java#L148-L151 |
139,953 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/predicate/BinaryArithmeticExpression.java | BinaryArithmeticExpression.isApplicableTo | @Override
public boolean isApplicableTo(Schema sch) {
return lhs.isApplicableTo(sch) && rhs.isApplicableTo(sch);
} | java | @Override
public boolean isApplicableTo(Schema sch) {
return lhs.isApplicableTo(sch) && rhs.isApplicableTo(sch);
} | [
"@",
"Override",
"public",
"boolean",
"isApplicableTo",
"(",
"Schema",
"sch",
")",
"{",
"return",
"lhs",
".",
"isApplicableTo",
"(",
"sch",
")",
"&&",
"rhs",
".",
"isApplicableTo",
"(",
"sch",
")",
";",
"}"
] | Returns true if both expressions are in the specified schema.
@see Expression#isApplicableTo(Schema) | [
"Returns",
"true",
"if",
"both",
"expressions",
"are",
"in",
"the",
"specified",
"schema",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/BinaryArithmeticExpression.java#L158-L161 |
139,954 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.formatFileHeader | public static void formatFileHeader(String fileName, Transaction tx) {
tx.concurrencyMgr().modifyFile(fileName);
// header should be the first block of the given file
if (VanillaDb.fileMgr().size(fileName) == 0) {
FileHeaderFormatter fhf = new FileHeaderFormatter();
Buffer buff = tx.bufferMgr().pinNew(fileName, fhf);
tx.bufferMgr().unpin(buff);
}
} | java | public static void formatFileHeader(String fileName, Transaction tx) {
tx.concurrencyMgr().modifyFile(fileName);
// header should be the first block of the given file
if (VanillaDb.fileMgr().size(fileName) == 0) {
FileHeaderFormatter fhf = new FileHeaderFormatter();
Buffer buff = tx.bufferMgr().pinNew(fileName, fhf);
tx.bufferMgr().unpin(buff);
}
} | [
"public",
"static",
"void",
"formatFileHeader",
"(",
"String",
"fileName",
",",
"Transaction",
"tx",
")",
"{",
"tx",
".",
"concurrencyMgr",
"(",
")",
".",
"modifyFile",
"(",
"fileName",
")",
";",
"// header should be the first block of the given file\r",
"if",
"(",
"VanillaDb",
".",
"fileMgr",
"(",
")",
".",
"size",
"(",
"fileName",
")",
"==",
"0",
")",
"{",
"FileHeaderFormatter",
"fhf",
"=",
"new",
"FileHeaderFormatter",
"(",
")",
";",
"Buffer",
"buff",
"=",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"pinNew",
"(",
"fileName",
",",
"fhf",
")",
";",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"unpin",
"(",
"buff",
")",
";",
"}",
"}"
] | Format the header of specified file.
@param fileName
the file name
@param tx
the transaction | [
"Format",
"the",
"header",
"of",
"specified",
"file",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L83-L91 |
139,955 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.next | public boolean next() {
if (currentBlkNum == 0 && !moveTo(1))
return false;
while (true) {
if (rp.next())
return true;
if (!moveTo(currentBlkNum + 1))
return false;
}
} | java | public boolean next() {
if (currentBlkNum == 0 && !moveTo(1))
return false;
while (true) {
if (rp.next())
return true;
if (!moveTo(currentBlkNum + 1))
return false;
}
} | [
"public",
"boolean",
"next",
"(",
")",
"{",
"if",
"(",
"currentBlkNum",
"==",
"0",
"&&",
"!",
"moveTo",
"(",
"1",
")",
")",
"return",
"false",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"rp",
".",
"next",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"!",
"moveTo",
"(",
"currentBlkNum",
"+",
"1",
")",
")",
"return",
"false",
";",
"}",
"}"
] | Moves to the next record. Returns false if there is no next record.
@return false if there is no next record. | [
"Moves",
"to",
"the",
"next",
"record",
".",
"Returns",
"false",
"if",
"there",
"is",
"no",
"next",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L126-L135 |
139,956 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.setVal | public void setVal(String fldName, Constant val) {
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
Type fldType = ti.schema().type(fldName);
Constant v = val.castTo(fldType);
if (Page.size(v) > Page.maxSize(fldType))
throw new SchemaIncompatibleException();
rp.setVal(fldName, v);
} | java | public void setVal(String fldName, Constant val) {
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
Type fldType = ti.schema().type(fldName);
Constant v = val.castTo(fldType);
if (Page.size(v) > Page.maxSize(fldType))
throw new SchemaIncompatibleException();
rp.setVal(fldName, v);
} | [
"public",
"void",
"setVal",
"(",
"String",
"fldName",
",",
"Constant",
"val",
")",
"{",
"if",
"(",
"tx",
".",
"isReadOnly",
"(",
")",
"&&",
"!",
"isTempTable",
"(",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"Type",
"fldType",
"=",
"ti",
".",
"schema",
"(",
")",
".",
"type",
"(",
"fldName",
")",
";",
"Constant",
"v",
"=",
"val",
".",
"castTo",
"(",
"fldType",
")",
";",
"if",
"(",
"Page",
".",
"size",
"(",
"v",
")",
">",
"Page",
".",
"maxSize",
"(",
"fldType",
")",
")",
"throw",
"new",
"SchemaIncompatibleException",
"(",
")",
";",
"rp",
".",
"setVal",
"(",
"fldName",
",",
"v",
")",
";",
"}"
] | Sets a value of the specified field in the current record. The type of
the value must be equal to that of the specified field.
@param fldName
the name of the field
@param val
the new value for the field | [
"Sets",
"a",
"value",
"of",
"the",
"specified",
"field",
"in",
"the",
"current",
"record",
".",
"The",
"type",
"of",
"the",
"value",
"must",
"be",
"equal",
"to",
"that",
"of",
"the",
"specified",
"field",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L159-L168 |
139,957 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.insert | public void insert() {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileName);
// Modify the free chain which is start from a pointer in
// the header of the file.
if (fhp == null)
fhp = openHeaderForModification();
// Log that this logical operation starts
tx.recoveryMgr().logLogicalStart();
if (fhp.hasDeletedSlots()) {
// Insert into a deleted slot
moveToRecordId(fhp.getLastDeletedSlot());
RecordId lds = rp.insertIntoDeletedSlot();
fhp.setLastDeletedSlot(lds);
} else {
// Insert into a empty slot
if (!fhp.hasDataRecords()) { // no record inserted before
// Create the first data block
appendBlock();
moveTo(1);
rp.insertIntoNextEmptySlot();
} else {
// Find the tail page
RecordId tailSlot = fhp.getTailSolt();
moveToRecordId(tailSlot);
while (!rp.insertIntoNextEmptySlot()) {
if (atLastBlock())
appendBlock();
moveTo(currentBlkNum + 1);
}
}
fhp.setTailSolt(currentRecordId());
}
// Log that this logical operation ends
RecordId insertedRid = currentRecordId();
tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), insertedRid.block().number(), insertedRid.id());
// Close the header (release the header lock)
closeHeader();
} | java | public void insert() {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileName);
// Modify the free chain which is start from a pointer in
// the header of the file.
if (fhp == null)
fhp = openHeaderForModification();
// Log that this logical operation starts
tx.recoveryMgr().logLogicalStart();
if (fhp.hasDeletedSlots()) {
// Insert into a deleted slot
moveToRecordId(fhp.getLastDeletedSlot());
RecordId lds = rp.insertIntoDeletedSlot();
fhp.setLastDeletedSlot(lds);
} else {
// Insert into a empty slot
if (!fhp.hasDataRecords()) { // no record inserted before
// Create the first data block
appendBlock();
moveTo(1);
rp.insertIntoNextEmptySlot();
} else {
// Find the tail page
RecordId tailSlot = fhp.getTailSolt();
moveToRecordId(tailSlot);
while (!rp.insertIntoNextEmptySlot()) {
if (atLastBlock())
appendBlock();
moveTo(currentBlkNum + 1);
}
}
fhp.setTailSolt(currentRecordId());
}
// Log that this logical operation ends
RecordId insertedRid = currentRecordId();
tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), insertedRid.block().number(), insertedRid.id());
// Close the header (release the header lock)
closeHeader();
} | [
"public",
"void",
"insert",
"(",
")",
"{",
"// Block read-only transaction\r",
"if",
"(",
"tx",
".",
"isReadOnly",
"(",
")",
"&&",
"!",
"isTempTable",
"(",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"// Insertion may change the properties of this file,\r",
"// so that we need to lock the file.\r",
"if",
"(",
"!",
"isTempTable",
"(",
")",
")",
"tx",
".",
"concurrencyMgr",
"(",
")",
".",
"modifyFile",
"(",
"fileName",
")",
";",
"// Modify the free chain which is start from a pointer in\r",
"// the header of the file.\r",
"if",
"(",
"fhp",
"==",
"null",
")",
"fhp",
"=",
"openHeaderForModification",
"(",
")",
";",
"// Log that this logical operation starts\r",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logLogicalStart",
"(",
")",
";",
"if",
"(",
"fhp",
".",
"hasDeletedSlots",
"(",
")",
")",
"{",
"// Insert into a deleted slot\r",
"moveToRecordId",
"(",
"fhp",
".",
"getLastDeletedSlot",
"(",
")",
")",
";",
"RecordId",
"lds",
"=",
"rp",
".",
"insertIntoDeletedSlot",
"(",
")",
";",
"fhp",
".",
"setLastDeletedSlot",
"(",
"lds",
")",
";",
"}",
"else",
"{",
"// Insert into a empty slot\r",
"if",
"(",
"!",
"fhp",
".",
"hasDataRecords",
"(",
")",
")",
"{",
"// no record inserted before\r",
"// Create the first data block\r",
"appendBlock",
"(",
")",
";",
"moveTo",
"(",
"1",
")",
";",
"rp",
".",
"insertIntoNextEmptySlot",
"(",
")",
";",
"}",
"else",
"{",
"// Find the tail page\r",
"RecordId",
"tailSlot",
"=",
"fhp",
".",
"getTailSolt",
"(",
")",
";",
"moveToRecordId",
"(",
"tailSlot",
")",
";",
"while",
"(",
"!",
"rp",
".",
"insertIntoNextEmptySlot",
"(",
")",
")",
"{",
"if",
"(",
"atLastBlock",
"(",
")",
")",
"appendBlock",
"(",
")",
";",
"moveTo",
"(",
"currentBlkNum",
"+",
"1",
")",
";",
"}",
"}",
"fhp",
".",
"setTailSolt",
"(",
"currentRecordId",
"(",
")",
")",
";",
"}",
"// Log that this logical operation ends\r",
"RecordId",
"insertedRid",
"=",
"currentRecordId",
"(",
")",
";",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logRecordFileInsertionEnd",
"(",
"ti",
".",
"tableName",
"(",
")",
",",
"insertedRid",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
",",
"insertedRid",
".",
"id",
"(",
")",
")",
";",
"// Close the header (release the header lock)\r",
"closeHeader",
"(",
")",
";",
"}"
] | Inserts a new, blank record somewhere in the file beginning at the
current record. If the new record does not fit into an existing block,
then a new block is appended to the file. | [
"Inserts",
"a",
"new",
"blank",
"record",
"somewhere",
"in",
"the",
"file",
"beginning",
"at",
"the",
"current",
"record",
".",
"If",
"the",
"new",
"record",
"does",
"not",
"fit",
"into",
"an",
"existing",
"block",
"then",
"a",
"new",
"block",
"is",
"appended",
"to",
"the",
"file",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L215-L264 |
139,958 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.insert | public void insert(RecordId rid) {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileName);
// Open the header
if (fhp == null)
fhp = openHeaderForModification();
// Log that this logical operation starts
tx.recoveryMgr().logLogicalStart();
// Mark the specified slot as in used
moveToRecordId(rid);
if (!rp.insertIntoTheCurrentSlot())
throw new RuntimeException("the specified slot: " + rid + " is in used");
// Traverse the free chain to find the specified slot
RecordId lastSlot = null;
RecordId currentSlot = fhp.getLastDeletedSlot();
while (!currentSlot.equals(rid) && currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
moveToRecordId(currentSlot);
lastSlot = currentSlot;
currentSlot = rp.getNextDeletedSlotId();
}
// Remove the specified slot from the chain
// If it is the first slot
if (lastSlot == null) {
moveToRecordId(currentSlot);
fhp.setLastDeletedSlot(rp.getNextDeletedSlotId());
// If it is in the middle
} else if (currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
moveToRecordId(currentSlot);
RecordId nextSlot = rp.getNextDeletedSlotId();
moveToRecordId(lastSlot);
rp.setNextDeletedSlotId(nextSlot);
}
// Log that this logical operation ends
tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), rid.block().number(), rid.id());
// Close the header (release the header lock)
closeHeader();
} | java | public void insert(RecordId rid) {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileName);
// Open the header
if (fhp == null)
fhp = openHeaderForModification();
// Log that this logical operation starts
tx.recoveryMgr().logLogicalStart();
// Mark the specified slot as in used
moveToRecordId(rid);
if (!rp.insertIntoTheCurrentSlot())
throw new RuntimeException("the specified slot: " + rid + " is in used");
// Traverse the free chain to find the specified slot
RecordId lastSlot = null;
RecordId currentSlot = fhp.getLastDeletedSlot();
while (!currentSlot.equals(rid) && currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
moveToRecordId(currentSlot);
lastSlot = currentSlot;
currentSlot = rp.getNextDeletedSlotId();
}
// Remove the specified slot from the chain
// If it is the first slot
if (lastSlot == null) {
moveToRecordId(currentSlot);
fhp.setLastDeletedSlot(rp.getNextDeletedSlotId());
// If it is in the middle
} else if (currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
moveToRecordId(currentSlot);
RecordId nextSlot = rp.getNextDeletedSlotId();
moveToRecordId(lastSlot);
rp.setNextDeletedSlotId(nextSlot);
}
// Log that this logical operation ends
tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), rid.block().number(), rid.id());
// Close the header (release the header lock)
closeHeader();
} | [
"public",
"void",
"insert",
"(",
"RecordId",
"rid",
")",
"{",
"// Block read-only transaction\r",
"if",
"(",
"tx",
".",
"isReadOnly",
"(",
")",
"&&",
"!",
"isTempTable",
"(",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"// Insertion may change the properties of this file,\r",
"// so that we need to lock the file.\r",
"if",
"(",
"!",
"isTempTable",
"(",
")",
")",
"tx",
".",
"concurrencyMgr",
"(",
")",
".",
"modifyFile",
"(",
"fileName",
")",
";",
"// Open the header\r",
"if",
"(",
"fhp",
"==",
"null",
")",
"fhp",
"=",
"openHeaderForModification",
"(",
")",
";",
"// Log that this logical operation starts\r",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logLogicalStart",
"(",
")",
";",
"// Mark the specified slot as in used\r",
"moveToRecordId",
"(",
"rid",
")",
";",
"if",
"(",
"!",
"rp",
".",
"insertIntoTheCurrentSlot",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"the specified slot: \"",
"+",
"rid",
"+",
"\" is in used\"",
")",
";",
"// Traverse the free chain to find the specified slot\r",
"RecordId",
"lastSlot",
"=",
"null",
";",
"RecordId",
"currentSlot",
"=",
"fhp",
".",
"getLastDeletedSlot",
"(",
")",
";",
"while",
"(",
"!",
"currentSlot",
".",
"equals",
"(",
"rid",
")",
"&&",
"currentSlot",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
"!=",
"FileHeaderPage",
".",
"NO_SLOT_BLOCKID",
")",
"{",
"moveToRecordId",
"(",
"currentSlot",
")",
";",
"lastSlot",
"=",
"currentSlot",
";",
"currentSlot",
"=",
"rp",
".",
"getNextDeletedSlotId",
"(",
")",
";",
"}",
"// Remove the specified slot from the chain\r",
"// If it is the first slot\r",
"if",
"(",
"lastSlot",
"==",
"null",
")",
"{",
"moveToRecordId",
"(",
"currentSlot",
")",
";",
"fhp",
".",
"setLastDeletedSlot",
"(",
"rp",
".",
"getNextDeletedSlotId",
"(",
")",
")",
";",
"// If it is in the middle\r",
"}",
"else",
"if",
"(",
"currentSlot",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
"!=",
"FileHeaderPage",
".",
"NO_SLOT_BLOCKID",
")",
"{",
"moveToRecordId",
"(",
"currentSlot",
")",
";",
"RecordId",
"nextSlot",
"=",
"rp",
".",
"getNextDeletedSlotId",
"(",
")",
";",
"moveToRecordId",
"(",
"lastSlot",
")",
";",
"rp",
".",
"setNextDeletedSlotId",
"(",
"nextSlot",
")",
";",
"}",
"// Log that this logical operation ends\r",
"tx",
".",
"recoveryMgr",
"(",
")",
".",
"logRecordFileInsertionEnd",
"(",
"ti",
".",
"tableName",
"(",
")",
",",
"rid",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
",",
"rid",
".",
"id",
"(",
")",
")",
";",
"// Close the header (release the header lock)\r",
"closeHeader",
"(",
")",
";",
"}"
] | Inserts a record to a specified physical address.
@param rid
the address a record will be inserted | [
"Inserts",
"a",
"record",
"to",
"a",
"specified",
"physical",
"address",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L272-L322 |
139,959 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.moveToRecordId | public void moveToRecordId(RecordId rid) {
moveTo(rid.block().number());
rp.moveToId(rid.id());
} | java | public void moveToRecordId(RecordId rid) {
moveTo(rid.block().number());
rp.moveToId(rid.id());
} | [
"public",
"void",
"moveToRecordId",
"(",
"RecordId",
"rid",
")",
"{",
"moveTo",
"(",
"rid",
".",
"block",
"(",
")",
".",
"number",
"(",
")",
")",
";",
"rp",
".",
"moveToId",
"(",
"rid",
".",
"id",
"(",
")",
")",
";",
"}"
] | Positions the current record as indicated by the specified record ID .
@param rid
a record ID | [
"Positions",
"the",
"current",
"record",
"as",
"indicated",
"by",
"the",
"specified",
"record",
"ID",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L330-L333 |
139,960 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/RecordFile.java | RecordFile.currentRecordId | public RecordId currentRecordId() {
int id = rp.currentId();
return new RecordId(new BlockId(fileName, currentBlkNum), id);
} | java | public RecordId currentRecordId() {
int id = rp.currentId();
return new RecordId(new BlockId(fileName, currentBlkNum), id);
} | [
"public",
"RecordId",
"currentRecordId",
"(",
")",
"{",
"int",
"id",
"=",
"rp",
".",
"currentId",
"(",
")",
";",
"return",
"new",
"RecordId",
"(",
"new",
"BlockId",
"(",
"fileName",
",",
"currentBlkNum",
")",
",",
"id",
")",
";",
"}"
] | Returns the record ID of the current record.
@return a record ID | [
"Returns",
"the",
"record",
"ID",
"of",
"the",
"current",
"record",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L340-L343 |
139,961 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/predicate/Term.java | Term.operator | public Operator operator(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName))
return op;
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName))
return op.complement();
return null;
} | java | public Operator operator(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName))
return op;
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName))
return op.complement();
return null;
} | [
"public",
"Operator",
"operator",
"(",
"String",
"fldName",
")",
"{",
"if",
"(",
"lhs",
".",
"isFieldName",
"(",
")",
"&&",
"lhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
")",
"return",
"op",
";",
"if",
"(",
"rhs",
".",
"isFieldName",
"(",
")",
"&&",
"rhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
")",
"return",
"op",
".",
"complement",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Determines if this term is of the form "F<OP>E" where F is the
specified field, <OP> is an operator, and E is an expression. If
so, the method returns <OP>. If not, the method returns null.
@param fldName
the name of the field
@return either the operator or null | [
"Determines",
"if",
"this",
"term",
"is",
"of",
"the",
"form",
"F<",
";",
"OP>",
";",
"E",
"where",
"F",
"is",
"the",
"specified",
"field",
"<",
";",
"OP>",
";",
"is",
"an",
"operator",
"and",
"E",
"is",
"an",
"expression",
".",
"If",
"so",
"the",
"method",
"returns",
"<",
";",
"OP>",
";",
".",
"If",
"not",
"the",
"method",
"returns",
"null",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L135-L141 |
139,962 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/predicate/Term.java | Term.oppositeConstant | public Constant oppositeConstant(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isConstant())
return rhs.asConstant();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isConstant())
return lhs.asConstant();
return null;
} | java | public Constant oppositeConstant(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isConstant())
return rhs.asConstant();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isConstant())
return lhs.asConstant();
return null;
} | [
"public",
"Constant",
"oppositeConstant",
"(",
"String",
"fldName",
")",
"{",
"if",
"(",
"lhs",
".",
"isFieldName",
"(",
")",
"&&",
"lhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
"&&",
"rhs",
".",
"isConstant",
"(",
")",
")",
"return",
"rhs",
".",
"asConstant",
"(",
")",
";",
"if",
"(",
"rhs",
".",
"isFieldName",
"(",
")",
"&&",
"rhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
"&&",
"lhs",
".",
"isConstant",
"(",
")",
")",
"return",
"lhs",
".",
"asConstant",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Determines if this term is of the form "F<OP>C" where F is the
specified field, <OP> is an operator, and C is some constant. If
so, the method returns C. If not, the method returns null.
@param fldName
the name of the field
@return either the constant or null | [
"Determines",
"if",
"this",
"term",
"is",
"of",
"the",
"form",
"F<",
";",
"OP>",
";",
"C",
"where",
"F",
"is",
"the",
"specified",
"field",
"<",
";",
"OP>",
";",
"is",
"an",
"operator",
"and",
"C",
"is",
"some",
"constant",
".",
"If",
"so",
"the",
"method",
"returns",
"C",
".",
"If",
"not",
"the",
"method",
"returns",
"null",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L152-L160 |
139,963 | vanilladb/vanillacore | src/main/java/org/vanilladb/core/sql/predicate/Term.java | Term.oppositeField | public String oppositeField(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isFieldName())
return rhs.asFieldName();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isFieldName())
return lhs.asFieldName();
return null;
} | java | public String oppositeField(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isFieldName())
return rhs.asFieldName();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isFieldName())
return lhs.asFieldName();
return null;
} | [
"public",
"String",
"oppositeField",
"(",
"String",
"fldName",
")",
"{",
"if",
"(",
"lhs",
".",
"isFieldName",
"(",
")",
"&&",
"lhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
"&&",
"rhs",
".",
"isFieldName",
"(",
")",
")",
"return",
"rhs",
".",
"asFieldName",
"(",
")",
";",
"if",
"(",
"rhs",
".",
"isFieldName",
"(",
")",
"&&",
"rhs",
".",
"asFieldName",
"(",
")",
".",
"equals",
"(",
"fldName",
")",
"&&",
"lhs",
".",
"isFieldName",
"(",
")",
")",
"return",
"lhs",
".",
"asFieldName",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Determines if this term is of the form "F1<OP>F2" where F1 is the
specified field, <OP> is an operator, and F2 is another field. If
so, the method returns F2. If not, the method returns null.
@param fldName
the name of F1
@return either the name of the other field, or null | [
"Determines",
"if",
"this",
"term",
"is",
"of",
"the",
"form",
"F1<",
";",
"OP>",
";",
"F2",
"where",
"F1",
"is",
"the",
"specified",
"field",
"<",
";",
"OP>",
";",
"is",
"an",
"operator",
"and",
"F2",
"is",
"another",
"field",
".",
"If",
"so",
"the",
"method",
"returns",
"F2",
".",
"If",
"not",
"the",
"method",
"returns",
"null",
"."
] | d9a34e876b1b83226036d1fa982a614bbef59bd1 | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L171-L179 |
139,964 | qiniu/happy-dns-java | src/main/java/qiniu/happydns/local/Hosts.java | Hosts.putAllInRandomOrder | public synchronized Hosts putAllInRandomOrder(String domain, String[] ips) {
Random random = new Random();
int index = (int) (random.nextLong() % ips.length);
if (index < 0) {
index += ips.length;
}
LinkedList<String> ipList = new LinkedList<String>();
for (int i = 0; i < ips.length; i++) {
ipList.add(ips[(i + index) % ips.length]);
}
hosts.put(domain, ipList);
return this;
} | java | public synchronized Hosts putAllInRandomOrder(String domain, String[] ips) {
Random random = new Random();
int index = (int) (random.nextLong() % ips.length);
if (index < 0) {
index += ips.length;
}
LinkedList<String> ipList = new LinkedList<String>();
for (int i = 0; i < ips.length; i++) {
ipList.add(ips[(i + index) % ips.length]);
}
hosts.put(domain, ipList);
return this;
} | [
"public",
"synchronized",
"Hosts",
"putAllInRandomOrder",
"(",
"String",
"domain",
",",
"String",
"[",
"]",
"ips",
")",
"{",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"int",
"index",
"=",
"(",
"int",
")",
"(",
"random",
".",
"nextLong",
"(",
")",
"%",
"ips",
".",
"length",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"index",
"+=",
"ips",
".",
"length",
";",
"}",
"LinkedList",
"<",
"String",
">",
"ipList",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ips",
".",
"length",
";",
"i",
"++",
")",
"{",
"ipList",
".",
"add",
"(",
"ips",
"[",
"(",
"i",
"+",
"index",
")",
"%",
"ips",
".",
"length",
"]",
")",
";",
"}",
"hosts",
".",
"put",
"(",
"domain",
",",
"ipList",
")",
";",
"return",
"this",
";",
"}"
] | avoid many server visit first ip in same time.s
@param domain 域名
@param ips IP 列表
@return 当前host 实例 | [
"avoid",
"many",
"server",
"visit",
"first",
"ip",
"in",
"same",
"time",
".",
"s"
] | 2900e918d6f9609371a073780224eff170a0d499 | https://github.com/qiniu/happy-dns-java/blob/2900e918d6f9609371a073780224eff170a0d499/src/main/java/qiniu/happydns/local/Hosts.java#L49-L61 |
139,965 | qiniu/happy-dns-java | src/main/java/qiniu/happydns/local/SystemDnsServer.java | SystemDnsServer.getByInternalAPI | public static String[] getByInternalAPI() {
try {
Class<?> resolverConfiguration =
Class.forName("sun.net.dns.ResolverConfiguration");
Method open = resolverConfiguration.getMethod("open");
Method getNameservers = resolverConfiguration.getMethod("nameservers");
Object instance = open.invoke(null);
List nameservers = (List) getNameservers.invoke(instance);
if (nameservers == null || nameservers.size() == 0) {
return null;
}
String[] ret = new String[nameservers.size()];
int i = 0;
for (Object dns : nameservers) {
ret[i++] = (String) dns;
}
return ret;
} catch (Exception e) {
// we might trigger some problems this way
e.printStackTrace();
}
return null;
} | java | public static String[] getByInternalAPI() {
try {
Class<?> resolverConfiguration =
Class.forName("sun.net.dns.ResolverConfiguration");
Method open = resolverConfiguration.getMethod("open");
Method getNameservers = resolverConfiguration.getMethod("nameservers");
Object instance = open.invoke(null);
List nameservers = (List) getNameservers.invoke(instance);
if (nameservers == null || nameservers.size() == 0) {
return null;
}
String[] ret = new String[nameservers.size()];
int i = 0;
for (Object dns : nameservers) {
ret[i++] = (String) dns;
}
return ret;
} catch (Exception e) {
// we might trigger some problems this way
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"String",
"[",
"]",
"getByInternalAPI",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"resolverConfiguration",
"=",
"Class",
".",
"forName",
"(",
"\"sun.net.dns.ResolverConfiguration\"",
")",
";",
"Method",
"open",
"=",
"resolverConfiguration",
".",
"getMethod",
"(",
"\"open\"",
")",
";",
"Method",
"getNameservers",
"=",
"resolverConfiguration",
".",
"getMethod",
"(",
"\"nameservers\"",
")",
";",
"Object",
"instance",
"=",
"open",
".",
"invoke",
"(",
"null",
")",
";",
"List",
"nameservers",
"=",
"(",
"List",
")",
"getNameservers",
".",
"invoke",
"(",
"instance",
")",
";",
"if",
"(",
"nameservers",
"==",
"null",
"||",
"nameservers",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"ret",
"=",
"new",
"String",
"[",
"nameservers",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Object",
"dns",
":",
"nameservers",
")",
"{",
"ret",
"[",
"i",
"++",
"]",
"=",
"(",
"String",
")",
"dns",
";",
"}",
"return",
"ret",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// we might trigger some problems this way",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | has 300s latency when system resolv change | [
"has",
"300s",
"latency",
"when",
"system",
"resolv",
"change"
] | 2900e918d6f9609371a073780224eff170a0d499 | https://github.com/qiniu/happy-dns-java/blob/2900e918d6f9609371a073780224eff170a0d499/src/main/java/qiniu/happydns/local/SystemDnsServer.java#L53-L75 |
139,966 | qiniu/happy-dns-java | src/main/java/qiniu/happydns/local/SystemDnsServer.java | SystemDnsServer.defaultResolver | public static IResolver defaultResolver() {
return new IResolver() {
@Override
public Record[] resolve(Domain domain) throws IOException {
String[] addresses = defaultServer();
if (addresses == null) {
throw new IOException("no dns server");
}
IResolver resolver = new Resolver(InetAddress.getByName(addresses[0]));
return resolver.resolve(domain);
}
};
} | java | public static IResolver defaultResolver() {
return new IResolver() {
@Override
public Record[] resolve(Domain domain) throws IOException {
String[] addresses = defaultServer();
if (addresses == null) {
throw new IOException("no dns server");
}
IResolver resolver = new Resolver(InetAddress.getByName(addresses[0]));
return resolver.resolve(domain);
}
};
} | [
"public",
"static",
"IResolver",
"defaultResolver",
"(",
")",
"{",
"return",
"new",
"IResolver",
"(",
")",
"{",
"@",
"Override",
"public",
"Record",
"[",
"]",
"resolve",
"(",
"Domain",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"addresses",
"=",
"defaultServer",
"(",
")",
";",
"if",
"(",
"addresses",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"no dns server\"",
")",
";",
"}",
"IResolver",
"resolver",
"=",
"new",
"Resolver",
"(",
"InetAddress",
".",
"getByName",
"(",
"addresses",
"[",
"0",
"]",
")",
")",
";",
"return",
"resolver",
".",
"resolve",
"(",
"domain",
")",
";",
"}",
"}",
";",
"}"
] | system ip would change | [
"system",
"ip",
"would",
"change"
] | 2900e918d6f9609371a073780224eff170a0d499 | https://github.com/qiniu/happy-dns-java/blob/2900e918d6f9609371a073780224eff170a0d499/src/main/java/qiniu/happydns/local/SystemDnsServer.java#L125-L137 |
139,967 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeAssocBean | void writeAssocBean() throws IOException {
writingAssocBean = true;
origDestPackage = destPackage;
destPackage = destPackage + ".assoc";
origShortName = shortName;
shortName = "Assoc" + shortName;
prepareAssocBeanImports();
writer = new Append(createFileWriter());
writePackage();
writeImports();
writeClass();
writeFields();
writeConstructors();
writeClassEnd();
writer.close();
} | java | void writeAssocBean() throws IOException {
writingAssocBean = true;
origDestPackage = destPackage;
destPackage = destPackage + ".assoc";
origShortName = shortName;
shortName = "Assoc" + shortName;
prepareAssocBeanImports();
writer = new Append(createFileWriter());
writePackage();
writeImports();
writeClass();
writeFields();
writeConstructors();
writeClassEnd();
writer.close();
} | [
"void",
"writeAssocBean",
"(",
")",
"throws",
"IOException",
"{",
"writingAssocBean",
"=",
"true",
";",
"origDestPackage",
"=",
"destPackage",
";",
"destPackage",
"=",
"destPackage",
"+",
"\".assoc\"",
";",
"origShortName",
"=",
"shortName",
";",
"shortName",
"=",
"\"Assoc\"",
"+",
"shortName",
";",
"prepareAssocBeanImports",
"(",
")",
";",
"writer",
"=",
"new",
"Append",
"(",
"createFileWriter",
"(",
")",
")",
";",
"writePackage",
"(",
")",
";",
"writeImports",
"(",
")",
";",
"writeClass",
"(",
")",
";",
"writeFields",
"(",
")",
";",
"writeConstructors",
"(",
")",
";",
"writeClassEnd",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}"
] | Write the type query assoc bean. | [
"Write",
"the",
"type",
"query",
"assoc",
"bean",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L132-L152 |
139,968 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.prepareAssocBeanImports | private void prepareAssocBeanImports() {
importTypes.remove(DB);
importTypes.remove(TQROOTBEAN);
importTypes.remove(DATABASE);
importTypes.add(TQASSOCBEAN);
if (isEntity()) {
importTypes.add(TQPROPERTY);
importTypes.add(origDestPackage + ".Q" + origShortName);
}
// remove imports for the same package
Iterator<String> importsIterator = importTypes.iterator();
String checkImportStart = destPackage + ".QAssoc";
while (importsIterator.hasNext()) {
String importType = importsIterator.next();
if (importType.startsWith(checkImportStart)) {
importsIterator.remove();
}
}
} | java | private void prepareAssocBeanImports() {
importTypes.remove(DB);
importTypes.remove(TQROOTBEAN);
importTypes.remove(DATABASE);
importTypes.add(TQASSOCBEAN);
if (isEntity()) {
importTypes.add(TQPROPERTY);
importTypes.add(origDestPackage + ".Q" + origShortName);
}
// remove imports for the same package
Iterator<String> importsIterator = importTypes.iterator();
String checkImportStart = destPackage + ".QAssoc";
while (importsIterator.hasNext()) {
String importType = importsIterator.next();
if (importType.startsWith(checkImportStart)) {
importsIterator.remove();
}
}
} | [
"private",
"void",
"prepareAssocBeanImports",
"(",
")",
"{",
"importTypes",
".",
"remove",
"(",
"DB",
")",
";",
"importTypes",
".",
"remove",
"(",
"TQROOTBEAN",
")",
";",
"importTypes",
".",
"remove",
"(",
"DATABASE",
")",
";",
"importTypes",
".",
"add",
"(",
"TQASSOCBEAN",
")",
";",
"if",
"(",
"isEntity",
"(",
")",
")",
"{",
"importTypes",
".",
"add",
"(",
"TQPROPERTY",
")",
";",
"importTypes",
".",
"add",
"(",
"origDestPackage",
"+",
"\".Q\"",
"+",
"origShortName",
")",
";",
"}",
"// remove imports for the same package",
"Iterator",
"<",
"String",
">",
"importsIterator",
"=",
"importTypes",
".",
"iterator",
"(",
")",
";",
"String",
"checkImportStart",
"=",
"destPackage",
"+",
"\".QAssoc\"",
";",
"while",
"(",
"importsIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"importType",
"=",
"importsIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"importType",
".",
"startsWith",
"(",
"checkImportStart",
")",
")",
"{",
"importsIterator",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}"
] | Prepare the imports for writing assoc bean. | [
"Prepare",
"the",
"imports",
"for",
"writing",
"assoc",
"bean",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L157-L177 |
139,969 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeRootBeanConstructor | private void writeRootBeanConstructor() throws IOException {
writer.eol();
writer.append(" /**").eol();
writer.append(" * Construct with a given Database.").eol();
writer.append(" */").eol();
writer.append(" public Q%s(Database server) {", shortName).eol();
writer.append(" super(%s.class, server);", shortName).eol();
writer.append(" }").eol();
writer.eol();
String name = (dbName == null) ? "default" : dbName;
writer.append(" /**").eol();
writer.append(" * Construct using the %s Database.", name).eol();
writer.append(" */").eol();
writer.append(" public Q%s() {", shortName).eol();
if (dbName == null) {
writer.append(" super(%s.class);", shortName).eol();
} else {
writer.append(" super(%s.class, DB.byName(\"%s\"));", shortName, dbName).eol();
}
writer.append(" }").eol();
writer.eol();
writer.append(" /**").eol();
writer.append(" * Construct for Alias.").eol();
writer.append(" */").eol();
writer.append(" private Q%s(boolean dummy) {", shortName).eol();
writer.append(" super(dummy);").eol();
writer.append(" }").eol();
} | java | private void writeRootBeanConstructor() throws IOException {
writer.eol();
writer.append(" /**").eol();
writer.append(" * Construct with a given Database.").eol();
writer.append(" */").eol();
writer.append(" public Q%s(Database server) {", shortName).eol();
writer.append(" super(%s.class, server);", shortName).eol();
writer.append(" }").eol();
writer.eol();
String name = (dbName == null) ? "default" : dbName;
writer.append(" /**").eol();
writer.append(" * Construct using the %s Database.", name).eol();
writer.append(" */").eol();
writer.append(" public Q%s() {", shortName).eol();
if (dbName == null) {
writer.append(" super(%s.class);", shortName).eol();
} else {
writer.append(" super(%s.class, DB.byName(\"%s\"));", shortName, dbName).eol();
}
writer.append(" }").eol();
writer.eol();
writer.append(" /**").eol();
writer.append(" * Construct for Alias.").eol();
writer.append(" */").eol();
writer.append(" private Q%s(boolean dummy) {", shortName).eol();
writer.append(" super(dummy);").eol();
writer.append(" }").eol();
} | [
"private",
"void",
"writeRootBeanConstructor",
"(",
")",
"throws",
"IOException",
"{",
"writer",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" /**\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * Construct with a given Database.\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" */\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" public Q%s(Database server) {\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" super(%s.class, server);\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" }\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"eol",
"(",
")",
";",
"String",
"name",
"=",
"(",
"dbName",
"==",
"null",
")",
"?",
"\"default\"",
":",
"dbName",
";",
"writer",
".",
"append",
"(",
"\" /**\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * Construct using the %s Database.\"",
",",
"name",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" */\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" public Q%s() {\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"if",
"(",
"dbName",
"==",
"null",
")",
"{",
"writer",
".",
"append",
"(",
"\" super(%s.class);\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"}",
"else",
"{",
"writer",
".",
"append",
"(",
"\" super(%s.class, DB.byName(\\\"%s\\\"));\"",
",",
"shortName",
",",
"dbName",
")",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"append",
"(",
"\" }\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" /**\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * Construct for Alias.\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" */\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" private Q%s(boolean dummy) {\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" super(dummy);\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" }\"",
")",
".",
"eol",
"(",
")",
";",
"}"
] | Write the constructors for 'root' type query bean. | [
"Write",
"the",
"constructors",
"for",
"root",
"type",
"query",
"bean",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L195-L225 |
139,970 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeAssocBeanConstructor | private void writeAssocBeanConstructor() {
writer.append(" public Q%s(String name, R root) {", shortName).eol();
writer.append(" super(name, root);").eol();
writer.append(" }").eol();
} | java | private void writeAssocBeanConstructor() {
writer.append(" public Q%s(String name, R root) {", shortName).eol();
writer.append(" super(name, root);").eol();
writer.append(" }").eol();
} | [
"private",
"void",
"writeAssocBeanConstructor",
"(",
")",
"{",
"writer",
".",
"append",
"(",
"\" public Q%s(String name, R root) {\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" super(name, root);\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" }\"",
")",
".",
"eol",
"(",
")",
";",
"}"
] | Write constructor for 'assoc' type query bean. | [
"Write",
"constructor",
"for",
"assoc",
"type",
"query",
"bean",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L251-L255 |
139,971 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeFields | private void writeFields() throws IOException {
for (PropertyMeta property : properties) {
property.writeFieldDefn(writer, shortName, writingAssocBean);
writer.eol();
}
writer.eol();
} | java | private void writeFields() throws IOException {
for (PropertyMeta property : properties) {
property.writeFieldDefn(writer, shortName, writingAssocBean);
writer.eol();
}
writer.eol();
} | [
"private",
"void",
"writeFields",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"PropertyMeta",
"property",
":",
"properties",
")",
"{",
"property",
".",
"writeFieldDefn",
"(",
"writer",
",",
"shortName",
",",
"writingAssocBean",
")",
";",
"writer",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"eol",
"(",
")",
";",
"}"
] | Write all the fields. | [
"Write",
"all",
"the",
"fields",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L260-L267 |
139,972 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeClass | private void writeClass() {
if (writingAssocBean) {
writer.append("/**").eol();
writer.append(" * Association query bean for %s.", shortName).eol();
writer.append(" * ").eol();
writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
writer.append(" */").eol();
if (processingContext.isGeneratedAvailable()) {
writer.append(AT_GENERATED).eol();
}
writer.append(AT_TYPEQUERYBEAN).eol();
writer.append("public class Q%s<R> extends TQAssocBean<%s,R> {", shortName, origShortName).eol();
} else {
writer.append("/**").eol();
writer.append(" * Query bean for %s.", shortName).eol();
writer.append(" * ").eol();
writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
writer.append(" */").eol();
if (processingContext.isGeneratedAvailable()) {
writer.append(AT_GENERATED).eol();
}
writer.append(AT_TYPEQUERYBEAN).eol();
writer.append("public class Q%s extends TQRootBean<%1$s,Q%1$s> {", shortName).eol();
}
writer.eol();
} | java | private void writeClass() {
if (writingAssocBean) {
writer.append("/**").eol();
writer.append(" * Association query bean for %s.", shortName).eol();
writer.append(" * ").eol();
writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
writer.append(" */").eol();
if (processingContext.isGeneratedAvailable()) {
writer.append(AT_GENERATED).eol();
}
writer.append(AT_TYPEQUERYBEAN).eol();
writer.append("public class Q%s<R> extends TQAssocBean<%s,R> {", shortName, origShortName).eol();
} else {
writer.append("/**").eol();
writer.append(" * Query bean for %s.", shortName).eol();
writer.append(" * ").eol();
writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
writer.append(" */").eol();
if (processingContext.isGeneratedAvailable()) {
writer.append(AT_GENERATED).eol();
}
writer.append(AT_TYPEQUERYBEAN).eol();
writer.append("public class Q%s extends TQRootBean<%1$s,Q%1$s> {", shortName).eol();
}
writer.eol();
} | [
"private",
"void",
"writeClass",
"(",
")",
"{",
"if",
"(",
"writingAssocBean",
")",
"{",
"writer",
".",
"append",
"(",
"\"/**\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * Association query bean for %s.\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * \"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" */\"",
")",
".",
"eol",
"(",
")",
";",
"if",
"(",
"processingContext",
".",
"isGeneratedAvailable",
"(",
")",
")",
"{",
"writer",
".",
"append",
"(",
"AT_GENERATED",
")",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"append",
"(",
"AT_TYPEQUERYBEAN",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\"public class Q%s<R> extends TQAssocBean<%s,R> {\"",
",",
"shortName",
",",
"origShortName",
")",
".",
"eol",
"(",
")",
";",
"}",
"else",
"{",
"writer",
".",
"append",
"(",
"\"/**\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * Query bean for %s.\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * \"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.\"",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\" */\"",
")",
".",
"eol",
"(",
")",
";",
"if",
"(",
"processingContext",
".",
"isGeneratedAvailable",
"(",
")",
")",
"{",
"writer",
".",
"append",
"(",
"AT_GENERATED",
")",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"append",
"(",
"AT_TYPEQUERYBEAN",
")",
".",
"eol",
"(",
")",
";",
"writer",
".",
"append",
"(",
"\"public class Q%s extends TQRootBean<%1$s,Q%1$s> {\"",
",",
"shortName",
")",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"eol",
"(",
")",
";",
"}"
] | Write the class definition. | [
"Write",
"the",
"class",
"definition",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L272-L300 |
139,973 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java | SimpleQueryBeanWriter.writeImports | private void writeImports() {
for (String importType : importTypes) {
writer.append("import %s;", importType).eol();
}
writer.eol();
} | java | private void writeImports() {
for (String importType : importTypes) {
writer.append("import %s;", importType).eol();
}
writer.eol();
} | [
"private",
"void",
"writeImports",
"(",
")",
"{",
"for",
"(",
"String",
"importType",
":",
"importTypes",
")",
"{",
"writer",
".",
"append",
"(",
"\"import %s;\"",
",",
"importType",
")",
".",
"eol",
"(",
")",
";",
"}",
"writer",
".",
"eol",
"(",
")",
";",
"}"
] | Write all the imports. | [
"Write",
"all",
"the",
"imports",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/SimpleQueryBeanWriter.java#L339-L345 |
139,974 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/Split.java | Split.split | static String[] split(String className) {
String[] result = new String[2];
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
result[1] = className;
return result;
}
result[0] = className.substring(0, startPos);
result[1] = className.substring(startPos + 1);
return result;
} | java | static String[] split(String className) {
String[] result = new String[2];
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
result[1] = className;
return result;
}
result[0] = className.substring(0, startPos);
result[1] = className.substring(startPos + 1);
return result;
} | [
"static",
"String",
"[",
"]",
"split",
"(",
"String",
"className",
")",
"{",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"2",
"]",
";",
"int",
"startPos",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"startPos",
"==",
"-",
"1",
")",
"{",
"result",
"[",
"1",
"]",
"=",
"className",
";",
"return",
"result",
";",
"}",
"result",
"[",
"0",
"]",
"=",
"className",
".",
"substring",
"(",
"0",
",",
"startPos",
")",
";",
"result",
"[",
"1",
"]",
"=",
"className",
".",
"substring",
"(",
"startPos",
"+",
"1",
")",
";",
"return",
"result",
";",
"}"
] | Split into package and class name. | [
"Split",
"into",
"package",
"and",
"class",
"name",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/Split.java#L11-L21 |
139,975 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/Split.java | Split.shortName | static String shortName(String className) {
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
return className;
}
return className.substring(startPos + 1);
} | java | static String shortName(String className) {
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
return className;
}
return className.substring(startPos + 1);
} | [
"static",
"String",
"shortName",
"(",
"String",
"className",
")",
"{",
"int",
"startPos",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"startPos",
"==",
"-",
"1",
")",
"{",
"return",
"className",
";",
"}",
"return",
"className",
".",
"substring",
"(",
"startPos",
"+",
"1",
")",
";",
"}"
] | Trim off package to return the simple class name. | [
"Trim",
"off",
"package",
"to",
"return",
"the",
"simple",
"class",
"name",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/Split.java#L26-L32 |
139,976 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/Append.java | Append.append | Append append(String format, Object... args) {
return append(String.format(format, args));
} | java | Append append(String format, Object... args) {
return append(String.format(format, args));
} | [
"Append",
"append",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"append",
"(",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}"
] | Append content with formatted arguments. | [
"Append",
"content",
"with",
"formatted",
"arguments",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/Append.java#L47-L49 |
139,977 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.findAnnotation | <A extends Annotation> A findAnnotation(TypeElement element, Class<A> anno) {
final A annotation = element.getAnnotation(anno);
if (annotation != null) {
return annotation;
}
final TypeMirror typeMirror = element.getSuperclass();
if (typeMirror.getKind() == TypeKind.NONE) {
return null;
}
final TypeElement element1 = (TypeElement)typeUtils.asElement(typeMirror);
return findAnnotation(element1, anno);
} | java | <A extends Annotation> A findAnnotation(TypeElement element, Class<A> anno) {
final A annotation = element.getAnnotation(anno);
if (annotation != null) {
return annotation;
}
final TypeMirror typeMirror = element.getSuperclass();
if (typeMirror.getKind() == TypeKind.NONE) {
return null;
}
final TypeElement element1 = (TypeElement)typeUtils.asElement(typeMirror);
return findAnnotation(element1, anno);
} | [
"<",
"A",
"extends",
"Annotation",
">",
"A",
"findAnnotation",
"(",
"TypeElement",
"element",
",",
"Class",
"<",
"A",
">",
"anno",
")",
"{",
"final",
"A",
"annotation",
"=",
"element",
".",
"getAnnotation",
"(",
"anno",
")",
";",
"if",
"(",
"annotation",
"!=",
"null",
")",
"{",
"return",
"annotation",
";",
"}",
"final",
"TypeMirror",
"typeMirror",
"=",
"element",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"typeMirror",
".",
"getKind",
"(",
")",
"==",
"TypeKind",
".",
"NONE",
")",
"{",
"return",
"null",
";",
"}",
"final",
"TypeElement",
"element1",
"=",
"(",
"TypeElement",
")",
"typeUtils",
".",
"asElement",
"(",
"typeMirror",
")",
";",
"return",
"findAnnotation",
"(",
"element1",
",",
"anno",
")",
";",
"}"
] | Find the annotation searching the inheritance hierarchy. | [
"Find",
"the",
"annotation",
"searching",
"the",
"inheritance",
"hierarchy",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L97-L109 |
139,978 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.dbJsonField | private static boolean dbJsonField(Element field) {
return (field.getAnnotation(DbJson.class) != null
|| field.getAnnotation(DbJsonB.class) != null);
} | java | private static boolean dbJsonField(Element field) {
return (field.getAnnotation(DbJson.class) != null
|| field.getAnnotation(DbJsonB.class) != null);
} | [
"private",
"static",
"boolean",
"dbJsonField",
"(",
"Element",
"field",
")",
"{",
"return",
"(",
"field",
".",
"getAnnotation",
"(",
"DbJson",
".",
"class",
")",
"!=",
"null",
"||",
"field",
".",
"getAnnotation",
"(",
"DbJsonB",
".",
"class",
")",
"!=",
"null",
")",
";",
"}"
] | Return true if it is a DbJson field. | [
"Return",
"true",
"if",
"it",
"is",
"a",
"DbJson",
"field",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L142-L145 |
139,979 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.createPropertyTypeAssoc | private PropertyType createPropertyTypeAssoc(String fullName) {
String[] split = Split.split(fullName);
String propertyName = "QAssoc" + split[1];
String packageName = packageAppend(split[0], "query.assoc");
return new PropertyTypeAssoc(propertyName, packageName);
} | java | private PropertyType createPropertyTypeAssoc(String fullName) {
String[] split = Split.split(fullName);
String propertyName = "QAssoc" + split[1];
String packageName = packageAppend(split[0], "query.assoc");
return new PropertyTypeAssoc(propertyName, packageName);
} | [
"private",
"PropertyType",
"createPropertyTypeAssoc",
"(",
"String",
"fullName",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"Split",
".",
"split",
"(",
"fullName",
")",
";",
"String",
"propertyName",
"=",
"\"QAssoc\"",
"+",
"split",
"[",
"1",
"]",
";",
"String",
"packageName",
"=",
"packageAppend",
"(",
"split",
"[",
"0",
"]",
",",
"\"query.assoc\"",
")",
";",
"return",
"new",
"PropertyTypeAssoc",
"(",
"propertyName",
",",
"packageName",
")",
";",
"}"
] | Create the QAssoc PropertyType. | [
"Create",
"the",
"QAssoc",
"PropertyType",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L236-L242 |
139,980 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.packageAppend | private String packageAppend(String origPackage, String suffix) {
if (origPackage == null) {
return suffix;
} else {
return origPackage + "." + suffix;
}
} | java | private String packageAppend(String origPackage, String suffix) {
if (origPackage == null) {
return suffix;
} else {
return origPackage + "." + suffix;
}
} | [
"private",
"String",
"packageAppend",
"(",
"String",
"origPackage",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"origPackage",
"==",
"null",
")",
"{",
"return",
"suffix",
";",
"}",
"else",
"{",
"return",
"origPackage",
"+",
"\".\"",
"+",
"suffix",
";",
"}",
"}"
] | Prepend the package to the suffix taking null into account. | [
"Prepend",
"the",
"package",
"to",
"the",
"suffix",
"taking",
"null",
"into",
"account",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L247-L253 |
139,981 | ebean-orm/querybean-generator | src/main/java/io/ebean/querybean/generator/ProcessingContext.java | ProcessingContext.createWriter | JavaFileObject createWriter(String factoryClassName, Element originatingElement) throws IOException {
return filer.createSourceFile(factoryClassName, originatingElement);
} | java | JavaFileObject createWriter(String factoryClassName, Element originatingElement) throws IOException {
return filer.createSourceFile(factoryClassName, originatingElement);
} | [
"JavaFileObject",
"createWriter",
"(",
"String",
"factoryClassName",
",",
"Element",
"originatingElement",
")",
"throws",
"IOException",
"{",
"return",
"filer",
".",
"createSourceFile",
"(",
"factoryClassName",
",",
"originatingElement",
")",
";",
"}"
] | Create a file writer for the given class name. | [
"Create",
"a",
"file",
"writer",
"for",
"the",
"given",
"class",
"name",
"."
] | ef28793c6bf4d51ce9017f251606917a3bd52266 | https://github.com/ebean-orm/querybean-generator/blob/ef28793c6bf4d51ce9017f251606917a3bd52266/src/main/java/io/ebean/querybean/generator/ProcessingContext.java#L258-L260 |
139,982 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMWriter.java | DOMWriter.printNode | public static String printNode(Node node, boolean prettyprint)
{
StringWriter strw = new StringWriter();
new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
return strw.toString();
} | java | public static String printNode(Node node, boolean prettyprint)
{
StringWriter strw = new StringWriter();
new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
return strw.toString();
} | [
"public",
"static",
"String",
"printNode",
"(",
"Node",
"node",
",",
"boolean",
"prettyprint",
")",
"{",
"StringWriter",
"strw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"new",
"DOMWriter",
"(",
"strw",
")",
".",
"setPrettyprint",
"(",
"prettyprint",
")",
".",
"print",
"(",
"node",
")",
";",
"return",
"strw",
".",
"toString",
"(",
")",
";",
"}"
] | Print a node with explicit prettyprinting.
The defaults for all other DOMWriter properties apply. | [
"Print",
"a",
"node",
"with",
"explicit",
"prettyprinting",
".",
"The",
"defaults",
"for",
"all",
"other",
"DOMWriter",
"properties",
"apply",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMWriter.java#L150-L155 |
139,983 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/XMLPredefinedEntityReferenceResolver.java | XMLPredefinedEntityReferenceResolver.resolve | public static String resolve(String normalized)
{
StringBuilder builder = new StringBuilder();
int end = normalized.length();
int pos = normalized.indexOf('&');
int last = 0;
// No references
if (pos == -1)
return normalized;
while (pos != -1)
{
String sub = normalized.subSequence(last, pos).toString();
builder.append(sub);
int peek = pos + 1;
if (peek == end)
throw MESSAGES.entityResolutionInvalidEntityReference(normalized);
if (normalized.charAt(peek) == '#')
pos = resolveCharRef(normalized, pos, builder);
else
pos = resolveEntityRef(normalized, pos, builder);
last = pos;
pos = normalized.indexOf('&', pos);
}
if (last < end)
{
String sub = normalized.subSequence(last, end).toString();
builder.append(sub);
}
return builder.toString();
} | java | public static String resolve(String normalized)
{
StringBuilder builder = new StringBuilder();
int end = normalized.length();
int pos = normalized.indexOf('&');
int last = 0;
// No references
if (pos == -1)
return normalized;
while (pos != -1)
{
String sub = normalized.subSequence(last, pos).toString();
builder.append(sub);
int peek = pos + 1;
if (peek == end)
throw MESSAGES.entityResolutionInvalidEntityReference(normalized);
if (normalized.charAt(peek) == '#')
pos = resolveCharRef(normalized, pos, builder);
else
pos = resolveEntityRef(normalized, pos, builder);
last = pos;
pos = normalized.indexOf('&', pos);
}
if (last < end)
{
String sub = normalized.subSequence(last, end).toString();
builder.append(sub);
}
return builder.toString();
} | [
"public",
"static",
"String",
"resolve",
"(",
"String",
"normalized",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"end",
"=",
"normalized",
".",
"length",
"(",
")",
";",
"int",
"pos",
"=",
"normalized",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"last",
"=",
"0",
";",
"// No references",
"if",
"(",
"pos",
"==",
"-",
"1",
")",
"return",
"normalized",
";",
"while",
"(",
"pos",
"!=",
"-",
"1",
")",
"{",
"String",
"sub",
"=",
"normalized",
".",
"subSequence",
"(",
"last",
",",
"pos",
")",
".",
"toString",
"(",
")",
";",
"builder",
".",
"append",
"(",
"sub",
")",
";",
"int",
"peek",
"=",
"pos",
"+",
"1",
";",
"if",
"(",
"peek",
"==",
"end",
")",
"throw",
"MESSAGES",
".",
"entityResolutionInvalidEntityReference",
"(",
"normalized",
")",
";",
"if",
"(",
"normalized",
".",
"charAt",
"(",
"peek",
")",
"==",
"'",
"'",
")",
"pos",
"=",
"resolveCharRef",
"(",
"normalized",
",",
"pos",
",",
"builder",
")",
";",
"else",
"pos",
"=",
"resolveEntityRef",
"(",
"normalized",
",",
"pos",
",",
"builder",
")",
";",
"last",
"=",
"pos",
";",
"pos",
"=",
"normalized",
".",
"indexOf",
"(",
"'",
"'",
",",
"pos",
")",
";",
"}",
"if",
"(",
"last",
"<",
"end",
")",
"{",
"String",
"sub",
"=",
"normalized",
".",
"subSequence",
"(",
"last",
",",
"end",
")",
".",
"toString",
"(",
")",
";",
"builder",
".",
"append",
"(",
"sub",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Transforms an XML normalized string by resolving all predefined character and entity references
@param normalized an XML normalized string
@return a standard java string that is no longer XML normalized | [
"Transforms",
"an",
"XML",
"normalized",
"string",
"by",
"resolving",
"all",
"predefined",
"character",
"and",
"entity",
"references"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/XMLPredefinedEntityReferenceResolver.java#L87-L123 |
139,984 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/InjectionHelper.java | InjectionHelper.invokeMethod | private static void invokeMethod(final Object instance, final Method method, final Object[] args)
{
final boolean accessability = method.isAccessible();
try
{
method.setAccessible(true);
method.invoke(instance, args);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
method.setAccessible(accessability);
}
} | java | private static void invokeMethod(final Object instance, final Method method, final Object[] args)
{
final boolean accessability = method.isAccessible();
try
{
method.setAccessible(true);
method.invoke(instance, args);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
method.setAccessible(accessability);
}
} | [
"private",
"static",
"void",
"invokeMethod",
"(",
"final",
"Object",
"instance",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"{",
"final",
"boolean",
"accessability",
"=",
"method",
".",
"isAccessible",
"(",
")",
";",
"try",
"{",
"method",
".",
"setAccessible",
"(",
"true",
")",
";",
"method",
".",
"invoke",
"(",
"instance",
",",
"args",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"InjectionException",
".",
"rethrow",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"method",
".",
"setAccessible",
"(",
"accessability",
")",
";",
"}",
"}"
] | Invokes method on object with specified arguments.
@param instance to invoke method on
@param method method to invoke
@param args arguments to pass | [
"Invokes",
"method",
"on",
"object",
"with",
"specified",
"arguments",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java#L162-L179 |
139,985 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/InjectionHelper.java | InjectionHelper.setField | private static void setField(final Object instance, final Field field, final Object value)
{
final boolean accessability = field.isAccessible();
try
{
field.setAccessible(true);
field.set(instance, value);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
field.setAccessible(accessability);
}
} | java | private static void setField(final Object instance, final Field field, final Object value)
{
final boolean accessability = field.isAccessible();
try
{
field.setAccessible(true);
field.set(instance, value);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
field.setAccessible(accessability);
}
} | [
"private",
"static",
"void",
"setField",
"(",
"final",
"Object",
"instance",
",",
"final",
"Field",
"field",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"boolean",
"accessability",
"=",
"field",
".",
"isAccessible",
"(",
")",
";",
"try",
"{",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"field",
".",
"set",
"(",
"instance",
",",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"InjectionException",
".",
"rethrow",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"field",
".",
"setAccessible",
"(",
"accessability",
")",
";",
"}",
"}"
] | Sets field on object with specified value.
@param instance to set field on
@param field to set
@param value to be set | [
"Sets",
"field",
"on",
"object",
"with",
"specified",
"value",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java#L188-L205 |
139,986 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java | InvocationHandlerJAXWS.onEndpointInstantiated | @Override
public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
{
final Object _targetBean = this.getTargetBean(invocation);
// TODO: refactor injection to AS IL
final Reference reference = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName());
final Object targetBean = reference.getValue();
InjectionHelper.injectWebServiceContext(targetBean, ThreadLocalAwareWebServiceContext.getInstance());
if (!reference.isInitialized())
{
InjectionHelper.callPostConstructMethod(targetBean);
reference.setInitialized();
}
endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
} | java | @Override
public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
{
final Object _targetBean = this.getTargetBean(invocation);
// TODO: refactor injection to AS IL
final Reference reference = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName());
final Object targetBean = reference.getValue();
InjectionHelper.injectWebServiceContext(targetBean, ThreadLocalAwareWebServiceContext.getInstance());
if (!reference.isInitialized())
{
InjectionHelper.callPostConstructMethod(targetBean);
reference.setInitialized();
}
endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
} | [
"@",
"Override",
"public",
"void",
"onEndpointInstantiated",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"Invocation",
"invocation",
")",
"{",
"final",
"Object",
"_targetBean",
"=",
"this",
".",
"getTargetBean",
"(",
"invocation",
")",
";",
"// TODO: refactor injection to AS IL",
"final",
"Reference",
"reference",
"=",
"endpoint",
".",
"getInstanceProvider",
"(",
")",
".",
"getInstance",
"(",
"_targetBean",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"final",
"Object",
"targetBean",
"=",
"reference",
".",
"getValue",
"(",
")",
";",
"InjectionHelper",
".",
"injectWebServiceContext",
"(",
"targetBean",
",",
"ThreadLocalAwareWebServiceContext",
".",
"getInstance",
"(",
")",
")",
";",
"if",
"(",
"!",
"reference",
".",
"isInitialized",
"(",
")",
")",
"{",
"InjectionHelper",
".",
"callPostConstructMethod",
"(",
"targetBean",
")",
";",
"reference",
".",
"setInitialized",
"(",
")",
";",
"}",
"endpoint",
".",
"addAttachment",
"(",
"PreDestroyHolder",
".",
"class",
",",
"new",
"PreDestroyHolder",
"(",
"targetBean",
")",
")",
";",
"}"
] | Injects resources on target bean and calls post construct method.
Finally it registers target bean for predestroy phase.
@param endpoint used for predestroy phase registration process
@param invocation current invocation | [
"Injects",
"resources",
"on",
"target",
"bean",
"and",
"calls",
"post",
"construct",
"method",
".",
"Finally",
"it",
"registers",
"target",
"bean",
"for",
"predestroy",
"phase",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java#L50-L67 |
139,987 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java | InvocationHandlerJAXWS.getTargetBean | private Object getTargetBean(final Invocation invocation)
{
final InvocationContext invocationContext = invocation.getInvocationContext();
return invocationContext.getTargetBean();
} | java | private Object getTargetBean(final Invocation invocation)
{
final InvocationContext invocationContext = invocation.getInvocationContext();
return invocationContext.getTargetBean();
} | [
"private",
"Object",
"getTargetBean",
"(",
"final",
"Invocation",
"invocation",
")",
"{",
"final",
"InvocationContext",
"invocationContext",
"=",
"invocation",
".",
"getInvocationContext",
"(",
")",
";",
"return",
"invocationContext",
".",
"getTargetBean",
"(",
")",
";",
"}"
] | Returns endpoint instance associated with current invocation.
@param invocation current invocation
@return target bean in invocation | [
"Returns",
"endpoint",
"instance",
"associated",
"with",
"current",
"invocation",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java#L111-L116 |
139,988 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/integration/WSHelper.java | WSHelper.getRequiredAttachment | public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key )
{
final A value = dep.getAttachment( key );
if ( value == null )
{
throw Messages.MESSAGES.cannotFindAttachmentInDeployment(key, dep.getSimpleName());
}
return value;
} | java | public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key )
{
final A value = dep.getAttachment( key );
if ( value == null )
{
throw Messages.MESSAGES.cannotFindAttachmentInDeployment(key, dep.getSimpleName());
}
return value;
} | [
"public",
"static",
"<",
"A",
">",
"A",
"getRequiredAttachment",
"(",
"final",
"Deployment",
"dep",
",",
"final",
"Class",
"<",
"A",
">",
"key",
")",
"{",
"final",
"A",
"value",
"=",
"dep",
".",
"getAttachment",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"Messages",
".",
"MESSAGES",
".",
"cannotFindAttachmentInDeployment",
"(",
"key",
",",
"dep",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"return",
"value",
";",
"}"
] | Returns required attachment value from webservice deployment.
@param <A> expected value
@param dep webservice deployment
@param key attachment key
@return required attachment
@throws IllegalStateException if attachment value is null | [
"Returns",
"required",
"attachment",
"value",
"from",
"webservice",
"deployment",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/integration/WSHelper.java#L62-L70 |
139,989 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/integration/WSHelper.java | WSHelper.getOptionalAttachment | public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key )
{
return dep.getAttachment( key );
} | java | public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key )
{
return dep.getAttachment( key );
} | [
"public",
"static",
"<",
"A",
">",
"A",
"getOptionalAttachment",
"(",
"final",
"Deployment",
"dep",
",",
"final",
"Class",
"<",
"A",
">",
"key",
")",
"{",
"return",
"dep",
".",
"getAttachment",
"(",
"key",
")",
";",
"}"
] | Returns optional attachment value from webservice deployment or null if not bound.
@param <A> expected value
@param dep webservice deployment
@param key attachment key
@return optional attachment value or null | [
"Returns",
"optional",
"attachment",
"value",
"from",
"webservice",
"deployment",
"or",
"null",
"if",
"not",
"bound",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/integration/WSHelper.java#L80-L83 |
139,990 | jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.createConstructorDelegates | protected void createConstructorDelegates(ConstructorBodyCreator creator) {
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(getSuperClass());
for (Constructor<?> constructor : data.getConstructors()) {
if (!Modifier.isPrivate(constructor.getModifiers())) {
creator.overrideConstructor(classFile.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils
.parameterDescriptors(constructor.getParameterTypes())), constructor);
}
}
} | java | protected void createConstructorDelegates(ConstructorBodyCreator creator) {
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(getSuperClass());
for (Constructor<?> constructor : data.getConstructors()) {
if (!Modifier.isPrivate(constructor.getModifiers())) {
creator.overrideConstructor(classFile.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils
.parameterDescriptors(constructor.getParameterTypes())), constructor);
}
}
} | [
"protected",
"void",
"createConstructorDelegates",
"(",
"ConstructorBodyCreator",
"creator",
")",
"{",
"ClassMetadataSource",
"data",
"=",
"reflectionMetadataSource",
".",
"getClassMetadata",
"(",
"getSuperClass",
"(",
")",
")",
";",
"for",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
":",
"data",
".",
"getConstructors",
"(",
")",
")",
"{",
"if",
"(",
"!",
"Modifier",
".",
"isPrivate",
"(",
"constructor",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"creator",
".",
"overrideConstructor",
"(",
"classFile",
".",
"addMethod",
"(",
"AccessFlag",
".",
"PUBLIC",
",",
"\"<init>\"",
",",
"\"V\"",
",",
"DescriptorUtils",
".",
"parameterDescriptors",
"(",
"constructor",
".",
"getParameterTypes",
"(",
")",
")",
")",
",",
"constructor",
")",
";",
"}",
"}",
"}"
] | Adds constructors that delegate the the superclass constructor for all non-private constructors present on the superclass
@param creator the constructor body creator to use | [
"Adds",
"constructors",
"that",
"delegate",
"the",
"the",
"superclass",
"constructor",
"for",
"all",
"non",
"-",
"private",
"constructors",
"present",
"on",
"the",
"superclass"
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L405-L413 |
139,991 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNoPrimitiveParameters | public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation)
{
for (Class<?> type : method.getParameterTypes())
{
if (type.isPrimitive())
{
throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation);
}
}
} | java | public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation)
{
for (Class<?> type : method.getParameterTypes())
{
if (type.isPrimitive())
{
throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation);
}
}
} | [
"public",
"static",
"void",
"assertNoPrimitiveParameters",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"type",
":",
"method",
".",
"getParameterTypes",
"(",
")",
")",
"{",
"if",
"(",
"type",
".",
"isPrimitive",
"(",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"methodCannotDeclarePrimitiveParameters",
"(",
"method",
")",
":",
"MESSAGES",
".",
"methodCannotDeclarePrimitiveParameters2",
"(",
"method",
",",
"annotation",
")",
";",
"}",
"}",
"}"
] | Asserts method don't declare primitive parameters.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"don",
"t",
"declare",
"primitive",
"parameters",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L53-L62 |
139,992 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotPrimitiveType | public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
{
if (field.getType().isPrimitive())
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | java | public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
{
if (field.getType().isPrimitive())
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotPrimitiveType",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"field",
".",
"getType",
"(",
")",
".",
"isPrimitive",
"(",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"fieldCannotBeOfPrimitiveOrVoidType",
"(",
"field",
")",
":",
"MESSAGES",
".",
"fieldCannotBeOfPrimitiveOrVoidType2",
"(",
"field",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts field is not of primitive type.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"of",
"primitive",
"type",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L80-L86 |
139,993 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNoParameters | public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 0)
{
throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
}
} | java | public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 0)
{
throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
}
} | [
"public",
"static",
"void",
"assertNoParameters",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"methodHasToHaveNoParameters",
"(",
"method",
")",
":",
"MESSAGES",
".",
"methodHasToHaveNoParameters2",
"(",
"method",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts method have no parameters.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"have",
"no",
"parameters",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L104-L110 |
139,994 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertVoidReturnType | public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
{
if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.methodHasToReturnVoid(method) : MESSAGES.methodHasToReturnVoid2(method, annotation);
}
} | java | public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
{
if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.methodHasToReturnVoid(method) : MESSAGES.methodHasToReturnVoid2(method, annotation);
}
} | [
"public",
"static",
"void",
"assertVoidReturnType",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"(",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"Void",
".",
"class",
")",
")",
"&&",
"(",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"Void",
".",
"TYPE",
")",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"methodHasToReturnVoid",
"(",
"method",
")",
":",
"MESSAGES",
".",
"methodHasToReturnVoid2",
"(",
"method",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts method return void.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"return",
"void",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L128-L134 |
139,995 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotVoidType | public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation)
{
if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | java | public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation)
{
if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotVoidType",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"(",
"field",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"Void",
".",
"class",
")",
")",
"&&",
"(",
"field",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"Void",
".",
"TYPE",
")",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"fieldCannotBeOfPrimitiveOrVoidType",
"(",
"field",
")",
":",
"MESSAGES",
".",
"fieldCannotBeOfPrimitiveOrVoidType2",
"(",
"field",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts field isn't of void type.
@param field to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"isn",
"t",
"of",
"void",
"type",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L152-L158 |
139,996 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNoCheckedExceptionsAreThrown | public static void assertNoCheckedExceptionsAreThrown(final Method method, Class<? extends Annotation> annotation)
{
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (int i = 0; i < declaredExceptions.length; i++)
{
Class<?> exception = declaredExceptions[i];
if (!exception.isAssignableFrom(RuntimeException.class))
{
throw annotation == null ? MESSAGES.methodCannotThrowCheckedException(method) : MESSAGES.methodCannotThrowCheckedException2(method, annotation);
}
}
} | java | public static void assertNoCheckedExceptionsAreThrown(final Method method, Class<? extends Annotation> annotation)
{
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (int i = 0; i < declaredExceptions.length; i++)
{
Class<?> exception = declaredExceptions[i];
if (!exception.isAssignableFrom(RuntimeException.class))
{
throw annotation == null ? MESSAGES.methodCannotThrowCheckedException(method) : MESSAGES.methodCannotThrowCheckedException2(method, annotation);
}
}
} | [
"public",
"static",
"void",
"assertNoCheckedExceptionsAreThrown",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"declaredExceptions",
"=",
"method",
".",
"getExceptionTypes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"declaredExceptions",
".",
"length",
";",
"i",
"++",
")",
"{",
"Class",
"<",
"?",
">",
"exception",
"=",
"declaredExceptions",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"exception",
".",
"isAssignableFrom",
"(",
"RuntimeException",
".",
"class",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"methodCannotThrowCheckedException",
"(",
"method",
")",
":",
"MESSAGES",
".",
"methodCannotThrowCheckedException2",
"(",
"method",
",",
"annotation",
")",
";",
"}",
"}",
"}"
] | Asserts method don't throw checked exceptions.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"don",
"t",
"throw",
"checked",
"exceptions",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L176-L187 |
139,997 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotStatic | public static void assertNotStatic(final Method method, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(method.getModifiers()))
{
throw annotation == null ? MESSAGES.methodCannotBeStatic(method) : MESSAGES.methodCannotBeStatic2(method, annotation);
}
} | java | public static void assertNotStatic(final Method method, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(method.getModifiers()))
{
throw annotation == null ? MESSAGES.methodCannotBeStatic(method) : MESSAGES.methodCannotBeStatic2(method, annotation);
}
} | [
"public",
"static",
"void",
"assertNotStatic",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"methodCannotBeStatic",
"(",
"method",
")",
":",
"MESSAGES",
".",
"methodCannotBeStatic2",
"(",
"method",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts method is not static.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"is",
"not",
"static",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L205-L211 |
139,998 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotStatic | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotStatic",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"field",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"fieldCannotBeStaticOrFinal",
"(",
"field",
")",
":",
"MESSAGES",
".",
"fieldCannotBeStaticOrFinal2",
"(",
"field",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts field is not static.
@param field to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"static",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L229-L235 |
139,999 | jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotFinal | public static void assertNotFinal(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isFinal(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java | public static void assertNotFinal(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isFinal(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotFinal",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"Modifier",
".",
"isFinal",
"(",
"field",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"throw",
"annotation",
"==",
"null",
"?",
"MESSAGES",
".",
"fieldCannotBeStaticOrFinal",
"(",
"field",
")",
":",
"MESSAGES",
".",
"fieldCannotBeStaticOrFinal2",
"(",
"field",
",",
"annotation",
")",
";",
"}",
"}"
] | Asserts field is not final.
@param field to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"final",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L253-L259 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.