import java.util.PriorityQueue; import java.util.Comparator; class Lab3 { static class Vertice { private float x; private float y; public float getX() { return x; } public float getY() { return y; } public Vertice(float x, float y) { this.x = x; this.y = y; } } static class Contorno { private double R; public boolean isContains(Vertice vertice) { return ( (Math.pow(vertice.getX(), 2) + Math.pow(vertice.getY(), 2) < Math.pow(R, 2) && vertice.getY() > 0 && vertice.getX() < 0) || (vertice.getX() < R && vertice.getY() < R && vertice.getX() >= 0 && vertice.getY() > 0) || (vertice.getX()+vertice.getY() > -R/2 && vertice.getX() < 0 && vertice.getY() <= 0) ); } public Contorno(double R) { this.R = Math.abs(R); } } public interface Animal { public void eat(); } public static void main(String [] args){ if(args.length != 1) { System.out.println("No arg R"); return; } Contorno contorno = new Contorno(new Double(args[0])); PriorityQueue queue = new PriorityQueue(9, new Comparator() { public int compare(Vertice vertice1, Vertice vertice2) { return (vertice1.getX() > vertice2.getX() ? 1 : -1); } }); queue.add(new Vertice(-1, 0)); queue.add(new Vertice(-3, 4)); queue.add(new Vertice(-1, 0)); queue.add(new Vertice(5, -5)); queue.add(new Vertice(0, 0)); queue.add(new Vertice(-4, -3)); queue.add(new Vertice(-1,- 1)); queue.add(new Vertice(0, 3)); queue.add(new Vertice(3, 3)); for(Vertice vertice : queue) if(!contorno.isContains(vertice)) System.out.println( "{" + vertice.getX() + ", " + vertice.getY() + "}"); } }