Adds a message to the table
@param msg the message
@param resize whether or not to resize the table. If true, the method will always return 1
@return always 1 if resize==true, else 1 if the message was added or 0 if not
428472
public int add(final Message msg, boolean resize) {
        if(msg == null) return 0;
        if(index >= messages.length) {
            if(!resize)
                return 0;
            resize();
        }
        messages[index++]=msg;
        return 1;
    }
865424
public void setSize(final double size) {
        this.size = size;
        stack.setPrefSize(size, size);
        text.setFont(Font.font(text.getFont().getFamily(), FontWeight.BOLD, size / 2));
        svgIcon.setSize(size);
        stack.requestLayout();
    }
321721
private void checkIfMessageDuplicated(String msgName, Node msgNode) {
    if (messageNames.containsKey(msgName)) {
      MessageLocation location = messageNames.get(msgName);
      compiler.report(JSError.make(msgNode, MESSAGE_DUPLICATE_KEY,
          msgName, location.messageNode.getSourceFileName(),
          Integer.toString(location.messageNode.getLineno())));
    }
  }
555334
public static <T> Result<T> failed(String msg) {
        return Result.<T>builder().success(false).msg(msg).build();
    }
114719
public void resize(int maxSize) {
		this.maxSize = maxSize;
		if (cache.size() > maxSize) {
			int count = 0;
			Iterator<Long> rowIds = cache.keySet().iterator();
			while (rowIds.hasNext()) {
				rowIds.next();
				if (++count > maxSize) {
					rowIds.remove();
				}
			}
		}
	}
992779
public boolean displayMessage (ChatMessage msg, boolean alreadyDisplayed)
    {
        // see if we're full, and if so, clear out a bunch of old stuff
        int adjusted;
        if (size() == MAX_HISTORY) {
            removeRange(0, PRUNE_HISTORY);
            adjusted = PRUNE_HISTORY;

        } else {
            adjusted = 0;
        }

        // add the message to the history
        add(msg);

        // notify observers that something changed
        notify(adjusted);

        return true;
    }
193478
public void warning(String msg) {
        if (Level.WARNING.intValue() < levelValue) {
            return;
        }
        log(Level.WARNING, msg);
    }
756683
public boolean rm(Msg msg, int start, int size)
    {
        //  TODO: Shouldn't an error be reported if the key does not exist?

        if (size == 0) {
            if (refcnt == 0) {
                return false;
            }
            refcnt--;
            return refcnt == 0;
        }

        assert (msg != null);
        byte c = msg.get(start);
        if (count == 0 || c < min || c >= min + count) {
            return false;
        }

        Trie nextNode = count == 1 ? next[0] : next[c - min];

        if (nextNode == null) {
            return false;
        }

        boolean ret = nextNode.rm(msg, start + 1, size - 1);

        //  Prune redundant nodes
        if (nextNode.isRedundant()) {
            //delete next_node;
            assert (count > 0);

            if (count == 1) {
                //  The just pruned node was the only live node
                next = null;
                count = 0;
                --liveNodes;
                assert (liveNodes == 0);
            }
            else {
                next[c - min] = null;
                assert (liveNodes > 1);
                --liveNodes;

                //  Compact the table if possible
                if (liveNodes == 1) {
                    //  We can switch to using the more compact single-node
                    //  representation since the table only contains one live node

                    Trie node = null;
                    //  Since we always compact the table the pruned node must
                    //  either be the left-most or right-most ptr in the node
                    //  table
                    if (c == min) {
                        //  The pruned node is the left-most node ptr in the
                        //  node table => keep the right-most node
                        node = next[count - 1];
                        min += count - 1;
                    }
                    else if (c == min + count - 1) {
                        //  The pruned node is the right-most node ptr in the
                        //  node table => keep the left-most node
                        node = next[0];
                    }
                    assert (node != null);

                    //free (next.table);
                    next = new Trie[] { node };
                    count = 1;
                }
                else if (c == min) {
                    //  We can compact the table "from the left".
                    //  Find the left-most non-null node ptr, which we'll use as
                    //  our new min
                    byte newMin = min;
                    for (int i = 1; i < count; ++i) {
                        if (next[i] != null) {
                            newMin = (byte) (i + min);
                            break;
                        }
                    }
                    assert (newMin != min);

                    assert (newMin > min);
                    assert (count > newMin - min);
                    count = count - (newMin - min);

                    next = realloc(next, count, true);

                    min = newMin;
                }
                else if (c == min + count - 1) {
                    //  We can compact the table "from the right".
                    //  Find the right-most non-null node ptr, which we'll use to
                    //  determine the new table size
                    int newCount = count;
                    for (int i = 1; i < count; ++i) {
                        if (next[count - 1 - i] != null) {
                            newCount = count - i;
                            break;
                        }
                    }
                    assert (newCount != count);
                    count = newCount;

                    next = realloc(next, count, false);
                }
            }
        }

        return ret;
    }
711590
public static void printOnce(Object msg) {
		if (messagesCache.get(msg.hashCode()) == null) {
			JK.printBlock(msg);
			messagesCache.put(msg.hashCode(), msg);
		}
	}
1067095
public void verifyMessageSize(int maxMessageSize) {
       Iterator<MessageAndOffset> shallowIter =  internalIterator(true);
       while(shallowIter.hasNext()) {
           MessageAndOffset messageAndOffset = shallowIter.next();
           int payloadSize = messageAndOffset.message.payloadSize();
           if(payloadSize > maxMessageSize) {
               throw new MessageSizeTooLargeException("payload size of " + payloadSize + " larger than " + maxMessageSize);
           }
       }
    }
101135
public void increaseBackpressure(int messageSize)
    {
        assert(m_expectedThreadId == Thread.currentThread().getId());
        if (messageSize < 1) {
            throw new IllegalArgumentException("Message size must be > 0 but was " + messageSize);
        }
        m_pendingTxnBytes += messageSize;
        m_pendingTxnCount++;

        checkAndLogInvariants();
        if (m_pendingTxnBytes > MAX_DESIRED_PENDING_BYTES || m_pendingTxnCount > MAX_DESIRED_PENDING_TXNS) {
            if (!m_hadBackPressure) {
                hostLog.debug("TXN back pressure began");
                m_hadBackPressure = true;
                for (ACGMember m : m_members) {
                    m.onBackpressure();
                }
            }
        }
    }
970378
public @Nonnull StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message) {
        if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(message)) {
            messageMap.put(new MessageKey(Locale.getDefault(), code), message);
        }
        return this;
    }
540528
public void d(final String msg) {
        logMgr.log(tag, LogLevelConst.DEBUG, msg, null);
    }
329100
public void updateDialogMsg(final int resId) {
        if (dialog != null) {
            this.dialog.setMessage(dialog.getContext().getText(resId));
        }
    }
909394
protected final void checkResize() {
        if (size == table.length) { // size / table.length > DENSITY
            int forSize = table.length + 1; // size + 1;
            for (int i=0, newCapacity = MIN_CAPA; i < PRIMES.length; i++, newCapacity <<= 1) {
                if (newCapacity > forSize) {
                    resize(PRIMES[i]);
                    return;
                }
            }
            return;
        }
    }
273108
public void setErrorMessage(String msg) {
        if (msg != null && msg.trim().length() > 0) {
            errorMessage = msg;
        }
    }
77615
private void prependMessage( String s )
    {
        if ( s == null )
            return;

        if ( message == null )
            message = s;
        else
            message = s + " : "+ message;
    }