Get a packing plan using First Fit Decreasing

@return packing plan
11358
@Override
  public PackingPlan pack() {
    PackingPlanBuilder planBuilder = newPackingPlanBuilder(null);

    // Get the instances using FFD allocation
    try {
      planBuilder = getFFDAllocation(planBuilder);
    } catch (ConstraintViolationException e) {
      throw new PackingException("Could not allocate all instances to packing plan", e);
    }

    return planBuilder.build();
  }
530071
public function getFit()
    {
        if (in_array($this->fit, ['contain', 'fill', 'max', 'stretch'], true)) {
            return $this->fit;
        }

        if (preg_match('/^(crop)(-top-left|-top|-top-right|-left|-center|-right|-bottom-left|-bottom|-bottom-right|-[\d]{1,3}-[\d]{1,3}(?:-[\d]{1,3}(?:\.\d+)?)?)*$/', $this->fit)) {
            return 'crop';
        }

        return 'contain';
    }
1179225
@VisibleForTesting
  static Map<Integer, Container> getContainers(
      PackingPlan currentPackingPlan, Resource maxContainerResource, Resource padding,
      Map<String, TreeSet<Integer>> componentIndexes, TreeSet<Integer> taskIds) {
    Map<Integer, Container> containers = new HashMap<>();

    Resource capacity = maxContainerResource;
    for (PackingPlan.ContainerPlan currentContainerPlan : currentPackingPlan.getContainers()) {
      Container container =
          new Container(currentContainerPlan.getId(), capacity, padding);
      for (PackingPlan.InstancePlan instancePlan : currentContainerPlan.getInstances()) {
        addToContainer(container, instancePlan, componentIndexes, taskIds);
      }
      containers.put(currentContainerPlan.getId(), container);
    }
    return containers;
  }
215591
public static function getOuterShapes()
    {
        if (self::$outerShapes === null) {
            self::$outerShapes = self::createOuterShapes();
        }
        return self::$outerShapes;
    }
1252748
protected function getPacker(): PackerInterface
    {
        if (!isset($this->packer)) {
            $this->packer = static::createDefaultPacker();
        }

        return $this->packer;
    }
892168
public Packer inset(final int top, final int left, final int bottom, final int right) {
        gc.insets = new Insets(top, left, bottom, right);
        setConstraints(comp, gc);
        return this;
    }
697592
public function getPackageCopy()
    {
        $copy = new Package(
            $this->package->getName(),
            $this->package->getVersion(),
            $this->package->getPrettyVersion()
        );
        $copy->setType($this->package->getType());
        $copy->setExtra($this->package->getExtra());

        return $copy;
    }
480875
public function getBasket()
    {
        if ($this->_oBasket === null) {
            $this->_oBasket = false;
            if ($oBasket = $this->getSession()->getBasket()) {
                $this->_oBasket = $oBasket;
            }
        }

        return $this->_oBasket;
    }
146718
public Config createConfigWithPackingDetails(Config runtime, PackingPlan packing) {
    return Config.newBuilder()
        .putAll(runtime)
        .put(Key.COMPONENT_RAMMAP, packing.getComponentRamDistribution())
        .put(Key.NUM_CONTAINERS, 1 + packing.getContainers().size())
        .build();
  }
1358453
public PackageSymbol packge() {
        Symbol sym = this;
        while (sym.kind != PCK) {
            sym = sym.owner;
        }
        return (PackageSymbol) sym;
    }
1118994
public Resource getTotalUsedResources() {
    return getInstances().stream()
        .map(PackingPlan.InstancePlan::getResource)
        .reduce(Resource.EMPTY_RESOURCE, Resource::plus)
        .plus(getPadding());
  }
634371
public function config()
    {
        $config = config('packer');

        if (empty($config['environment'])) {
            $config['environment'] = app()->environment();
        }

        if (empty($config['public_path'])) {
            $config['public_path'] = public_path();
        }

        if (empty($config['asset'])) {
            $config['asset'] = asset('');
        }

        return $config;
    }
1242090
public int nextZipfDelay() {
        int value;
        double friquency = 0;
        double dice;

        value = rand.nextInt(size);
        friquency = (1.0d / Math.pow(value, this.skew)) / this.bottom;
        dice = rand.nextDouble();

        while(!(dice < friquency)) {
            value = rand.nextInt(size);
            friquency = (1.0d / Math.pow(value, this.skew)) / this.bottom;
            dice = rand.nextDouble();
        }

        return value;
    }
394511
public Version toLowerCase() {
        return new Version(this.major, this.minor, this.patch,
                copyCase(this.preReleaseParts, false),
                copyCase(this.buildMetaDataParts, false));
    }
755581
public int shrink()
    {
        byte[] old = buf;
        if (pos == 0)
        {
            return 0; // nothing to do
        }
        int n = old.length - pos;
        int m;
        int p;
        int s;
        int l;
        if (n < origsize)
        {
            buf = new byte[origsize];
            p = pos;
            s = origsize - n;
            l = old.length - p;
            m = old.length - origsize;
            pos = s;
        }
        else
        {
            buf = new byte[n];
            p = pos;
            s = 0;
            l = n;
            m = old.length - l;
            pos = 0;
        }
        System.arraycopy(old, p, buf, s, l);
        return m;
    }
835240
public function getPackage()
    {
        $inheritedElement = $this->getInheritedElement();
        if ($this->package instanceof PackageDescriptor
            && ! ($this->package->getName() === '\\' && $inheritedElement)) {
            return $this->package;
        }

        if ($inheritedElement instanceof DescriptorAbstract) {
            return $inheritedElement->getPackage();
        }

        return null;
    }
1279185
public SquarePlanar normalize() {
        int cfg = getConfigOrder();
        if (cfg == 1)
            return this;
        IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[4]),
                                     PERMUTATIONS[cfg-1]);
        return new SquarePlanar(getFocus(),
                                carriers,
                                SPU);
    }