
/*
 * CostStructure.class
 * Part of package project
 *
 * Author: Philip Bradley
 *
 */

package project;

import java.io.*;

/*
 * The cost of a vertex is a tuple (i,x) where i is the 
 * internal cost and x is the external cost.
 *
 * External cost = number of edges from that vertex to vertices in different partitions.
 * Internal cost = number of edges from that vertex to vertices in the same partition.
 *
 * The data members internal and external really should be private and accessed via accessor 
 * and mutator methods below but for efficiency reasons, they are just accessed directly.
 *
 */


public class CostStructure implements Cloneable, Serializable {
        public int internal;
        public int external;

        public CostStructure() {
                internal = 0;
                external = 0;
        }

        public Object clone() {
                Object o = null;
                try {
                        o = super.clone();
                } catch (CloneNotSupportedException e) {
                        System.err.println("Error: Failed clone of Class costStructure or derived class");
                        System.err.println(e.getMessage());
                }
                return(o);
        }

        public String toString() {
                return(internal + ":" + external);
        }

	// The methods below provide the proper interface to the data elements. 
	// These can be used but are not used in the context of the project.
	public int getInternalCost() {
		return(internal);
	}
		
	public int getExternalCost() { 
		return(external);
	}

	public void setInternalCost(int newCost) {
		internal = newCost;
	}

	public void setExternalCost(int newCost) {
		external = newCost;
	}
}

