001    /*
002     * Created by IntelliJ IDEA. User: rrmohan Date: Jan 19, 2003 Time: 5:12:20 PM
003     * To change template for new class use Code Style | Class Templates options
004     * (Tools | IDE Options).
005     */
006    package aima.util;
007    
008    import aima.basic.XYLocation;
009    
010    /**
011     * @author Ravi Mohan
012     * 
013     */
014    public class Calculator {
015    
016            public static int calculateSquareOfDistanceBetweenLocations(
017                            XYLocation loc1, XYLocation loc2) {
018                    int xdifference = loc1.getXCoOrdinate() - loc2.getXCoOrdinate();
019                    int ydifference = loc1.getYCoOrdinate() - loc2.getYCoOrdinate();
020                    return (xdifference * xdifference) + (ydifference * ydifference);
021    
022            }
023    }