Namespace: shared

shared

Code that is shared between client and server

Namespaces

combinations
companionship
filter
practicalplants
utils

Methods


<static> assignIsCompatible(crops, isCompatibleFunction)

Assign isCompatible() for the given Crop documents for use with the Combinations class.
Parameters:
Name Type Description
crops Array.<Crop>
isCompatibleFunction function

<static> containsCrop(relationship, crop)

Parameters:
Name Type Description
relationship Object
crop Object
Returns:
Type
Boolean

<static> getCompatibleCrops(allCrops, relationships, crops)

Get other crops that are compatible with the given set of crops. The crops in the sum set are all compatible. TODO This doesn't scale at all with thousands of crops.
Parameters:
Name Type Description
allCrops Array.<Object>
relationships Array.<Object>
crops Array.<Object>
Returns:
Array of compatible crops
Type
Array.<Object>

<static> getCropGroups(relationships, crops)

Divide the given crops into groups of compatible crops.
Parameters:
Name Type Description
relationships Array.<Object>
crops Array.<Object>
Returns:
Array of crop groups
Type
Array.<Object>

<static> isCompanion(crop)

Implements isCompatible() for Crop Combinations. Check if the given other crop is compatible.
Parameters:
Name Type Description
crop Crop
Returns:
Type
Boolean

<static> isNeutral(crop)

Implements isCompatible() for Crop Combinations. Check if the given other crop is neutral but not incompatible.
Parameters:
Name Type Description
crop Crop
Returns:
Type
Boolean

<static> removeCropGroupsFromCombinations(combinations, maximumGroupSize)

Given all compatible combinations, get non-overlapping crop groups, and update the Combinations object by removing the crops of these groups.
Parameters:
Name Type Description
combinations Combinations
maximumGroupSize Number
Returns:
Type
Array

Namespace: shared

shared

TODO Most of this should be eventually integrated with the new companionship algorithm.

Namespaces

combinations
companionship
filter
practicalplants
utils

Methods


<static> assignIsCompatible(crops, isCompatibleFunction)

Assign isCompatible() for the given Crop documents for use with the Combinations class.
Parameters:
Name Type Description
crops Array.<Crop>
isCompatibleFunction function

<static> containsCrop(relationship, crop)

Parameters:
Name Type Description
relationship Object
crop Object
Returns:
Type
Boolean

<static> getCompatibleCrops(allCrops, relationships, crops)

Get other crops that are compatible with the given set of crops. The crops in the sum set are all compatible. TODO This doesn't scale at all with thousands of crops.
Parameters:
Name Type Description
allCrops Array.<Object>
relationships Array.<Object>
crops Array.<Object>
Returns:
Array of compatible crops
Type
Array.<Object>

<static> getCropGroups(relationships, crops)

Divide the given crops into groups of compatible crops.
Parameters:
Name Type Description
relationships Array.<Object>
crops Array.<Object>
Returns:
Array of crop groups
Type
Array.<Object>

<static> isCompanion(crop)

Implements isCompatible() for Crop Combinations. Check if the given other crop is compatible.
Parameters:
Name Type Description
crop Crop
Returns:
Type
Boolean

<static> isNeutral(crop)

Implements isCompatible() for Crop Combinations. Check if the given other crop is neutral but not incompatible.
Parameters:
Name Type Description
crop Crop
Returns:
Type
Boolean

<static> removeCropGroupsFromCombinations(combinations, maximumGroupSize)

Given all compatible combinations, get non-overlapping crop groups, and update the Combinations object by removing the crops of these groups.
Parameters:
Name Type Description
combinations Combinations
maximumGroupSize Number
Returns:
Type
Array