// Path: src/main/java/com/qoomon/banking/swift/message/exception/SwiftMessageParseException.java
// public class SwiftMessageParseException extends Exception {
// 
//     private final int lineNumber;
// 
//     public SwiftMessageParseException(String message, int lineNumber) {
//         super(message + " at line number " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(int lineNumber, Throwable cause) {
//         super("at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(BlockParseException e) {
//         super(e);
//         lineNumber = 0;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/PageReader.java
// public abstract class PageReader<T extends Page> {
// 
//     public final List<T> readAll() throws SwiftMessageParseException {
//         List<T> result = new LinkedList<>();
//         T page;
//         while ((page = read()) != null) {
//             result.add(page);
//         }
//         return result;
//     }
// 
//     public abstract T read() throws SwiftMessageParseException;
// 
//     public static void ensureValidField(GeneralField field, Set<String> expectedFieldTagSet, SwiftFieldReader fieldReader) {
//         if (field == null) {
//             throw new PageParserException("Expected field(s): " + join(", ", expectedFieldTagSet) + "," +
//                     " but was end of file", fieldReader.getFieldLineNumber());
//         }
//         if (!expectedFieldTagSet.contains(field.getTag())) {
//             throw new PageParserException("Expected field(s): " + join(", ", expectedFieldTagSet) + "," +
//                     " but was '" + field.getTag() + "'", fieldReader.getFieldLineNumber());
//         }
//     }
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/PageSeparator.java
// public final class PageSeparator  {
// 
//     private PageSeparator() {}
// 
//     public static final String TAG = "-";
// 
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/exception/PageParserException.java
// public class PageParserException extends RuntimeException {
// 
//     private final int lineNumber;
// 
//     public PageParserException(String message, int lineNumber) {
//         super(message + " at line number " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public PageParserException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public PageParserException(Throwable cause) {
//         super(cause);
//         this.lineNumber = 0;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }


import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.qoomon.banking.swift.message.exception.SwiftMessageParseException;
import com.qoomon.banking.swift.submessage.PageReader;
import com.qoomon.banking.swift.submessage.PageSeparator;
import com.qoomon.banking.swift.submessage.exception.PageParserException;
import com.qoomon.banking.swift.submessage.field.*;
import java.io.Reader;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
                        break;
                    }
                    case ClosingBalance.FIELD_TAG_62F:
                    case ClosingBalance.FIELD_TAG_62M: {
                        closingBalance = ClosingBalance.of(currentField);
                        nextValidFieldSet = ImmutableSet.of(
                                ClosingAvailableBalance.FIELD_TAG_64,
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case ClosingAvailableBalance.FIELD_TAG_64: {
                        closingAvailableBalance = ClosingAvailableBalance.of(currentField);
                        nextValidFieldSet = ImmutableSet.of(
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case ForwardAvailableBalance.FIELD_TAG_65: {
                        ForwardAvailableBalance forwardAvailableBalance = ForwardAvailableBalance.of(currentField);
                        forwardAvailableBalanceList.add(forwardAvailableBalance);
                        nextValidFieldSet = ImmutableSet.of(
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case InformationToAccountOwner.FIELD_TAG_86: {
// Path: src/main/java/com/qoomon/banking/swift/message/exception/SwiftMessageParseException.java
// public class SwiftMessageParseException extends Exception {
// 
//     private final int lineNumber;
// 
//     public SwiftMessageParseException(String message, int lineNumber) {
//         super(message + " at line number " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(int lineNumber, Throwable cause) {
//         super("at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public SwiftMessageParseException(BlockParseException e) {
//         super(e);
//         lineNumber = 0;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/PageReader.java
// public abstract class PageReader<T extends Page> {
// 
//     public final List<T> readAll() throws SwiftMessageParseException {
//         List<T> result = new LinkedList<>();
//         T page;
//         while ((page = read()) != null) {
//             result.add(page);
//         }
//         return result;
//     }
// 
//     public abstract T read() throws SwiftMessageParseException;
// 
//     public static void ensureValidField(GeneralField field, Set<String> expectedFieldTagSet, SwiftFieldReader fieldReader) {
//         if (field == null) {
//             throw new PageParserException("Expected field(s): " + join(", ", expectedFieldTagSet) + "," +
//                     " but was end of file", fieldReader.getFieldLineNumber());
//         }
//         if (!expectedFieldTagSet.contains(field.getTag())) {
//             throw new PageParserException("Expected field(s): " + join(", ", expectedFieldTagSet) + "," +
//                     " but was '" + field.getTag() + "'", fieldReader.getFieldLineNumber());
//         }
//     }
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/PageSeparator.java
// public final class PageSeparator  {
// 
//     private PageSeparator() {}
// 
//     public static final String TAG = "-";
// 
// }
// 
// Path: src/main/java/com/qoomon/banking/swift/submessage/exception/PageParserException.java
// public class PageParserException extends RuntimeException {
// 
//     private final int lineNumber;
// 
//     public PageParserException(String message, int lineNumber) {
//         super(message + " at line number " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public PageParserException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line number " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public PageParserException(Throwable cause) {
//         super(cause);
//         this.lineNumber = 0;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }


// Path: src/main/java/com/qoomon/banking/swift/submessage/mt940/MT940PageReader.java
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.qoomon.banking.swift.message.exception.SwiftMessageParseException;
import com.qoomon.banking.swift.submessage.PageReader;
import com.qoomon.banking.swift.submessage.PageSeparator;
import com.qoomon.banking.swift.submessage.exception.PageParserException;
import com.qoomon.banking.swift.submessage.field.*;
import java.io.Reader;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

                        break;
                    }
                    case ClosingBalance.FIELD_TAG_62F:
                    case ClosingBalance.FIELD_TAG_62M: {
                        closingBalance = ClosingBalance.of(currentField);
                        nextValidFieldSet = ImmutableSet.of(
                                ClosingAvailableBalance.FIELD_TAG_64,
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case ClosingAvailableBalance.FIELD_TAG_64: {
                        closingAvailableBalance = ClosingAvailableBalance.of(currentField);
                        nextValidFieldSet = ImmutableSet.of(
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case ForwardAvailableBalance.FIELD_TAG_65: {
                        ForwardAvailableBalance forwardAvailableBalance = ForwardAvailableBalance.of(currentField);
                        forwardAvailableBalanceList.add(forwardAvailableBalance);
                        nextValidFieldSet = ImmutableSet.of(
                                ForwardAvailableBalance.FIELD_TAG_65,
                                InformationToAccountOwner.FIELD_TAG_86,
                                PageSeparator.TAG);
                        break;
                    }
                    case InformationToAccountOwner.FIELD_TAG_86: {
                        if (previousField != null && previousField.getTag().equals(StatementLine.FIELD_TAG_61)) {