Constructor
new SpecialBouquet(id, name, price, image, flowers, occasion)
Creates a SpecialBouquet instance.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | ID. |
name |
string | Name. |
price |
number | Price. |
image |
string | Image path. |
flowers |
Array.<Flower> | Flowers in the bouquet. |
occasion |
string | The theme or occasion of the bouquet. |
Extends
Classes
Methods
findOptimalFlowerConnections(graph, algorithmNameopt) → {Object}
Finds the Optimal Flower Connections using an MST algorithm (Kruskal or Prim).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
graph |
Graph | The master graph of all flower compatibilities. |
||
algorithmName |
string |
<optional> |
'Kruskal' | The algorithm name ('Kruskal' or 'Prim'). |
- Overrides:
- Source:
Returns:
An object containing the MST results: { mst: Array, weight: number, algorithm: string }.
- Type
- Object
getDescription() → {string}
Returns a full description including the occasion.
- Overrides:
- Source:
Returns:
The full description.
- Type
- string
getId() → {number}
Gets the unique ID of the item.
- Overrides:
- Source:
Returns:
The item's ID.
- Type
- number
getOccasion() → {string}
Gets the recommended occasion.
Returns:
The formatted occasion string.
- Type
- string
isPricy() → {boolean}
Checks if the item is expensive (price > 100).
- Overrides:
- Source:
Returns:
True if the price is above 100.
- Type
- boolean