/** Is a buffer scoped to this or any parent of this block. */ public boolean isBufferLocal(BufferScope buff) { for (Block block = this; block.parent != null; block = block.parent) { if (buff.getBlock() == block) return true; } return false; }
/** Is a buffer scoped to this or any parent of this block. */ public boolean isBufferLocal(BufferScope buff) { for (Block block = this; block.parent != null; block = block.parent) { if (buff.getBlock() == block) return true; } return false; }
/** Get the buffers that are scoped to this block */ public TableBuffer[] getBlockBuffers() { // We can't just return bufferScopes, because it also contains // references to BufferScope objects which are scoped to child blocks. Set<TableBuffer> set = new HashSet<>(); for (BufferScope buff : bufferScopes) { if (buff.getBlock() == this) set.add(buff.getSymbol()); } return (TableBuffer[]) set.toArray(new TableBuffer[set.size()]); } // getBlockBuffers
/** Get the buffers that are scoped to this block */ public TableBuffer[] getBlockBuffers() { // We can't just return bufferScopes, because it also contains // references to BufferScope objects which are scoped to child blocks. Set<TableBuffer> set = new HashSet<>(); for (BufferScope buff : bufferScopes) { if (buff.getBlock() == this) set.add(buff.getSymbol()); } return (TableBuffer[]) set.toArray(new TableBuffer[set.size()]); } // getBlockBuffers
/** Find nearest BufferScope for a BufferSymbol, if any */ private BufferScope findBufferScope(TableBuffer symbol) { for (BufferScope buff : bufferScopes) { if (buff.getSymbol() != symbol) continue; if (buff.getBlock() == this) return buff; } if (parent != null && symbol.getScope().getRootBlock() != this) return parent.findBufferScope(symbol); return null; }
/** Find nearest BufferScope for a BufferSymbol, if any */ private BufferScope findBufferScope(TableBuffer symbol) { for (BufferScope buff : bufferScopes) { if (buff.getSymbol() != symbol) continue; if (buff.getBlock() == this) return buff; } if (parent != null && symbol.getScope().getRootBlock() != this) return parent.findBufferScope(symbol); return null; }