import java.io.Serializable;



public class CdbTuple implements Serializable {

	

	

	/**

	 * for serialization

	 */

	private static final long serialVersionUID = -8537171694674323049L;



	/**

	 * Represents an addition bound matrix

	 */

	private ABMatrix abm;

	

	/**

	 * names is a list of variable names associated with the rows and columns

	 */

	private String[] names;

	

	/**

	 * The do nothing constructor, you will probably want to write a do 

	 * something constructor.

	 */

	public CdbTuple()

	{

		abm = null;

		names = null;

	}

	

	public CdbTuple(ABMatrix mat, String[] names )

	{

		abm = mat;

		this.names = names;

	}

	

	public boolean satisfiable()

	{

		// TODO 

        int m=0;

        int e =abm.M;

        boolean flag;

        while(m <= Math.log(e+1.0))

        {

                m=m+1;

                for(int i=0;i<e;i++){

                        for(int j=0;j<e;j++){

                                for(int k=0;k<e;k++){



                                	abm.matrix[i][j]=Math.max(abm.matrix[i][j], 

                                			(abm.matrix[i][k]+abm.matrix[k][j]));

                                }

                        }

                }

        }

        flag=true;

        //System.out.println("Satisfiable");



        for(int i=0;i<e;i++){

                if(abm.matrix[i][i]>0)

                        flag=false;

                //System.out.println("UnSatisfiable");

        }



        return flag;

	}

}
