extendObjectTable - extends the object store if it is found to be full. The table
can be extended until a maximum size. The maximum size can be supplied, or a
default size.

@throws ConversationStateFullException if there is no more space.
497674
private synchronized void extendObjectTable() throws ConversationStateFullException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "extendObjectTable");

        int newTableSize = (((maxIndex + 1) * OBJECT_TABLE_EXTEND_FACTOR) - OBJECT_TABLE_ORIGIN);

        // new table size
        if (newTableSize > maxTableSize)
        {
            if ((maxIndex + 1) < maxTableSize)
            {
                newTableSize = maxTableSize;
            }
            else
            {
                ConversationStateFullException e = new ConversationStateFullException();

                // Lets FFDC this so we can capture the information about what has filled up the store
                FFDCFilter.processException(e, CLASS_NAME + ".extendObjectTable",
                                            CommsConstants.CONVERSATIONSTATE_EXTENDOBJECTTABLE_01,
                                            new Object[] { getLastItemsInStore(), this });

                throw e;
            }
        }

        Object[] newObjectTable = new Object[newTableSize]; // Create new, extended table
        // Copy old table to new
        System.arraycopy(objectTable, 0, newObjectTable, 0, (maxIndex + 1));

        freeSlot = (maxIndex + 1); // set next free slot
        maxIndex = (newTableSize - 1); // Set new max index
        objectTable = newObjectTable; // Point to new table

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        {
            SibTr.debug(tc, "Next free slot = ", Integer.valueOf(freeSlot));
            SibTr.debug(tc, "Max Index = ", Integer.valueOf(maxIndex));
            SibTr.debug(tc, "High Water Mark = ", Integer.valueOf(highWatermark));
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "extendObjectTable");
    }
1065092
private Extensions getOrCreate(String mappingTable) {

		getOrCreate();

		Extensions extension = getOrCreate(EXTENSION_NAME, mappingTable, null,
				EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE);

		return extension;
	}
18927
private void increaseCapacity(boolean allowIllegalSize) {
    int len = this.content.limit();
    int newCapacity = (len == 0) ? DEFAULT_INIT_SIZE
        : len < 64 ? len * 2 : this.content.limit() < 1067 ? len * 3 / 2 : len * 5 / 4;
    // do not allocate more than we will ever need
    if (newCapacity > MappeableArrayContainer.DEFAULT_MAX_SIZE && !allowIllegalSize) {
      newCapacity = MappeableArrayContainer.DEFAULT_MAX_SIZE;
    }
    // if we are within 1/16th of the max., go to max right away to avoid further reallocations
    if (newCapacity > MappeableArrayContainer.DEFAULT_MAX_SIZE
        - MappeableArrayContainer.DEFAULT_MAX_SIZE / 16 && !allowIllegalSize) {
      newCapacity = MappeableArrayContainer.DEFAULT_MAX_SIZE;
    }
    final ShortBuffer newContent = ShortBuffer.allocate(newCapacity);
    this.content.rewind();
    newContent.put(this.content);
    this.content = newContent;
  }
473270
@SuppressWarnings("unchecked")
    public synchronized void expandExpedited(int additionalCapacity) {
        if (additionalCapacity <= 0) {
            throw new IllegalArgumentException();
        }

        int capacityBefore = expeditedBuffer.length;
        synchronized (lock) { // D312598
            int capacityAfter = expeditedBuffer.length;
            //Check that no one was expanding while we waited on this lock
            if (capacityAfter == capacityBefore) {
                final Object[] newBuffer = new Object[expeditedBuffer.length + additionalCapacity];

                // PK53203 - put() acquires two locks in sequence.  First, it acquires
                // the insert lock to update putIndex.  Then, it drops the insert lock
                // and acquires the extract lock to update numberOfUsedSlots.  As a
                // result, there is a window where putIndex has been updated, but
                // numberOfUsedSlots has not.  Consequently, even though we have
                // acquired both locks in this method, we cannot rely on the values in
                // numberOfUsedSlots; we can only rely on putIndex and takeIndex.

                if (expeditedPutIndex > expeditedTakeIndex) {
                    // The contents of the buffer do not wrap round
                    // the end of the array. We can move its contents
                    // into the new expanded buffer in one go.

                    int used = expeditedPutIndex - expeditedTakeIndex;
                    System.arraycopy(expeditedBuffer, expeditedTakeIndex, newBuffer, 0, used);
                    expeditedPutIndex = used;

                    // PK53203.1 - If putIndex == takeIndex, then the buffer is either
                    // completely full or completely empty.  If it is completely full, then
                    // we need to copy and adjust putIndex.  Otherwise, we need to set
                    // putIndex to 0.
                } else if (expeditedPutIndex != expeditedTakeIndex || expeditedBuffer[expeditedTakeIndex] != null) {
                    // The contents of the buffer wrap round the end
                    // of the array. We have to perform two copies to
                    // move its contents into the new buffer.

                    int used = expeditedBuffer.length - expeditedTakeIndex;
                    System.arraycopy(expeditedBuffer, expeditedTakeIndex, newBuffer, 0, used);
                    System.arraycopy(expeditedBuffer, 0, newBuffer, used, expeditedPutIndex);
                    expeditedPutIndex += used;
                } else {
                    expeditedPutIndex = 0;
                }

                // The contents of the buffer now begin at 0 - update the head pointer.

                expeditedTakeIndex = 0;

                // The buffer's capacity has been increased so update the count of the
                // empty slots to reflect this.
                expeditedBuffer = (T[]) newBuffer;
            }
        } // D312598
    }
