<commit_before>package de.fernunihagen.dna.jkn.scalephant.network.routing;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.fernunihagen.dna.jkn.scalephant.distribution.membership.DistributedInstance;

public class RoutingHeader {
	
	/**
	 * Is this a routed or a direct package?
	 */
	protected boolean routedPackage;
	
	/**
	 * The hop of the package
	 */
	protected short hop;
	
	/**
	 * The hops for this package
	 */
	protected List<DistributedInstance> routingList;

	/**
	 * The flag for direct packages
	 */
	public final static byte DIRECT_PACKAGE = 0x00;
	
	/**
	 * The flag for routed packages
	 */
	public final static byte ROUTED_PACKAGE = 0x01;

	/**
	 * The separator char for the host / hop list
	 */
	public final static String SEPARATOR_CHAR = ",";
	
	/**
	 * The Logger
	 */
	private final static Logger logger = LoggerFactory.getLogger(RoutingHeader.class);

	
	public RoutingHeader() {
	
	}
	
	@Override
	public String toString() {
		return "RoutingHeader [routedPackage=" + routedPackage + ", hop=" + hop + ", routingList=" + routingList + "]";
	}

	/**
	 * Is this a routed or a direct package
	 * @return
	 */
	public boolean isRoutedPackage() {
		return routedPackage;
	}

	/**
	 * Set routed flag
	 * @param routedPackage
	 */
	public void setRoutedPackage(final boolean routedPackage) {
		this.routedPackage = routedPackage;
	}

	/**
	 * Get the current hop
	 * @return
	 */
	public short getHop() {
		return hop;
	}

	/**
	 * Set the current hop
	 * @param hop
	 */
	public void setHop(final short hop) {
		this.hop = hop;
	}

	/**
	 * Get the list with hops
	 * @return
	 */
	public List<DistributedInstance> getHops() {
		return routingList;
	}

	/**
	 * Set the list with hops
	 * @param routingList
	 */
	public void setRoutingList(final List<DistributedInstance> routingList) {
		this.routingList = routingList;
	}
	
	/**
	 * Set the list with hops (as string list)
	 * @param stringRoutingList
	 */
	public void setRoutingList(final String stringRoutingList) {
		final String[] parts = stringRoutingList.split(SEPARATOR_CHAR);
		routingList.clear();
		
		for(final String hop : parts) {
			try {
				final DistributedInstance distributedInstance = new DistributedInstance(hop);
				routingList.add(distributedInstance);
			} catch(IllegalArgumentException e) {
				logger.warn("Unable to parse as distributed instance: " + hop);
			}
		}
	}
	
	/**
	 * Get the hop list as string list
	 * @return
	 */
	public String getHopList() {
		final StringBuilder sb = new StringBuilder();
		for(final DistributedInstance distributedInstance : routingList) {
			if(sb.length() != 0) {
				sb.append(SEPARATOR_CHAR);
			}
			sb.append(distributedInstance.getStringValue());
		}
		return sb.toString();
	}
	
}
<commit_msg>Changed naming<commit_after>package de.fernunihagen.dna.jkn.scalephant.network.routing;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.fernunihagen.dna.jkn.scalephant.distribution.membership.DistributedInstance;

public class RoutingHeader {
	
	/**
	 * Is this a routed or a direct package?
	 */
	protected boolean routedPackage;
	
	/**
	 * The hop of the package
	 */
	protected short hop;
	
	/**
	 * The hops for this package
	 */
	protected List<DistributedInstance> routingList;

	/**
	 * The flag for direct packages
	 */
	public final static byte DIRECT_PACKAGE = 0x00;
	
	/**
	 * The flag for routed packages
	 */
	public final static byte ROUTED_PACKAGE = 0x01;

	/**
	 * The separator char for the host / hop list
	 */
	public final static String SEPARATOR_CHAR = ",";
	
	/**
	 * The Logger
	 */
	private final static Logger logger = LoggerFactory.getLogger(RoutingHeader.class);

	
	public RoutingHeader() {
	
	}
	
	@Override
	public String toString() {
		return "RoutingHeader [routedPackage=" + routedPackage + ", hop=" + hop + ", routingList=" + routingList + "]";
	}

	/**
	 * Is this a routed or a direct package
	 * @return
	 */
	public boolean isRoutedPackage() {
		return routedPackage;
	}

	/**
	 * Set routed flag
	 * @param routedPackage
	 */
	public void setRoutedPackage(final boolean routedPackage) {
		this.routedPackage = routedPackage;
	}

	/**
	 * Get the current hop
	 * @return
	 */
	public short getHop() {
		return hop;
	}

	/**
	 * Set the current hop
	 * @param hop
	 */
	public void setHop(final short hop) {
		this.hop = hop;
	}

	/**
	 * Get the list with hops
	 * @return
	 */
	public List<DistributedInstance> getHops() {
		return routingList;
	}

	/**
	 * Set the list with hops
	 * @param routingList
	 */
	public void setRoutingList(final List<DistributedInstance> routingList) {
		this.routingList = routingList;
	}
	
	/**
	 * Set the list with hops (as string list)
	 * @param stringRoutingList
	 */
	public void setRoutingList(final String stringRoutingList) {
		final String[] parts = stringRoutingList.split(SEPARATOR_CHAR);
		routingList.clear();
		
		for(final String hop : parts) {
			try {
				final DistributedInstance distributedInstance = new DistributedInstance(hop);
				routingList.add(distributedInstance);
			} catch(IllegalArgumentException e) {
				logger.warn("Unable to parse as distributed instance: " + hop);
			}
		}
	}
	
	/**
	 * Get the hop list as string list
	 * @return
	 */
	public String getRoutingList() {
		final StringBuilder sb = new StringBuilder();
		for(final DistributedInstance distributedInstance : routingList) {
			if(sb.length() != 0) {
				sb.append(SEPARATOR_CHAR);
			}
			sb.append(distributedInstance.getStringValue());
		}
		return sb.toString();
	}
	
}

{'fraction_non_alphanumeric': 0.11077253988169923, 'fraction_numerical': 0.003226384656748521, 'mean_word_length': 3.4006309148264986, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4744200', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1678, 'n_words': 475}