repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
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", ".", ...
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
train
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", ")", "{...
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...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L108-L166
train
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", ...
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",...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferMgr.java#L179-L228
train
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", ")", ...
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
train
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...
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
train
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", ">"...
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
train
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", "(", "f...
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
train
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
train
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
train
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
train
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", "(", ")", ",", ...
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
train
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", ")...
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
train
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", "// s...
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
train
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", ...
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
train
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", ...
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
train
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", ")", "{", ...
Stop collecting.
[ "Stop", "collecting", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/util/Profiler.java#L102-L112
train
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", ")", ";", "...
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
train
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", ">", "stackm...
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
train
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", ")", ";", "fo...
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
train
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...
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
train
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", ...
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
train
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", ")", ")", "{", "readFrom...
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
train
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...
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
train
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", "TableNotFoun...
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
train
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
train
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
train
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", ")", ";"...
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
train
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", "(", ")", ")", ";...
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...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/index/IndexJoinScan.java#L84-L96
train
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", "(", "fldN...
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
train
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
train
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"...
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
train
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", "="...
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
train
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...
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", "enco...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java#L75-L92
train
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", ")...
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", "i...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/GroupByScan.java#L112-L121
train
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", "...
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
train
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", ".",...
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
train
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", ")", ...
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", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L113-L178
train
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", "(", ...
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
train
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", ".", "logM...
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", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/recovery/RecoveryMgr.java#L59-L66
train
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",...
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
train
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", ...
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
train
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"...
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
train
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", "(", ")", ";", "...
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
train
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", "(", ")", ...
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", ".", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/btree/BTreeIndex.java#L204-L221
train
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
train
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", "(", ")", ")", ...
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
train
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", ".", "nu...
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
train
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", ")", "moveToNextB...
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", "return...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/log/LogIterator.java#L73-L83
train
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", "=", "(", ...
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
train
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", ...
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
train
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
train
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
train
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", "(", ...
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
train
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", "...
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
train
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", "fldTyp...
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
train
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 prope...
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", "app...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordFile.java#L215-L264
train
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", "(", ")", ";", "// Inserti...
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
train
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
train
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
train
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", ".", "i...
Determines if this term is of the form "F&lt;OP&gt;E" where F is the specified field, &lt;OP&gt; is an operator, and E is an expression. If so, the method returns &lt;OP&gt;. 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&lt", ";", "OP&gt", ";", "E", "where", "F", "is", "the", "specified", "field", "&lt", ";", "OP&gt", ";", "is", "an", "operator", "and", "E", "is", "an", "expression", ".", "If", "so", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L135-L141
train
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", "(", ")", ")", ...
Determines if this term is of the form "F&lt;OP&gt;C" where F is the specified field, &lt;OP&gt; 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&lt", ";", "OP&gt", ";", "C", "where", "F", "is", "the", "specified", "field", "&lt", ";", "OP&gt", ";", "is", "an", "operator", "and", "C", "is", "some", "constant", ".", "If", "so", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L152-L160
train
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", "(", ")", ")", "r...
Determines if this term is of the form "F1&lt;OP&gt;F2" where F1 is the specified field, &lt;OP&gt; 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&lt", ";", "OP&gt", ";", "F2", "where", "F1", "is", "the", "specified", "field", "&lt", ";", "OP&gt", ";", "is", "an", "operator", "and", "F2", "is", "another", "field", ".", "If", "so...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Term.java#L171-L179
train
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", ...
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
train
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", "=", "resolverConfigur...
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
train
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", "[", "]", "addre...
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
train
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", "=",...
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
train
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", "...
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
train
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 give...
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
train
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", ...
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
train
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", ".",...
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
train
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", ")", ...
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
train
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
train
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", "(", "start...
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
train
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", "classN...
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
train
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
train
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",...
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
train
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", ")", "!=", ...
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
train
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", "]", ";", "S...
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
train
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
train
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
train
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 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
train
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", ".", "...
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
train
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", "(", ")", ";", "...
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
train
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", "{", "fiel...
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
train
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: refac...
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
train
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
train
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", "(", "valu...
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
train
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
train
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", "<", "?...
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
train
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", "(...
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
train
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", "(", ")", ")", "{", "thr...
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
train
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", ")", "{", ...
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
train
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", ...
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
train
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", ...
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
train
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", ".", "getEx...
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
train
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", "(", ")", ")", ")", ...
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
train
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", "(", ")", ")", ")", "{...
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
train
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", "(", ")", ")", ")", "{",...
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
train
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertOneParameter
public static void assertOneParameter(final Method method, Class<? extends Annotation> annotation) { if (method.getParameterTypes().length != 1) { throw annotation == null ? MESSAGES.methodHasToDeclareExactlyOneParameter(method) : MESSAGES.methodHasToDeclareExactlyOneParameter2(method, annotation); } }
java
public static void assertOneParameter(final Method method, Class<? extends Annotation> annotation) { if (method.getParameterTypes().length != 1) { throw annotation == null ? MESSAGES.methodHasToDeclareExactlyOneParameter(method) : MESSAGES.methodHasToDeclareExactlyOneParameter2(method, annotation); } }
[ "public", "static", "void", "assertOneParameter", "(", "final", "Method", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "if", "(", "method", ".", "getParameterTypes", "(", ")", ".", "length", "!=", "1", ")", "{", ...
Asserts method have exactly one parameter. @param method to validate @param annotation annotation to propagate in exception message
[ "Asserts", "method", "have", "exactly", "one", "parameter", "." ]
fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L277-L283
train
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertValidSetterName
public static void assertValidSetterName(final Method method, Class<? extends Annotation> annotation) { final String methodName = method.getName(); final boolean correctMethodNameLength = methodName.length() > 3; final boolean isSetterMethodName = methodName.startsWith("set"); final boolean isUpperCasedPropertyName = correctMethodNameLength ? Character.isUpperCase(methodName.charAt(3)) : false; if (!correctMethodNameLength || !isSetterMethodName || !isUpperCasedPropertyName) { throw annotation == null ? MESSAGES.methodDoesNotRespectJavaBeanSetterMethodName(method) : MESSAGES.methodDoesNotRespectJavaBeanSetterMethodName2(method, annotation); } }
java
public static void assertValidSetterName(final Method method, Class<? extends Annotation> annotation) { final String methodName = method.getName(); final boolean correctMethodNameLength = methodName.length() > 3; final boolean isSetterMethodName = methodName.startsWith("set"); final boolean isUpperCasedPropertyName = correctMethodNameLength ? Character.isUpperCase(methodName.charAt(3)) : false; if (!correctMethodNameLength || !isSetterMethodName || !isUpperCasedPropertyName) { throw annotation == null ? MESSAGES.methodDoesNotRespectJavaBeanSetterMethodName(method) : MESSAGES.methodDoesNotRespectJavaBeanSetterMethodName2(method, annotation); } }
[ "public", "static", "void", "assertValidSetterName", "(", "final", "Method", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "final", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "final", "bool...
Asserts valid Java Beans setter method name. @param method to validate @param annotation annotation to propagate in exception message
[ "Asserts", "valid", "Java", "Beans", "setter", "method", "name", "." ]
fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L301-L312
train