package org.kne.cloud.network.klalb;

import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;

import org.kne.cloud.network.MultipurposeSocketAddress;

public class KLALBControllerConfigItem extends KLALBConfigItem {
	private String language;
	private boolean nogui;
	private String VirtualAddress;
	private Long VirtualASN;
	private List<InetAddress> DNS;
	private MultipurposeSocketAddress TCPListen;
	private MultipurposeSocketAddress UDPListen;
	private String VirtualSocketName;
	private List<MultipurposeSocketAddress>LineTable=new ArrayList<>();
	private List<MultipurposeSocketAddress>ConnectLineTable=new ArrayList<>();
	private List<MultipurposeSocketAddress>ntpServerTable=new ArrayList<>();
	private boolean denyLineTableQuery=false;
	private boolean denyLineTableBroadcast=false;
	private String congestionAlgorithm="BBR";
	private double burstLimit=1.20;
	private double delayUpperBound=1.20;
	private double delayLowerBound=1.15;
	private long nagleDelayTime=1000000L;
	private long linkNagleDelayTime=1000000L;
	private int linkConnectionsCount=1;
	private String TUNName=CONST.KLALB_S_RV6;
	
	public void setNetworkInterfaceExcepts(List<String> networkInterfaceExcepts) {
		NetworkInterfaceExcepts = networkInterfaceExcepts;
	}



	private List<String>NetworkInterfaceExcepts=new ArrayList<>();
	
	



	public List<String> getNetworkInterfaceExcepts() {
		return NetworkInterfaceExcepts;
	}


	public void setLanguage(String language) {
		this.language = language;
	}



	public KLALBControllerConfigItem(String type) {
		super(type);
	}

	

	public String getLanguage() {
		return language;
	}



	public String getVirtualSocketName() {
		return VirtualSocketName;
	}



	public void setVirtualSocketName(String virtualSocketName) {
		VirtualSocketName = virtualSocketName;
	}



	public boolean isNogui() {
		return nogui;
	}



	public void setNogui(boolean nogui) {
		this.nogui = nogui;
	}



	public String getVirtualAddress() {
		return VirtualAddress;
	}



	public void setVirtualAddress(String virtualAddress) {
		VirtualAddress = virtualAddress;
	}



	public Long getVirtualASN() {
		return VirtualASN;
	}



	public void setVirtualASN(Long virtualASN) {
		VirtualASN = virtualASN;
	}



	public List<InetAddress> getDNS() {
		return DNS;
	}



	public void setDNS(List<InetAddress> dNS) {
		DNS = dNS;
	}



	public MultipurposeSocketAddress getTCPListen() {
		return TCPListen;
	}



	public void setTCPListen(MultipurposeSocketAddress tCPListen) {
		TCPListen = tCPListen;
	}



	public MultipurposeSocketAddress getUDPListen() {
		return UDPListen;
	}



	public void setUDPListen(MultipurposeSocketAddress uDPListen) {
		UDPListen = uDPListen;
	}



	public List<MultipurposeSocketAddress> getLineTable() {
		return LineTable;
	}



	public void setLineTable(List<MultipurposeSocketAddress> lineTable) {
		LineTable = lineTable;
	}



	public List<MultipurposeSocketAddress> getConnectLineTable() {
		return ConnectLineTable;
	}



	public void setConnectLineTable(List<MultipurposeSocketAddress> connectLineTable) {
		ConnectLineTable = connectLineTable;
	}

	

	public List<MultipurposeSocketAddress> getNtpServerTable() {
		return ntpServerTable;
	}




	public void setNtpServerTable(List<MultipurposeSocketAddress> ntpServerTable) {
		this.ntpServerTable = ntpServerTable;
	}

	





	public String getCongestionAlgorithm() {
		return congestionAlgorithm;
	}




	public void setCongestionAlgorithm(String congestionAlgorithm) {
		this.congestionAlgorithm = congestionAlgorithm;
	}


	

	
	
