FlowBlockNode.java
/*
** Module : FlowBlockNode.java
** Abstract : Encodes a single node in the flow chart, associated with a block node.
**
** Copyright (c) 2018, Golden Code Development Corporation.
**
** -#- -I- --Date-- ---------------------------------Description----------------------------------
** 001 CA 20181003 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 com.goldencode.ast.*;
/**
* Defines a node associated with a 4GL block.
*/
public class FlowBlockNode
extends FlowAstNode
{
/** Flag identifying this node as a block (required by the JS side, to identify it). */
private boolean block;
/** The block's label as set in the legacy source code. */
private String blockLabel;
/** The block's ON QUIT phrase (if any). */
private String onQuit;
/** The block's ON STOP phrase (if any). */
private String onStop;
/** The block's ON ERROR phrase (if any). */
private String onError;
/** The block's ON ENDKEY phrase (if any). */
private String onEndkey;
/** Flag marking this as a legacy full-transaction block. */
private boolean transaction;
/** Comma-separated values of buffer names defined in this block's header. */
private String buffers;
/** The frame name defined in this block's header. */
private String frame;
/** The WHILE expression defined in this block's header. */
private String whileExpr;
/** The TO expression defined in this block's header. */
private String toExpr;
/** Flag marking this block with a complex header. */
private boolean withHeader = false;
/**
* Create an instance.
*
* @param id
* The node's ID.
* @param ast
* The associated AST.
* @param type
* The node's type.
* @param text
* The node's text.
* @param line
* The node's line.
* @param column
* The node's column.
*/
public FlowBlockNode(int id, Aast ast, String type, String text, int line, int column)
{
super(id, ast, type, text.toUpperCase(), line, column);
this.block = true;
}
/**
* Get the node's {@link #block} flag.
*
* @return See above.
*/
public boolean isBlock()
{
return block;
}
/**
* Set the node's {@link #block} flag.
*
* @param block
* The new value.
*/
public void setBlock(boolean block)
{
this.block = block;
}
/**
* Get the node's {@link #blockLabel label}. May be <code>null</code>.
*
* @return See above.
*/
public String getBlockLabel()
{
return blockLabel;
}
/**
* Set the block's {@link #blockLabel label}.
*
* @param blockLabel
* The label value.
*/
public void setBlockLabel(String blockLabel)
{
this.blockLabel = blockLabel;
}
/**
* Get the block's {@link #onQuit ON QUIT} phrase. May be <code>null</code>.
*
* @return See above.
*/
public String getOnQuit()
{
return onQuit;
}
/**
* Set the node's {@link #onQuit ON QUIT} phrase.
*
* @param onQuit
* The new value.
*/
public void setOnQuit(String onQuit)
{
this.onQuit = onQuit;
}
/**
* Get the block's {@link #onStop ON STOP} phrase. May be <code>null</code>.
*
* @return See above.
*/
public String getOnStop()
{
return onStop;
}
/**
* Set the node's {@link #onStop ON STOP} phrase.
*
* @param onStop
* The new value.
*/
public void setOnStop(String onStop)
{
this.onStop = onStop;
}
/**
* Get the block's {@link #onError ON ERROR} phrase. May be <code>null</code>.
*
* @return See above.
*/
public String getOnError()
{
return onError;
}
/**
* Set the node's {@link #onError ON ERROR} phrase.
*
* @param onError
* The new value.
*/
public void setOnError(String onError)
{
this.onError = onError;
}
/**
* Get the block's {@link #onEndkey ON ENDKEY} phrase. May be <code>null</code>.
*
* @return See above.
*/
public String getOnEndkey()
{
return onEndkey;
}
/**
* Set the node's {@link #onEndkey ON ENDKEY} phrase.
*
* @param onEndkey
* The new value.
*/
public void setOnEndkey(String onEndkey)
{
this.onEndkey = onEndkey;
}
/**
* Get this block's {@link #transaction} flag.
*
* @return See above.
*/
public boolean isTransaction()
{
return transaction;
}
/**
* Set this block's {@link #transaction} flag.
*
* @param transaction
* The new value.
*/
public void setTransaction(boolean transaction)
{
this.transaction = transaction;
}
/**
* Get the block's list of {@link #buffers}. May be <code>null</code>.
*
* @return See above.
*/
public String getBuffers()
{
return buffers;
}
/**
* Set the block's list of {@link #buffers}.
*
* @param buffers
* Comma-separated list of buffer names or <code>null</code>.
*/
public void setBuffers(String buffers)
{
this.buffers = buffers;
}
/**
* Get the block's {@link #frame} name. May be <code>null</code>.
*
* @return See above.
*/
public String getFrame()
{
return frame;
}
/**
* Set the block's {@link #frame} name.
*
* @param frame
* The frame name or <code>null</code>.
*/
public void setFrame(String frame)
{
this.frame = frame;
}
/**
* Get the block's {@link #whileExpr WHILE} expression. May be <code>null</code>.
*
* @return See above.
*/
public String getWhileExpr()
{
return whileExpr;
}
/**
* Set the block's {@link #whileExpr WHILE} expression.
*
* @param whileExpr
* The WHILE expression. May be <code>null</code>.
*/
public void setWhileExpr(String whileExpr)
{
this.whileExpr = whileExpr;
}
/**
* Get the block's {@link #toExpr TO} expression. May be <code>null</code>.
*
* @return See above.
*/
public String getToExpr()
{
return toExpr;
}
/**
* Set the block's {@link #toExpr TO} expression.
*
* @param toExpr
* The TO expression. May be <code>null</code>.
*/
public void setToExpr(String toExpr)
{
this.toExpr = toExpr;
}
/**
* Get the block's {@link #withHeader} state.
*
* @return See above.
*/
public boolean isWithHeader()
{
return withHeader;
}
/**
* Set the block's {@link #withHeader} state.
*
* @param withHeader
* The new flag state.
*/
public void setWithHeader(boolean withHeader)
{
this.withHeader = withHeader;
}
}