888314
def setExtendsTree( self, state ):
        
        delegate = self.itemDelegate()
        if ( isinstance(delegate, XTreeWidgetDelegate) ):
            delegate.setExtendsTree(state)
601958
Statement detachLimited(AppendableExpression appendable) {
    if (!appendable.supportsSoftLimiting()) {
      return appendable.toStatement();
    }
    final Label reattachPoint = new Label();
    final SaveRestoreState saveRestoreState = variables.saveRestoreState();

    Statement restore = saveRestoreState.restore();
    int state = addState(reattachPoint, restore);
    final Expression isSoftLimited = appendable.softLimitReached();
    final Statement returnLimited = returnExpression(MethodRef.RENDER_RESULT_LIMITED.invoke());
    final Statement saveState =
        stateField.putInstanceField(thisExpr, BytecodeUtils.constant(state));
    return new Statement() {
      @Override
      protected void doGen(CodeBuilder adapter) {
        isSoftLimited.gen(adapter);
        adapter.ifZCmp(Opcodes.IFEQ, reattachPoint); // if !softLimited
        // ok we were limited, save state and return
        saveRestoreState.save().gen(adapter); // save locals
        saveState.gen(adapter); // save the state field
        returnLimited.gen(adapter);
        // Note, the reattach point for 'limited' is _after_ the check.  That means we do not
        // recheck the limit state.  So if a caller calls us back without freeing any buffer we
        // will print more before checking again.  This is fine, because our caller is breaking the
        // contract.
        adapter.mark(reattachPoint);
      }
    };
  }
474053
function(newData, limit) {
            if ((this.buffer.length + newData.length) > options.limit) {
                this.buffer = this.buffer.concat(newData.slice(0, options.limit - this.buffer.length));
                self._sendDisplayLimitReachedMessage(limit);
            }
            else {
                this.buffer = this.buffer.concat(newData);
            }
        }
1325200
public boolean extend(SpatialComparable obj) {
    final int dim = min.length;
    assert (obj.getDimensionality() == dim);
    boolean extended = false;
    for(int i = 0; i < dim; i++) {
      final double omin = obj.getMin(i);
      final double omax = obj.getMax(i);
      if(omin < min[i]) {
        min[i] = omin;
        extended = true;
      }
      if(omax > max[i]) {
        max[i] = omax;
        extended = true;
      }
    }
    return extended;
  }
860193
protected void extendArray(int k) {
    // size + 1 could overflow
    if (this.size + k > this.keys.length) {
      int newCapacity;
      if (this.keys.length < 1024) {
        newCapacity = 2 * (this.size + k);
      } else {
        newCapacity = 5 * (this.size + k) / 4;
      }
      this.keys = Arrays.copyOf(this.keys, newCapacity);
      this.values = Arrays.copyOf(this.values, newCapacity);
    }
  }
1112572
private void resize(int newCapacity) {
        // assert (newCapacity & -newCapacity) == newCapacity; // power of 2
        int newLength = newCapacity * 2;

        long[] oldTable = table;
        int oldLength = oldTable.length;
        if (oldLength == 2*MAXIMUM_CAPACITY) { // can't expand any further
            if (threshold == MAXIMUM_CAPACITY-1)
                throw new IllegalStateException("Capacity exhausted.");
            threshold = MAXIMUM_CAPACITY-1;  // Gigantic map!
            return;
        }
        if (oldLength >= newLength)
            return;

        long[] newTable = new long[newLength];
        threshold = (newCapacity * 3) / 4;

        for (int j = 0; j < oldLength; j += 2) {
            long key = oldTable[j];
            if (key != 0) {
                long value = oldTable[j+1];
                int i = hash(key, newLength);
                while (newTable[i] != 0)
                    i = nextKeyIndex(i, newLength);
                newTable[i] = key;
                newTable[i + 1] = value;
            }
        }
        table = newTable;
    }
865867
private Statement compileAlterTableAddLimitConstraint(Table table, HsqlName name)
    {
        boolean isAutogeneratedName = false;
        if (name == null) {
            name = database.nameManager.newAutoName("LIMIT",
                    table.getSchemaName(), table.getName(),
                    SchemaObject.CONSTRAINT);
            isAutogeneratedName = true;

        }

        Constraint c = new Constraint(name, isAutogeneratedName, null, Constraint.LIMIT);

        readLimitConstraintCondition(c);

        String   sql  = getLastPart();
        Object[] args = new Object[]{ c };

        return new StatementSchema(sql, StatementTypes.ALTER_TABLE, args,
                                   null, table.getName());
    }
