// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/ItemType.java
// public interface ItemType extends ASTNode {
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/OccurrenceIndicator.java
// public class OccurrenceIndicator extends AbstractASTNode {
//     private enum Occurrence {
//         ZERO_OR_ONE('?'),
//         ZERO_OR_MORE('*'),
//         ONE_OR_MORE('+');
// 
//         final char syntax;
//         Occurrence(final char syntax) {
//             this.syntax = syntax;
//         }
//     }
// 
//     public static OccurrenceIndicator ZERO_OR_ONE = new OccurrenceIndicator(Occurrence.ZERO_OR_ONE);
//     public static OccurrenceIndicator ZERO_OR_MORE = new OccurrenceIndicator(Occurrence.ZERO_OR_MORE);
//     public static OccurrenceIndicator ONE_OR_MORE = new OccurrenceIndicator(Occurrence.ONE_OR_MORE);
// 
//     private final Occurrence occurrence;
// 
//     private OccurrenceIndicator(final Occurrence occurrence) {
//         this.occurrence = occurrence;
//     }
// 
//     public final static OccurrenceIndicator fromSyntax(final char syntax) {
//         for(final Occurrence occurrence : Occurrence.values()) {
//             if(occurrence.syntax == syntax) {
//                 return new OccurrenceIndicator(occurrence);
//             }
//         }
//         throw new IllegalArgumentException("No such occurrence: '" + syntax + "'");
//     }
// 
//     public char getSyntax() {
//         return occurrence.syntax;
//     }
// 
//     @Override
//     protected String describe() {
//         return "OccurrenceIndicator(" + getSyntax() + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof OccurrenceIndicator) {
//             return ((OccurrenceIndicator)obj).occurrence == occurrence;
//         }
// 
//         return false;
//     }
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/SequenceType.java
// public class SequenceType extends AbstractASTNode {
//     public final static SequenceType EMPTY_SEQUENCE = new SequenceType(null, null);
// 
//     @Nullable final ItemType itemType;
//     @Nullable final OccurrenceIndicator occurrenceIndicator;
// 
//     public SequenceType(final ItemType itemType, final OccurrenceIndicator occurrenceIndicator) {
//         this.itemType = itemType;
//         this.occurrenceIndicator = occurrenceIndicator;
//     }
// 
//     @Override
//     protected String describe() {
//         if(itemType == null && occurrenceIndicator == null) {
//             return "empty-sequence()";
//         } else {
//             return "SequenceType(" + itemType + (occurrenceIndicator == null ? "" : occurrenceIndicator) + ")";
//         }
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof SequenceType) {
//             final SequenceType other = (SequenceType)obj;
//             if(other.itemType == null && itemType == null) {
//                 if(other.occurrenceIndicator == null && occurrenceIndicator == null) {
//                     return true;
//                 } else if(other.occurrenceIndicator != null && occurrenceIndicator != null) {
//                     return other.occurrenceIndicator.equals(occurrenceIndicator);
//                 }
//             } else if(other.itemType != null && itemType != null) {
//                 if(other.itemType.equals(itemType)) {
//                     if(other.occurrenceIndicator == null && occurrenceIndicator == null) {
//                         return true;
//                     } else if(other.occurrenceIndicator != null && occurrenceIndicator != null) {
//                         return other.occurrenceIndicator.equals(occurrenceIndicator);
//                     }
//                 }
//             }
//         }
// 
//         return false;
//     }
// }


import org.jetbrains.annotations.Nullable;
import com.evolvedbinary.xpath.parser.ast.ItemType;
import com.evolvedbinary.xpath.parser.ast.OccurrenceIndicator;
import com.evolvedbinary.xpath.parser.ast.SequenceType;
/**
 * XPath 2 Parser
 * A Parser for XPath 2
 * Copyright (C) 2016 Evolved Binary Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.evolvedbinary.xpath.parser.ast.partial;


/**
 * Created by aretter on 12/02/2016.
 */
public class PartialSequenceType extends AbstractPartialASTNode<SequenceType, OccurrenceIndicator> {
    private final ItemType itemType;

    public PartialSequenceType(final ItemType itemType) {
        this.itemType = itemType;
    }

    @Override
    protected String describe() {
        return "SequenceType(" +  itemType + ", ?)";
    }

    @Override
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/ItemType.java
// public interface ItemType extends ASTNode {
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/OccurrenceIndicator.java
// public class OccurrenceIndicator extends AbstractASTNode {
//     private enum Occurrence {
//         ZERO_OR_ONE('?'),
//         ZERO_OR_MORE('*'),
//         ONE_OR_MORE('+');
// 
//         final char syntax;
//         Occurrence(final char syntax) {
//             this.syntax = syntax;
//         }
//     }
// 
//     public static OccurrenceIndicator ZERO_OR_ONE = new OccurrenceIndicator(Occurrence.ZERO_OR_ONE);
//     public static OccurrenceIndicator ZERO_OR_MORE = new OccurrenceIndicator(Occurrence.ZERO_OR_MORE);
//     public static OccurrenceIndicator ONE_OR_MORE = new OccurrenceIndicator(Occurrence.ONE_OR_MORE);
// 
//     private final Occurrence occurrence;
// 
//     private OccurrenceIndicator(final Occurrence occurrence) {
//         this.occurrence = occurrence;
//     }
// 
//     public final static OccurrenceIndicator fromSyntax(final char syntax) {
//         for(final Occurrence occurrence : Occurrence.values()) {
//             if(occurrence.syntax == syntax) {
//                 return new OccurrenceIndicator(occurrence);
//             }
//         }
//         throw new IllegalArgumentException("No such occurrence: '" + syntax + "'");
//     }
// 
//     public char getSyntax() {
//         return occurrence.syntax;
//     }
// 
//     @Override
//     protected String describe() {
//         return "OccurrenceIndicator(" + getSyntax() + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof OccurrenceIndicator) {
//             return ((OccurrenceIndicator)obj).occurrence == occurrence;
//         }
// 
//         return false;
//     }
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/SequenceType.java
// public class SequenceType extends AbstractASTNode {
//     public final static SequenceType EMPTY_SEQUENCE = new SequenceType(null, null);
// 
//     @Nullable final ItemType itemType;
//     @Nullable final OccurrenceIndicator occurrenceIndicator;
// 
//     public SequenceType(final ItemType itemType, final OccurrenceIndicator occurrenceIndicator) {
//         this.itemType = itemType;
//         this.occurrenceIndicator = occurrenceIndicator;
//     }
// 
//     @Override
//     protected String describe() {
//         if(itemType == null && occurrenceIndicator == null) {
//             return "empty-sequence()";
//         } else {
//             return "SequenceType(" + itemType + (occurrenceIndicator == null ? "" : occurrenceIndicator) + ")";
//         }
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof SequenceType) {
//             final SequenceType other = (SequenceType)obj;
//             if(other.itemType == null && itemType == null) {
//                 if(other.occurrenceIndicator == null && occurrenceIndicator == null) {
//                     return true;
//                 } else if(other.occurrenceIndicator != null && occurrenceIndicator != null) {
//                     return other.occurrenceIndicator.equals(occurrenceIndicator);
//                 }
//             } else if(other.itemType != null && itemType != null) {
//                 if(other.itemType.equals(itemType)) {
//                     if(other.occurrenceIndicator == null && occurrenceIndicator == null) {
//                         return true;
//                     } else if(other.occurrenceIndicator != null && occurrenceIndicator != null) {
//                         return other.occurrenceIndicator.equals(occurrenceIndicator);
//                     }
//                 }
//             }
//         }
// 
//         return false;
//     }
// }


// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/partial/PartialSequenceType.java
import org.jetbrains.annotations.Nullable;
import com.evolvedbinary.xpath.parser.ast.ItemType;
import com.evolvedbinary.xpath.parser.ast.OccurrenceIndicator;
import com.evolvedbinary.xpath.parser.ast.SequenceType;

/**
 * XPath 2 Parser
 * A Parser for XPath 2
 * Copyright (C) 2016 Evolved Binary Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.evolvedbinary.xpath.parser.ast.partial;


/**
 * Created by aretter on 12/02/2016.
 */
public class PartialSequenceType extends AbstractPartialASTNode<SequenceType, OccurrenceIndicator> {
    private final ItemType itemType;

    public PartialSequenceType(final ItemType itemType) {
        this.itemType = itemType;
    }

    @Override
    protected String describe() {
        return "SequenceType(" +  itemType + ", ?)";
    }

    @Override
    public SequenceType complete(@Nullable final OccurrenceIndicator occurrenceIndicator) {