<commit_before>/**
 * IBM Confidential
 * OCO Source Materials
 * (C) Copyright IBM Corp. 2010, 2014
 * The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
 */

package com.ibm.bi.dml.lops;

import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ibm.bi.dml.lops.LopProperties.ExecLocation;
import com.ibm.bi.dml.lops.LopProperties.ExecType;
import com.ibm.bi.dml.lops.compile.Dag;
import com.ibm.bi.dml.parser.Expression.DataType;
import com.ibm.bi.dml.parser.Expression.ValueType;


/**
 * Base class for all Lops.
 */

public abstract class Lop 
{
	@SuppressWarnings("unused")
	private static final String _COPYRIGHT = "Licensed Materials - Property of IBM\n(C) Copyright IBM Corp. 2010, 2013\n" +
                                             "US Government Users Restricted Rights - Use, duplication  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.";
	
	/**
	 * Lop types
	 */
	public enum SimpleInstType {
		Scalar, Variable, File
	};

	public enum Type {
		Aggregate, MMCJ, Grouping, Data, Transform, UNARY, Binary, PartialAggregate, BinaryCP, UnaryCP, DataGen, ReBlock,  
		PartitionLop, CrossvalLop, GenericFunctionLop, ExtBuiltInFuncLop, ParameterizedBuiltin, 
		Tertiary, SortKeys, PickValues, CombineUnary, CombineBinary, CombineTertiary, MMRJ, CentralMoment, CoVariance, GroupedAgg, 
		Append, RangeReIndex, LeftIndex, ZeroOut, MVMult, MMTSJ, DataPartition, FunctionCallCP, CSVReBlock
	};

	public enum VISIT_STATUS {DONE, VISITING, NOTVISITED}

	protected static final Log LOG =  LogFactory.getLog(Lop.class.getName());
	
	private VISIT_STATUS _visited = VISIT_STATUS.NOTVISITED;
	
	// Boolean array to hold the list of nodes(lops) in the DAG that are reachable from this lop.
	private boolean[] reachable = null;
	private DataType _dataType;
	private ValueType _valueType;

	public static final String FILE_SEPARATOR = "/";
	public static final String PROCESS_PREFIX = "_p";
	
	//TODO MB: change delimiters to specific chars or check literals in script; otherwise potential conflicts on instruction serialization
	public static final String INSTRUCTION_DELIMITOR = "\u2021"; // "\u002c"; //",";
	public static final String OPERAND_DELIMITOR = "\u00b0"; //\u2021"; //00ea"; //"::#::";
	public static final String VALUETYPE_PREFIX = "\u00b7" ; //":#:";
	public static final String DATATYPE_PREFIX = VALUETYPE_PREFIX; //":#:";
	public static final String LITERAL_PREFIX = VALUETYPE_PREFIX; //":#:";
	public static final String NAME_VALUE_SEPARATOR = "="; // e.g., used in parameterized builtins
	public static final String VARIABLE_NAME_PLACEHOLDER = "##"; //TODO: use in LOPs 
	public static final String MATRIX_VAR_NAME_PREFIX = "0mVar";
	public static final String SCALAR_VAR_NAME_PREFIX = "0Var";
	
	/**
	 * get visit status of node
	 * 
	 * @return
	 */

	public VISIT_STATUS get_visited() {
		return _visited;
	}
	
	public boolean[] get_reachable() {
		return reachable;
	}

	public boolean[] create_reachable(int size) {
		reachable = new boolean[size];
		return reachable;
	}

	/**
	 * set visit status of node
	 * 
	 * @param visited
	 */
	public void set_visited(VISIT_STATUS visited) {<commit_msg>55555: SystemML Engine Enhancements - Changed the prefix for internal variable names. They now start with an underscore.<commit_after>/**
 * IBM Confidential
 * OCO Source Materials
 * (C) Copyright IBM Corp. 2010, 2014
 * The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
 */

package com.ibm.bi.dml.lops;

import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ibm.bi.dml.lops.LopProperties.ExecLocation;
import com.ibm.bi.dml.lops.LopProperties.ExecType;
import com.ibm.bi.dml.lops.compile.Dag;
import com.ibm.bi.dml.parser.Expression.DataType;
import com.ibm.bi.dml.parser.Expression.ValueType;


/**
 * Base class for all Lops.
 */

public abstract class Lop 
{
	@SuppressWarnings("unused")
	private static final String _COPYRIGHT = "Licensed Materials - Property of IBM\n(C) Copyright IBM Corp. 2010, 2013\n" +
                                             "US Government Users Restricted Rights - Use, duplication  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.";
	
	/**
	 * Lop types
	 */
	public enum SimpleInstType {
		Scalar, Variable, File
	};

	public enum Type {
		Aggregate, MMCJ, Grouping, Data, Transform, UNARY, Binary, PartialAggregate, BinaryCP, UnaryCP, DataGen, ReBlock,  
		PartitionLop, CrossvalLop, GenericFunctionLop, ExtBuiltInFuncLop, ParameterizedBuiltin, 
		Tertiary, SortKeys, PickValues, CombineUnary, CombineBinary, CombineTertiary, MMRJ, CentralMoment, CoVariance, GroupedAgg, 
		Append, RangeReIndex, LeftIndex, ZeroOut, MVMult, MMTSJ, DataPartition, FunctionCallCP, CSVReBlock
	};

	public enum VISIT_STATUS {DONE, VISITING, NOTVISITED}

	protected static final Log LOG =  LogFactory.getLog(Lop.class.getName());
	
	private VISIT_STATUS _visited = VISIT_STATUS.NOTVISITED;
	
	// Boolean array to hold the list of nodes(lops) in the DAG that are reachable from this lop.
	private boolean[] reachable = null;
	private DataType _dataType;
	private ValueType _valueType;

	public static final String FILE_SEPARATOR = "/";
	public static final String PROCESS_PREFIX = "_p";
	
	//TODO MB: change delimiters to specific chars or check literals in script; otherwise potential conflicts on instruction serialization
	public static final String INSTRUCTION_DELIMITOR = "\u2021"; // "\u002c"; //",";
	public static final String OPERAND_DELIMITOR = "\u00b0"; //\u2021"; //00ea"; //"::#::";
	public static final String VALUETYPE_PREFIX = "\u00b7" ; //":#:";
	public static final String DATATYPE_PREFIX = VALUETYPE_PREFIX; //":#:";
	public static final String LITERAL_PREFIX = VALUETYPE_PREFIX; //":#:";
	public static final String NAME_VALUE_SEPARATOR = "="; // e.g., used in parameterized builtins
	public static final String VARIABLE_NAME_PLACEHOLDER = "##"; //TODO: use in LOPs 
	public static final String MATRIX_VAR_NAME_PREFIX = "_mVar";
	public static final String SCALAR_VAR_NAME_PREFIX = "_Var";
	
	/**
	 * get visit status of node
	 * 
	 * @return
	 */

	public VISIT_STATUS get_visited() {
		return _visited;
	}
	
	public boolean[] get_reachable() {
		return reachable;
	}

	public boolean[] create_reachable(int size) {
		reachable = new boolean[size];
		return reachable;
	}

	/**
	 * set visit status of node
	 * 
	 * @param visited
	 */
	public void set_visited(VISIT_STATUS visited) {
{'fraction_non_alphanumeric': 0.1004593273077493, 'fraction_numerical': 0.011409097644095421, 'mean_word_length': 4.156608097784568, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6097953', 'n_tokens_mistral': 2294, 'n_tokens_neox': 2099, 'n_words': 652}