Class BlenderRecipe

java.lang.Object
net.messagevortex.blender.recipes.BlenderRecipe
All Implemented Interfaces:
Comparable<BlenderRecipe>
Direct Known Subclasses:
LowAnonRecipe, SimplePathRecipe

public abstract class BlenderRecipe extends Object implements Comparable<BlenderRecipe>
  • Constructor Details

    • BlenderRecipe

      public BlenderRecipe()
  • Method Details

    • getRecipe

      public static BlenderRecipe getRecipe(String identifier, Set<IdentityStoreBlock> anonSet) throws IOException

      Get a recipe from the specified recipe set.

      Parameters:
      identifier - the name of the recipe set
      anonSet - the anonymity set to be used
      Returns:
      a random recipe
      Throws:
      IOException - if no candidates can be found
    • clearRecipes

      public static void clearRecipes(String identifier)

      Remove all recipes from the specified list of recipes.

      Parameters:
      identifier - the recipe list identifier (null for default list)
    • addRecipe

      public static void addRecipe(String identifier, BlenderRecipe add)

      Adds a recipe to the specified recipe list.

      Parameters:
      identifier - the name of the recipe list (null for default)
      add - the recipe to be added
    • isAppliable

      public abstract boolean isAppliable(Set<IdentityStoreBlock> anonSet)

      Tests if the given recipe may be applied to the anon set available.

      Parameters:
      anonSet - the currently available anonymity set
      Returns:
      true if the recipe may be applied
    • applyRecipe

      public abstract RoutingCombo applyRecipe(Set<IdentityStoreBlock> anonSet, IdentityStoreBlock from, IdentityStoreBlock to) throws IOException

      Creates a routing block with the given parameters.

      Parameters:
      anonSet - the anonymity set to be used
      from - the sending node address
      to - the receiving node address
      Returns:
      the built routing block
      Throws:
      IOException - if a problem arises when creating the block
    • compareTo

      public int compareTo(BlenderRecipe o)
      Specified by:
      compareTo in interface Comparable<BlenderRecipe>