Examples of Farm


Examples of ch.fusun.baron.farm.Farm

  }

  @SuppressWarnings("rawtypes")
  @Override
  public Collection<TileChild> getChildren(Tile model) {
    Farm farm = farmService.getFarm(model);
    Collection<TileChild> children = new ArrayList<TileChild>();
    if (farm != null) {
      children.add(new FarmTileChild(farm));
    }
    return children;
View Full Code Here

Examples of ch.fusun.baron.farm.Farm

  }

  private Collection<Farm> getFarmsForCountry(Country country) {
    List<Farm> farms = new LinkedList<Farm>();
    for (Tile tile : mapService.getTiles()) {
      Farm farm = farmService.getFarm(tile);
      if (farm != null) {
        if (country.equals(propertyService.getOwnership(tile))) {
          farms.add(farm);
        }
      }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

            }
        }

        if (toEmpty != toFeature) {
            boolean left = toEmpty.rotateCCW(Rotation.R90) == toFeature;
            Farm farm1 = (Farm) tile2.getFeaturePartOf(left ? toEmpty.getLeftFarm() : toEmpty.getRightFarm());
            Farm farm2 = (Farm) tile2.getFeaturePartOf(left ? toFeature.rev().getRightFarm() : toFeature.rev().getLeftFarm());

            if (farm1 != null && farm2 != null) {
//                System.err.println("    " + tile1.getPosition() + " <-->" + f2Pos + " / " + farm1 + " " + farm2);
                rating +=  futureConnectionRateFeatures(game, toEmpty, toFeature, chance, farm1, farm2);
            }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

    @Override
    public DeploymentCheckResult isDeploymentAllowed(Feature feature) {
        if (!(feature instanceof Farm)) {
            return new DeploymentCheckResult("The barn must be placed only on a farm.");
        }
        Farm farm = (Farm) feature;

        FarmScoreContext ctx = farm.getScoreContext();
        ctx.setCityCache(new HashMap<City, CityScoreContext>());
        farm.walk(ctx);

        if (!farm.getTile().getGame().hasRule(CustomRule.MULTI_BARN_ALLOWED)) {
            for (Special m : ctx.getSpecialMeeples()) {
                if (m instanceof Barn) {
                    return new DeploymentCheckResult("Another barn is already placed on the farm.");
                }
            }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

            }
        }
    }

    private boolean isBarnCorner(Location corner, Location positionChange) {
        Farm farm = null;
        Position pos = getTile().getPosition();
        for (int i = 0; i < 4; i++) {
            Tile tile = getBoard().get(pos);
            if (tile == null) return false;
            farm = (Farm) tile.getFeaturePartOf(corner);
            if (farm == null) return false;
            corner = corner.next();
            pos = pos.add(positionChange);
            positionChange = positionChange.next();
        }

        if (!game.hasRule(CustomRule.MULTI_BARN_ALLOWED)) {
            return !farm.walk(new IsOccupied().with(Barn.class));
        }

        return true;
    }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

        }
    }

    @Override
    public boolean visit(Feature feature) {
        Farm farm = (Farm) feature;
        if (farm.isAdjoiningCityOfCarcassonne()) {
            adjoiningCityOfCarcassonne = true;
        }
        if (farm.getAdjoiningCities() != null) {
            addAdjoiningCompletedCities(farm.getAdjoiningCities());
        }
        for (Meeple m : farm.getMeeples()) {
            if (m instanceof Pig) {
                pigs.add(m.getPlayer());
            }
        }
        if (farm.isPigHerd()) {
            pigHerd = true;
        }
        return super.visit(feature);
    }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

                    boolean hasCity = false;
                    int[] power = new int[getGame().getAllPlayers().length];

                    @Override
                    public boolean visit(Feature feature) {
                        Farm f = (Farm) feature;
                        processed.add(f);
                        size++;
                        hasCity = hasCity || f.getAdjoiningCities() != null || f.isAdjoiningCityOfCarcassonne();
                        for (Meeple m : f.getMeeples()) {
                            if (m instanceof Follower) {
                                power[m.getPlayer().getIndex()] += ((Follower)m).getPower();
                            }
                            if (m instanceof Barn) {
                                power[m.getPlayer().getIndex()] += 1;
                            }
                        }
                        Position pos = f.getTile().getPosition();
                        if (pos.x < x) {
                            if (x != Integer.MAX_VALUE) result.area.transform(AffineTransform.getTranslateInstance(FULL_SIZE * (x-pos.x), 0));
                            x = pos.x;
                        }
                        if (pos.y < y) {
                            if (y != Integer.MAX_VALUE) result.area.transform(AffineTransform.getTranslateInstance(0, FULL_SIZE * (y-pos.y)));
                            y = pos.y;
                        }
                        Map<Location, Area> tileAreas = areas.get(f.getTile());
                        if (tileAreas != null) { //sync issue, feature can be extended in other thread, so it is not registered in areas yet
                            Area featureArea = new Area(tileAreas.get(f.getLocation()));
                            featureArea.transform(AffineTransform.getTranslateInstance(FULL_SIZE * (pos.x-x), FULL_SIZE*(pos.y-y)));
                            result.area.add(featureArea);
                        }
                        return true;
                    }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

    }

    //TODO move expansion specific stuff
    private void processFarmElement(Element e) {
        String[] sides = asLocation(e);
        Farm farm = new Farm();
        farm.setId(game.idSequnceNextVal());
        if (e.hasAttribute("city")) {
            List<City> cities = new ArrayList<>();
            String[] citiesLocs = asLocations(e, "city");
            for (int j = 0; j < citiesLocs.length; j++) {
                Location d = Location.valueOf(citiesLocs[j]);
                for (Feature p : features) {
                    if (p instanceof City) {
                        if (d.isPartOf(p.getLocation())) {
                            cities.add((City) p);
                            break;
                        }
                    }
                }
            }
            farm.setAdjoiningCities(cities.toArray(new Feature[cities.size()]));
        }
        if (attributeBoolValue(e, "pig")) {
            //for river is pig herd always present
            if (game.hasRule(CustomRule.PIG_HERD_ON_GQ_FARM) || tile.getId() != "GQ.F") {
                farm.setPigHerd(true);
            }
        }
        initFromDirList(farm, sides);
        game.initFeature(tile, farm, e);
    }
