Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/main/java/com/amazon/ion/impl/IonRawTextWriter_1_1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class IonRawTextWriter_1_1 internal constructor(
output.appendAscii(" ")
}

override fun stepInTaglessElementList(macroId: Int, macroName: String?) {
override fun stepInTaglessElementList(macroId: Int, macroName: String?, lengthPrefixed: Boolean) {
stepInList(usingLengthPrefix = false) // Arg here doesn't actually matter.
writeMacroEncodingTag(macroName ?: macroId.toString())
output.appendAscii(" ")
Expand All @@ -470,7 +470,7 @@ class IonRawTextWriter_1_1 internal constructor(
output.appendAscii(" ")
}

override fun stepInTaglessElementSExp(macroId: Int, macroName: String?) {
override fun stepInTaglessElementSExp(macroId: Int, macroName: String?, lengthPrefixed: Boolean) {
stepInSExp(usingLengthPrefix = false) // Arg here doesn't actually matter.
writeMacroEncodingTag(macroName ?: macroId.toString())
output.appendAscii(" ")
Expand All @@ -482,11 +482,6 @@ class IonRawTextWriter_1_1 internal constructor(
currentContainer = EExpression
}

override fun writeTaglessInt(implicitOpcode: Int, value: Int) {
// TODO: Consider checking the opcode
writeInt(value.toLong())
}

override fun writeTaglessInt(implicitOpcode: Int, value: Long) {
writeInt(value)
}
Expand Down
23 changes: 20 additions & 3 deletions src/main/java/com/amazon/ion/impl/_Private_RecyclingQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public T next() {

/**
* @param initialCapacity the initial capacity of the underlying collection.
* @param elementFactory the factory used to create a new element on {@link #push()} when the queue has
* @param elementFactory the factory used to create a new element on {@link #push(Recycler)} when the queue has
* not previously grown to the new depth.
*/
public _Private_RecyclingQueue(int initialCapacity, ElementFactory<T> elementFactory) {
Expand All @@ -73,7 +73,7 @@ public T get(int index) {
/**
* Pushes an element onto the top of the queue, instantiating a new element only if the queue has not
* previously grown to the new depth.
* @return the element at the top of the queue after the push. This element must be initialized by the caller.
* @return the index of the element at the top of the queue after the push. This element must be initialized by the caller.
*/
public int push(Recycler<T> recycler) {
currentIndex++;
Expand All @@ -87,6 +87,23 @@ public int push(Recycler<T> recycler) {
return currentIndex;
}

/**
* Pushes an element onto the top of the queue, instantiating a new element only if the queue has not
* previously grown to the new depth.
* @return the element at the top of the queue after the push.
*/
public T pushAndGet(Recycler<T> recycler) {
currentIndex++;
if (currentIndex >= elements.size()) {
top = elementFactory.newElement();
elements.add(top);
} else {
top = elements.get(currentIndex);
}
recycler.recycle(top);
return top;
}

/**
* Reclaim the current element.
*/
Expand Down Expand Up @@ -119,4 +136,4 @@ public void clear() {
public int size() {
return currentIndex + 1;
}
}
}
Loading
Loading