

class Pair {
	boolean MaleInfected= false;
	boolean FemaleInfected=false;
	boolean MalePromiscuous=false;
	boolean FemalePromiscuous=false;
	boolean MaleAlive=true;
	boolean FemaleAlive=true;
	static double MaleToFemaleRate=0.07;
	static double FemaleToMaleRate=0.02;
	static double MalePromiscuityFactor=1.00;
	static double FemalePromiscuityFactor=0.05;
	static int InfectedLifespan=100;
	int MaleDeathDate=999999;
	int FemaleDeathDate=999999;
	
	public final void InterCoupleFluidExchange(int Day){
		// See whether aids is transmitted between both pairs.
		if (MaleAlive && FemaleAlive ) {
		if (MaleInfected && !FemaleInfected) {
			if (Math.random()<MaleToFemaleRate) {
				FemaleInfected = true;
				FemaleDeathDate=Day+InfectedLifespan;
				
	 		}
		} else if (FemaleInfected && !MaleInfected) {
			if (Math.random()<FemaleToMaleRate) {
				MaleInfected = true;
				MaleDeathDate= Day+InfectedLifespan;
			}
		}}
	}
	
	public final void MaleIntramuralFluidExchange(Pair other, int Day){
		// See whether a man in the pair succeeds in approaching
		// and transmitting aids to another.
		 
		if (MaleAlive && MalePromiscuous && other.FemaleAlive) {
			if ((MaleInfected) &&   (!other.FemaleInfected)) {
		  	  if (Math.random()<MalePromiscuityFactor) {
		 	  if (other.FemalePromiscuous) {
		  	  if (Math.random()<FemalePromiscuityFactor) {
		  	  if (Math.random()<MaleToFemaleRate){ 
		  	  other.FemaleDeathDate=Day+InfectedLifespan;
		  	  other.FemaleInfected = true; 
		  	  }}}}}
		 	else {
				if ((!MaleInfected) && (other.FemaleInfected)) {
				if (other.FemalePromiscuous) {
				if (Math.random()<FemalePromiscuityFactor) {
				if (Math.random()<MalePromiscuityFactor) {
				if (Math.random()<FemaleToMaleRate) { 
				MaleDeathDate=Day+InfectedLifespan;
				MaleInfected = true; 
			}}}}}};
		}
	}
	
	
	public final void TestDeath(int Day){
		if ((Day>=MaleDeathDate) && MaleAlive){
			MaleAlive = false;
		};
		if ((Day>=FemaleDeathDate) && FemaleAlive){
			FemaleAlive = false;
		} 
	}
	
}