View Full Code Here

Examples of com.jcloisterzone.feature.Farm

        castle.setLocation(loc.rotateCCW(tile.getRotation()));
        iter.set(castle);

        for (Feature f : tile.getFeatures()) { //replace also city references
            if (f instanceof Farm) {
                Farm farm = (Farm) f;
                Feature[] adjoining = farm.getAdjoiningCities();
                if (adjoining != null) {
                    for (int i = 0; i < adjoining.length; i++) {
                        if (adjoining[i] == city) {
                            adjoining[i] = castle;
                            break;
View Full Code Here

Examples of org.apache.geronimo.system.plugin.Farm

     * @exception Exception
     */
    protected Object doExecute(ServerConnection connection) throws Exception {

        DeploymentManager deploymentManager = connection.getDeploymentManager();
        Farm farm = (Farm)((GeronimoDeploymentManager)deploymentManager).getImplementation(Farm.class);
        Map<String, DownloadResults> results;
        if (action == "add") {
            if (clusterName != null && pluginList != null && plugin != null) {
                results = farm.addPluginToCluster(clusterName, pluginList, plugin);
            } else if (clusterName != null && pluginList != null) {
                results = farm.addPluginList(clusterName, pluginList);
            } else if (pluginList != null && plugin != null) {
                results = farm.addPlugin(pluginList, plugin);
            } else {
                println("add requires -c <cluster> and -l <plugin list name>, -l <plugin list name> and -a <plugin>, or all three");
                return null;
            }
        } else if (action == "remove") {
            if (clusterName != null && pluginList != null && plugin != null) {
                println("remove requires -c <cluster> and -l <plugin list name>, or -l <plugin list name> and -a <plugin>, but not all three");
                return null;
            } else if (clusterName != null && pluginList != null) {
                results = farm.removePluginListFromCluster(clusterName, pluginList);
            } else if (pluginList != null && plugin != null) {
                results = farm.removePluginFromPluginList(pluginList, plugin);
            } else {
                println("remove requires -c <cluster> and -l <plugin list name>, or -l <plugin list> and -a <plugin>");
                return null;
            }
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.