1025728
public final ProtoParser.extend_body_return extend_body(Proto proto, Extension extension) throws RecognitionException {
        ProtoParser.extend_body_return retval = new ProtoParser.extend_body_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        ProtoParser.message_field_return message_field164 = null;

        ProtoParser.annotation_entry_return annotation_entry165 = null;



        try {
            // com/dyuproject/protostuff/parser/ProtoParser.g:637:5: ( message_field[proto, extension] | annotation_entry[proto] )
            int alt37=2;
            switch ( input.LA(1) ) {
            case REQUIRED:
            case OPTIONAL:
            case REPEATED:
                {
                alt37=1;
                }
                break;
            case AT:
                {
                alt37=2;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 37, 0, input);

                throw nvae;
            }

            switch (alt37) {
                case 1 :
                    // com/dyuproject/protostuff/parser/ProtoParser.g:637:9: message_field[proto, extension]
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_message_field_in_extend_body2588);
                    message_field164=message_field(proto, extension);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, message_field164.getTree());

                    }
                    break;
                case 2 :
                    // com/dyuproject/protostuff/parser/ProtoParser.g:638:9: annotation_entry[proto]
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_annotation_entry_in_extend_body2599);
                    annotation_entry165=annotation_entry(proto);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, annotation_entry165.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
537859
public void addExtendedInformation(String key, Object value) {
        if (extendedInformation == null) {
            extendedInformation = new HashMap<>();
        }
        extendedInformation.put(key, value);
    }
77638
protected function setExtendData()
    {
        //Check extend result methods
        if (empty($this->arExtendResult)) {
            return;
        }

        //Apply extend methods
        foreach ($this->arExtendResult as $sMethodName) {
            if (empty($sMethodName) || !(method_exists($this, $sMethodName) || $this->methodExists($sMethodName))) {
                continue;
            }

            $this->$sMethodName();
        }
    }
263497
private JTable getTableExtension() {
		if (tableExt == null) {
			tableExt = new JTable();
			tableExt.setModel(this.model);
			tableExt.getColumnModel().getColumn(0).setPreferredWidth(30);
			tableExt.getColumnModel().getColumn(1).setPreferredWidth(320);
			tableExt.getColumnModel().getColumn(2).setPreferredWidth(50);
			// Issue 954: Force the JTable cell to auto-save when the focus changes.
			// Example, edit cell, click OK for a panel dialog box, the data will get saved.
			tableExt.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

			// Disable for now - would be useful but had some problems with this ;)
			/*
			ListSelectionListener sl = new ListSelectionListener() {

				@Override
				public void valueChanged(ListSelectionEvent arg0) {
	        		if (tableExt.getSelectedRow() > -1) {
	        			Context ctx = ((ContextListTableModel)tableExt.getModel()).getContext(
	        					tableExt.getSelectedRow());
	        			if (ctx != null) {
	        				try {
								extName.setText(ext.getName());
								extDescription.setText(ext.getDescription());
								if (ext.getAuthor() != null) {
									extAuthor.setText(ext.getAuthor());
								} else {
									extAuthor.setText("");
								}
								if (ext.getURL() != null) {
									extURL.setText(ext.getURL().toString());
									getUrlLaunchButton().setEnabled(true);
								} else {
									extURL.setText("");
									getUrlLaunchButton().setEnabled(false);
								}
							} catch (Exception e) {
								// Just to be safe
								log.error(e.getMessage(), e);
							}
	        			}
	        		}
				}};
			
			tableExt.getSelectionModel().addListSelectionListener(sl);
			tableExt.getColumnModel().getSelectionModel().addListSelectionListener(sl);
			*/
			
		}
		return tableExt;
	}
706047
public void setExtends(String superType) {
		if (!Strings.isEmpty(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.container, superType);
			this.sarlClass.setExtends(superTypeRef);
			return;
		}
		this.sarlClass.setExtends(null);
	}
1239521
@Override
    public SeekableByteChannel truncate(final long size) throws IOException {

        // Precondition checks
        if (size < 0 || size > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("This implementation permits a size of 0 to " + Integer.MAX_VALUE
                + " inclusive");
        }

        // Sync up for mucking w/ shared mutable state
        synchronized (this) {

            final int newSize = (int) size;
            final int currentSize = (int) this.size();

            // If the current position is greater than the given size, set to the given size (by API spec)
            if (this.position > newSize) {
                this.position = newSize;
            }

            // If we've been given a size smaller than we currently are
            if (currentSize > newSize) {
                // Make new array
                final byte[] newContents = new byte[newSize];
                // Copy in the contents up to the new size
                System.arraycopy(this.contents, 0, newContents, 0, newSize);
                // Set the new array as our contents
                this.contents = newContents;
            }

            // If we've been given a size greater than or equal to us then do nothing
            // if (newSize >= currentSize) {
            // // do nothing
            // }
        }

        // Return this reference
        return this;
    }