	public double getBurstLimit() {
		return burstLimit;
	}


	public void setBurstLimit(double burstLimit) {
		this.burstLimit = burstLimit;
	}


	public double getDelayUpperBound() {
		return delayUpperBound;
	}




	public void setDelayUpperBound(double delayUpperBound) {
		this.delayUpperBound = delayUpperBound;
	}




	public double getDelayLowerBound() {
		return delayLowerBound;
	}




	public void setDelayLowerBound(double delayLowerBound) {
		this.delayLowerBound = delayLowerBound;
	}
	



	public boolean isDenyLineTableQuery() {
		return denyLineTableQuery;
	}


	public void setDenyLineTableQuery(boolean denyLineTableQuery) {
		this.denyLineTableQuery = denyLineTableQuery;
	}


	public boolean isDenyLineTableBroadcast() {
		return denyLineTableBroadcast;
	}


	public void setDenyLineTableBroadcast(boolean denyLineTableBroadcast) {
		this.denyLineTableBroadcast = denyLineTableBroadcast;
	}


	public long getNagleDelayTime() {
		return nagleDelayTime;
	}


	public void setNagleDelayTime(long nagleDelayTime) {
		this.nagleDelayTime = nagleDelayTime;
	}

	
	public int getLinkConnectionsCount() {
		return linkConnectionsCount;
	}

	

	public void setLinkConnectionsCount(int linkConnectionsCount) {
		this.linkConnectionsCount = linkConnectionsCount;
	}

	
	public long getLinkNagleDelayTime() {
		return linkNagleDelayTime;
	}


	public void setLinkNagleDelayTime(long linkNagleDelayTime) {
		this.linkNagleDelayTime = linkNagleDelayTime;
	}


	public String getTUNName() {
		return TUNName;
	}


	public void setTUNName(String tUNName) {
		TUNName = tUNName;
	}


