public void test1() { Red<String> redString = new Red<String>() {}; Red<Integer> redInteger = new Red<Integer>() {}; assertEquals(String.class, redString.getClassDirect()); assertEquals(Integer.class, redInteger.getClassDirect()); Red<String>.Yellow<Integer> yellowInteger = redString.new Yellow<Integer>(redInteger) {}; assertEquals(Integer.class, yellowInteger.getClassA()); assertEquals(Integer.class, yellowInteger.getClassB()); assertEquals(String.class, yellowInteger.getA().getClassDirect()); assertEquals(Integer.class, yellowInteger.getB().getClassDirect()); }
public static void shootRedWeapon(GameObject shooter) { Red redShoot; if (shooter instanceof CampaignShip) { if (isCampaignShipReadyToShoot(TypeShoot.RED)) { redShoot = new Red(shooter, 0, 0); int x = (int) (shooter.getX() + shooter.getWidth()); int y = (int) (shooter.getY() + shooter.getHeight() / 2); addToShoots(redShoot, x, y); } } else if (shooter instanceof RedEnemy) { redShoot = new Red(shooter, 0, 0); int x = (int) (shooter.getX() - redShoot.getWidth()); int y = (int) (shooter.getY() + shooter.getHeight() / 2); addToShoots(redShoot, x, y); } }