EgorBaranovEnjoysTyping commented on code in PR #13262:
URL: https://github.com/apache/ignite/pull/13262#discussion_r3482021061
##########
modules/commons/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java:
##########
@@ -270,6 +264,124 @@ private GridStringBuilder onWrite(int lenBeforeWrite) {
return onWrite(curLen);
}
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int offset, String str) {
+ str = GridToStringNode.recoverObject(str);
+ int headLengthLimit = lenLimit.getHeadLengthLimit();
+ if (offset < headLengthLimit) {
+ impl().insert(offset, str);
+ if (lenLimit.overflowed(this)) {
+ String tailCandidate = impl().substring(headLengthLimit);
+ if (tail == null)
+ tail = lenLimit.createTail();
+ tail.insert(0, tailCandidate);
+ impl().setLength(headLengthLimit);
+ }
+ return this;
+ }
+ tail.insert(offset - headLengthLimit, str);
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int idx, char[] str, int off, int
len) {
+ StringBuilder strBuilder = new StringBuilder();
+ for (int i = 0; i < len; i++)
+ strBuilder.append(str[i + off]);
+ return i(idx, strBuilder.toString());
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, Object obj) {
+ return i(off, String.valueOf(obj));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, char[] str) {
+ return i(off, new String(str));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int dstOff, CharSequence s) {
+ s = GridToStringNode.recoverObject(s);
+ StringBuilder strBuilder = new StringBuilder();
+ for (int i = 0; i < s.length(); i++)
+ strBuilder.append(s.charAt(i));
+ return i(dstOff, strBuilder.toString());
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int dstOff, CharSequence s, int
start, int end) {
+ s = GridToStringNode.recoverObject(s);
+ StringBuilder strBuilder = new StringBuilder();
+ for (int i = start; i < end; i++)
+ strBuilder.append(s.charAt(i));
+ return i(dstOff, strBuilder.toString());
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, boolean b) {
+ return super.i(off, String.valueOf(b));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, char c) {
+ return super.i(off, String.valueOf(c));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, int i) {
+ return super.i(off, String.valueOf(i));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, long l) {
+ return super.i(off, String.valueOf(l));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, float f) {
+ return super.i(off, String.valueOf(f));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder i(int off, double d) {
+ return super.i(off, String.valueOf(d));
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder d(int start, int end) {
+ throw new UnsupportedOperationException("Not supported by this
implementation");
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder d(int idx) {
+ throw new UnsupportedOperationException("Not supported by this
implementation");
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder r(int start, int end, String str) {
+ throw new UnsupportedOperationException("Not supported by this
implementation");
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStringBuilder nl() {
+ return a(CommonUtils.nl());
+ }
+
+ /** {@inheritDoc} */
+ @Override public int length() {
+ int length = super.length();
+ if (tail != null)
+ length += tail.getSkipped() + tail.length();
+ return length;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void setLength(int len) {
+ throw new UnsupportedOperationException("setLength is not supported by
this imlementation");
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]