	@Override
	public String toString() {
		return "KLALBControllerConfigItem [language=" + language + ", nogui=" + nogui + ", VirtualAddress="
				+ VirtualAddress + ", VirtualASN=" + VirtualASN + ", DNS=" + DNS + ", TCPListen=" + TCPListen
				+ ", UDPListen=" + UDPListen + ", VirtualSocketName=" + VirtualSocketName + ", LineTable=" + LineTable
				+ ", ConnectLineTable=" + ConnectLineTable + ", ntpServerTable=" + ntpServerTable
				+ ", denyLineTableQuery=" + denyLineTableQuery + ", denyLineTableBroadcast=" + denyLineTableBroadcast
				+ ", congestionAlgorithm=" + congestionAlgorithm + ", delayUpperBound=" + delayUpperBound
				+ ", delayLowerBound=" + delayLowerBound + ", nagleDelayTime=" + nagleDelayTime
				+ ", linkNagleDelayTime=" + linkNagleDelayTime + ", linkConnectionsCount=" + linkConnectionsCount
				+ ", TUNName=" + TUNName + ", NetworkInterfaceExcepts=" + NetworkInterfaceExcepts + "]";
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((ConnectLineTable == null) ? 0 : ConnectLineTable.hashCode());
		result = prime * result + ((DNS == null) ? 0 : DNS.hashCode());
		result = prime * result + ((LineTable == null) ? 0 : LineTable.hashCode());
		result = prime * result + ((NetworkInterfaceExcepts == null) ? 0 : NetworkInterfaceExcepts.hashCode());
		result = prime * result + ((TCPListen == null) ? 0 : TCPListen.hashCode());
		result = prime * result + ((TUNName == null) ? 0 : TUNName.hashCode());
		result = prime * result + ((UDPListen == null) ? 0 : UDPListen.hashCode());
		result = prime * result + ((VirtualASN == null) ? 0 : VirtualASN.hashCode());
		result = prime * result + ((VirtualAddress == null) ? 0 : VirtualAddress.hashCode());
		result = prime * result + ((VirtualSocketName == null) ? 0 : VirtualSocketName.hashCode());
		result = prime * result + ((congestionAlgorithm == null) ? 0 : congestionAlgorithm.hashCode());
		long temp;
		temp = Double.doubleToLongBits(delayLowerBound);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(delayUpperBound);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + (denyLineTableBroadcast ? 1231 : 1237);
		result = prime * result + (denyLineTableQuery ? 1231 : 1237);
		result = prime * result + ((language == null) ? 0 : language.hashCode());
		result = prime * result + linkConnectionsCount;
		result = prime * result + (int) (linkNagleDelayTime ^ (linkNagleDelayTime >>> 32));
		result = prime * result + (int) (nagleDelayTime ^ (nagleDelayTime >>> 32));
		result = prime * result + (nogui ? 1231 : 1237);
		result = prime * result + ((ntpServerTable == null) ? 0 : ntpServerTable.hashCode());
		return result;
	}



	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		KLALBControllerConfigItem other = (KLALBControllerConfigItem) obj;
		if (ConnectLineTable == null) {
			if (other.ConnectLineTable != null)
				return false;
		} else if (!ConnectLineTable.equals(other.ConnectLineTable))
			return false;
		if (DNS == null) {
			if (other.DNS != null)
				return false;
		} else if (!DNS.equals(other.DNS))
			return false;
		if (LineTable == null) {
			if (other.LineTable != null)
				return false;
		} else if (!LineTable.equals(other.LineTable))
			return false;
		if (NetworkInterfaceExcepts == null) {
			if (other.NetworkInterfaceExcepts != null)
				return false;
		} else if (!NetworkInterfaceExcepts.equals(other.NetworkInterfaceExcepts))
			return false;
		if (TCPListen == null) {
			if (other.TCPListen != null)
				return false;
		} else if (!TCPListen.equals(other.TCPListen))
			return false;
		if (TUNName == null) {
			if (other.TUNName != null)
				return false;
		} else if (!TUNName.equals(other.TUNName))
			return false;
		if (UDPListen == null) {
			if (other.UDPListen != null)
				return false;
		} else if (!UDPListen.equals(other.UDPListen))
			return false;
		if (VirtualASN == null) {
			if (other.VirtualASN != null)
				return false;
		} else if (!VirtualASN.equals(other.VirtualASN))
			return false;
		if (VirtualAddress == null) {
			if (other.VirtualAddress != null)
				return false;
		} else if (!VirtualAddress.equals(other.VirtualAddress))
			return false;
		if (VirtualSocketName == null) {
			if (other.VirtualSocketName != null)
				return false;
		} else if (!VirtualSocketName.equals(other.VirtualSocketName))
			return false;
		if (congestionAlgorithm == null) {
			if (other.congestionAlgorithm != null)
				return false;
		} else if (!congestionAlgorithm.equals(other.congestionAlgorithm))
			return false;
		if (Double.doubleToLongBits(delayLowerBound) != Double.doubleToLongBits(other.delayLowerBound))
			return false;
		if (Double.doubleToLongBits(delayUpperBound) != Double.doubleToLongBits(other.delayUpperBound))
			return false;
		if (denyLineTableBroadcast != other.denyLineTableBroadcast)
			return false;
		if (denyLineTableQuery != other.denyLineTableQuery)
			return false;
		if (language == null) {
			if (other.language != null)
				return false;
		} else if (!language.equals(other.language))
			return false;
		if (linkConnectionsCount != other.linkConnectionsCount)
			return false;
		if (linkNagleDelayTime != other.linkNagleDelayTime)
			return false;
		if (nagleDelayTime != other.nagleDelayTime)
			return false;
		if (nogui != other.nogui)
			return false;
		if (ntpServerTable == null) {
			if (other.ntpServerTable != null)
				return false;
		} else if (!ntpServerTable.equals(other.ntpServerTable))
			return false;
		return true;
	}



	
}
