<commit_before>package hr.fer.zemris.vhdllab.applets.schema2.model;

import hr.fer.zemris.vhdllab.applets.schema2.enums.EComponentType;
import hr.fer.zemris.vhdllab.applets.schema2.exceptions.NotImplementedException;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaComponent;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaComponentCollection;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaInfo;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaWire;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaWireCollection;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.IVHDLSegmentProvider;
import hr.fer.zemris.vhdllab.applets.schema2.misc.Caseless;
import hr.fer.zemris.vhdllab.applets.schema2.misc.PlacedComponent;
import hr.fer.zemris.vhdllab.applets.schema2.misc.SchemaPort;
import hr.fer.zemris.vhdllab.vhdl.model.CircuitInterface;
import hr.fer.zemris.vhdllab.vhdl.model.Direction;
import hr.fer.zemris.vhdllab.vhdl.model.Port;
import hr.fer.zemris.vhdllab.vhdl.model.Type;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;




/**
 * Na temelju info objekta ISchemaCorea generira
 * VHDL kod.
 * Koristi se unutar SchemaVHDLGeneratora.
 * 
 * @author Axel
 *
 */
public class SchemaInfo2VHDL {
	
	private static class WireMapping {
		public ISchemaWire wire;
		public Caseless inSingleName, outSingleName;
		public int ioins, ioouts, normins, normouts;
		public WireMapping(ISchemaWire w) {
			wire = w;
			inSingleName = outSingleName = null;
			ioins = ioouts = normins = normouts = 0;
		}
	}
	
	
	/* private fields */
	private StringBuilder sb;
	private ISchemaInfo info;
	private CircuitInterface circint;
	private Map<Caseless, Caseless> renamedsignals;
	
	/**
	 * Generira VHDL kod.
	 * 
	 * @param info
	 * @return
	 */
	public String generateVHDL(ISchemaInfo schemaInfo) {		
		info = schemaInfo;

		if (!isValid()) return null;
		
		sb = new StringBuilder();
		circint = info.getEntity().getCircuitInterface(schemaInfo);
		renamedsignals = new HashMap<Caseless, Caseless>();
		<commit_msg>- ne znam ni sam<commit_after>package hr.fer.zemris.vhdllab.applets.schema2.model;

import hr.fer.zemris.vhdllab.applets.schema2.enums.EComponentType;
import hr.fer.zemris.vhdllab.applets.schema2.exceptions.NotImplementedException;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaComponent;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaComponentCollection;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaInfo;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaWire;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.ISchemaWireCollection;
import hr.fer.zemris.vhdllab.applets.schema2.interfaces.IVHDLSegmentProvider;
import hr.fer.zemris.vhdllab.applets.schema2.misc.Caseless;
import hr.fer.zemris.vhdllab.applets.schema2.misc.PlacedComponent;
import hr.fer.zemris.vhdllab.applets.schema2.misc.SchemaPort;
import hr.fer.zemris.vhdllab.vhdl.model.CircuitInterface;
import hr.fer.zemris.vhdllab.vhdl.model.Direction;
import hr.fer.zemris.vhdllab.vhdl.model.Port;
import hr.fer.zemris.vhdllab.vhdl.model.Type;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;




/**
 * Na temelju info objekta ISchemaCorea generira
 * VHDL kod.
 * Koristi se unutar SchemaVHDLGeneratora.
 * 
 * @author Axel
 *
 */
public class SchemaInfo2VHDL {
	
	private static class WireMapping {
		public ISchemaWire wire;
		public Caseless inSingleName, outSingleName;
		public int ioins, ioouts, normins, normouts;
		public WireMapping(ISchemaWire w) {
			wire = w;
			inSingleName = outSingleName = null;
			ioins = ioouts = normins = normouts = 0;
		}
	}
	
	/* private fields */
	private StringBuilder sb;
	private ISchemaInfo info;
	private CircuitInterface circint;
	private Map<Caseless, Caseless> renamedsignals;
	
	/**
	 * Generira VHDL kod.
	 * 
	 * @param info
	 * @return
	 */
	public String generateVHDL(ISchemaInfo schemaInfo) {		
		info = schemaInfo;

		if (!isValid()) return null;
		
		sb = new StringBuilder();
		circint = info.getEntity().getCircuitInterface(schemaInfo);
		renamedsignals = new HashMap<Caseless, Caseless>();
		
{'fraction_non_alphanumeric': 0.10798781916139612, 'fraction_numerical': 0.006558913094401499, 'mean_word_length': 4.801630434782608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6443539', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1556, 'n_words': 258}