Package worldBuilder

Class Placement


  • public class Placement
    extends java.lang.Object
    the Placement engine associates resources with MeshPoints based on bids resulting from ResourceRules. It was originally designed for flora placement, but can also work for minerals ... and can probably be extended for fauna and other natural resources.
    • Constructor Summary

      Constructors 
      Constructor Description
      Placement​(java.lang.String rulesFile, Map map, double[] resources)
      instantiate a new Placement engine note that a Placement engine can be instantiated without a Map simply to load name<->resource ID mapping
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Color[] previewColors()  
      int resourceID​(java.lang.String name)  
      java.lang.String[] resourceNames()  
      int[] update​(boolean[] selected, int[] quotas, java.lang.String[] classNames)
      populate the selected region w/resources based on our rules
      int[] update​(double x0, double y0, double height, double width, int[] quotas, java.lang.String[] classNames)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Placement

        public Placement​(java.lang.String rulesFile,
                         Map map,
                         double[] resources)
        instantiate a new Placement engine note that a Placement engine can be instantiated without a Map simply to load name<->resource ID mapping
        Parameters:
        rulesFile - ... file of resource bidding rules
        Map - ... Map (can be null)
        resources - ... array of per MeshPoint values (can be null)
    • Method Detail

      • previewColors

        public java.awt.Color[] previewColors()
        Returns:
        id->preview Color map
      • resourceNames

        public java.lang.String[] resourceNames()
        Returns:
        id->name map
      • resourceID

        public int resourceID​(java.lang.String name)
        Returns:
        ID associated with a resource name
      • update

        public int[] update​(double x0,
                            double y0,
                            double height,
                            double width,
                            int[] quotas,
                            java.lang.String[] classNames)
      • update

        public int[] update​(boolean[] selected,
                            int[] quotas,
                            java.lang.String[] classNames)
        populate the selected region w/resources based on our rules
        Parameters:
        x0 - ... upper left corner of selected region
        y0 - ... upper left corner of selected regions
        height - ... height of selected region
        width - ... width of selected region
        quotas - ... per class quotas (in MeshPoints)
        classNames - ... names of the quota-ed classes
        Returns:
        array of (per-class) point placements