# AstNode.java

    /*
    ** Module   : AstNode.java
    ** Abstract : AST object easily represented in JSON using Jackson.
    **
    ** Copyright (c) 2017, Golden Code Development Corporation.
    **
    ** -#- -I- --Date-- ---------------------------------Description----------------------------------
    ** 001 ECF 20170523 First version.
    */
    /*
    ** This program is free software: you can redistribute it and/or modify
    ** it under the terms of the GNU Affero General Public License as
    ** published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
    **
    ** You may find a copy of the GNU Affero GPL version 3 at the following
    ** location: https://www.gnu.org/licenses/agpl-3.0.en.html
    **
    ** Additional terms under GNU Affero GPL version 3 section 7:
    **
    **   Under Section 7 of the GNU Affero GPL version 3, the following additional
    **   terms apply to the works covered under the License.  These additional terms
    **   are non-permissive additional terms allowed under Section 7 of the GNU
    **   Affero GPL version 3 and may not be removed by you.
    **
    **   0. Attribution Requirement.
    **
    **     You must preserve all legal notices or author attributions in the covered
    **     work or Appropriate Legal Notices displayed by works containing the covered
    **     work.  You may not remove from the covered work any author or developer
    **     credit already included within the covered work.
    **
    **   1. No License To Use Trademarks.
    **
    **     This license does not grant any license or rights to use the trademarks
    **     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
    **     of Golden Code Development Corporation. You are not authorized to use the
    **     name Golden Code, FWD, or the names of any author or contributor, for
    **     publicity purposes without written authorization.
    **
    **   2. No Misrepresentation of Affiliation.
    **
    **     You may not represent yourself as Golden Code Development Corporation or FWD.
    **
    **     You may not represent yourself for publicity purposes as associated with
    **     Golden Code Development Corporation, FWD, or any author or contributor to
    **     the covered work, without written authorization.
    **
    **   3. No Misrepresentation of Source or Origin.
    **
    **     You may not represent the covered work as solely your work.  All modified
    **     versions of the covered work must be marked in a reasonable way to make it
    **     clear that the modified work is not originating from Golden Code Development
    **     Corporation or FWD.  All modified versions must contain the notices of
    **     attribution required in this license.
    */

    package com.goldencode.p2j.report.server;

    import java.util.*;
    import com.fasterxml.jackson.annotation.*;

    /**
     * A single AST node, without object references to its parents or children. This form is more
     * suitable for serialization to and deserialization from JSON using Jackson, whereas the
     * original {@code Aast} can become too deeply nested a data structure for Jackson to handle.
     * Each instance stores the ID of its parent node (if any), so the hierarchy of nodes can be
     * restored on the client side.
     */
    public class AstNode
    {
       /** Unique ID */
       private long id = 0L;

       /** Unique ID of this node's parent, if any */
       @JsonProperty("pid")
       private long parentId = 0L;

       /** Token type */
       private int type = -1;

       /** Actual starting line number. */
       @JsonProperty("l0")
       private int actualStartLine = 0;

       /** Actual starting column number. */
       @JsonProperty("c0")
       private int actualStartColumn = 0;

       /** Actual ending line number. */
       @JsonProperty("l1")
       private int actualEndLine = 0;

       /** Actual ending column number. */
       @JsonProperty("c1")
       private int actualEndColumn = 0;

       /** Effective starting line number. */
       @JsonProperty("el0")
       private int effectiveStartLine = 0;

       /** Effective starting column number. */
       @JsonProperty("ec0")
       private int effectiveStartColumn = 0;

       /** Effective ending line number. */
       @JsonProperty("el1")
       private int effectiveEndLine = 0;

       /** Effective ending column number. */
       @JsonProperty("ec1")
       private int effectiveEndColumn = 0;

       /** Node text */
       private String text = null;

       /** Annotations map */
       private Map<String, Object> notes = null;

       /**
        * Getter for ID.
        *
        * @return  Unique AST ID.
        */
       public long getId()
       {
          return id;
       }

       /**
        * Setter for ID.
        *
        * @param   id
        *          Unique AST ID.
        */
       public void setId(long id)
       {
          this.id = id;
       }

       /**
        * Getter for parent ID.
        *
        * @return  Parent ID.
        */
       public long getParentId()
       {
          return parentId;
       }

       /**
        * Setter for parent ID.
        *
        * @param   parentId
        *          Parent ID.
        */
       public void setParentId(long parentId)
       {
          this.parentId = parentId;
       }

       /**
        * Getter for token type.
        *
        * @return  Token type.
        */
       public int getType()
       {
          return type;
       }

       /**
        * Setter for token type.
        *
        * @param   type
        *          Token type.
        */
       public void setType(int type)
       {
          this.type = type;
       }

       /**
        * Getter for actual starting line number.
        *
        * @return  Actual starting line number.
        */
       public int getActualStartLine()
       {
          return actualStartLine;
       }

       /**
        * Setter for actual starting line number.
        *
        * @param   actualStartLine
        *          Actual starting line number.
        */
       public void setActualStartLine(int actualStartLine)
       {
          this.actualStartLine = actualStartLine;
       }

       /**
        * Getter for actual starting column number.
        *
        * @return  Actual starting column number.
        */
       public int getActualStartColumn()
       {
          return actualStartColumn;
       }

       /**
        * Setter for actual starting column number.
        *
        * @param   actualStartColumn
        *          Actual starting column number.
        */
       public void setActualStartColumn(int actualStartColumn)
       {
          this.actualStartColumn = actualStartColumn;
       }

       /**
        * Getter for actual ending line number.
        *
        * @return  Actual ending line number.
        */
       public int getActualEndLine()
       {
          return actualEndLine;
       }

       /**
        * Setter for actual ending line number.
        *
        * @param   actualEndLine
        *          Actual ending line number.
        */
       public void setActualEndLine(int actualEndLine)
       {
          this.actualEndLine = actualEndLine;
       }

       /**
        * Getter for actual ending column number.
        *
        * @return  Actual ending column number.
        */
       public int getActualEndColumn()
       {
          return actualEndColumn;
       }

       /**
        * Setter for actual ending column number.
        *
        * @param   actualEndColumn
        *          Actual ending column number.
        */
       public void setActualEndColumn(int actualEndColumn)
       {
          this.actualEndColumn = actualEndColumn;
       }

       /**
        * Getter for effective starting line number.
        *
        * @return  Effective starting line number.
        */
       public int getEffectiveStartLine()
       {
          return effectiveStartLine;
       }

       /**
        * Setter for effective starting line number.
        *
        * @param   effectiveStartLine
        *          Effective starting line number.
        */
       public void setEffectiveStartLine(int effectiveStartLine)
       {
          this.effectiveStartLine = effectiveStartLine;
       }

       /**
        * Getter for effective starting column number.
        *
        * @return  Effective starting column number.
        */
       public int getEffectiveStartColumn()
       {
          return effectiveStartColumn;
       }

       /**
        * Setter for effective starting column number.
        *
        * @param   effectiveStartColumn
        *          Effective starting column number.
        */
       public void setEffectiveStartColumn(int effectiveStartColumn)
       {
          this.effectiveStartColumn = effectiveStartColumn;
       }

       /**
        * Getter for effective ending line number.
        *
        * @return  Effective ending line number.
        */
       public int getEffectiveEndLine()
       {
          return effectiveEndLine;
       }

       /**
        * Setter for effective ending line number.
        *
        * @param   effectiveEndLine
        *          Effective ending line number.
        */
       public void setEffectiveEndLine(int effectiveEndLine)
       {
          this.effectiveEndLine = effectiveEndLine;
       }

       /**
        * Getter for effective ending column number.
        *
        * @return  Effective ending column number.
        */
       public int getEffectiveEndColumn()
       {
          return effectiveEndColumn;
       }

       /**
        * Setter for effective ending column number.
        *
        * @param   effectiveEndColumn
        *          Effective ending column number.
        */
       public void setEffectiveEndColumn(int effectiveEndColumn)
       {
          this.effectiveEndColumn = effectiveEndColumn;
       }

       /**
        * Getter for text.
        *
        * @return  Text.
        */
       public String getText()
       {
          return text;
       }

       /**
        * Setter for text.
        *
        * @param   text
        *          Text.
        */
       public void setText(String text)
       {
          this.text = text;
       }

       /**
        * Getter for map of annotations.
        *
        * @return  Map of annotations (may be {@code null}.
        */
       public Map<String, Object> getNotes()
       {
          return notes;
       }

       /**
        * Setter for map of annotations.
        *
        * @param   notes
        *          Map of annotations (may be {@code null}.
        */
       public void setNotes(Map<String, Object> notes)
       {
          this.notes = notes;
       }
    }