Package fim

Class Pattern

java.lang.Object
fim.Pattern
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Pattern>

public class Pattern extends Object implements Comparable<Pattern>, Cloneable, Serializable
Class for item patterns (item sets, partial permutations and sequences).
Since:
2013.11.28
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    the comparison direction for sorting item patterns
    protected double
    the evaluation of the (frequent) item pattern
    protected util.IdMap
    the underlying item base
    protected int[]
    the items of the item pattern
    protected int
    the (absolute) base support (number of transactions)
    protected int
    the (absolute) support of the (frequent) item pattern
    protected int
    the current number of items
    protected double
    the value for sorting item patterns
    protected double
    the weight of the (frequent) item pattern (e.g.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an empty item pattern.
    Pattern(util.IdMap ibase)
    Create an empty item pattern.
    Pattern(util.IdMap ibase, int[] items, int supp)
    Create a item pattern from an item array (the item array is stored, not copied).
    Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base)
    Create a item pattern from an item array (the item array is stored, not copied).
    Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base, double eval)
    Create an item pattern from an item array (the item array is stored, not copied).
    Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base, double eval, double wgt)
    Create an item pattern from an item array (the item array is stored, not copied).
    Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base)
    Create a item pattern from an item array (the item array is copied).
    Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base, double eval)
    Create an item pattern from an item array (the item array is copied).
    Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base, double eval, double wgt)
    Create an item pattern from an item array (the item array is copied).
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    addItem(int item)
    Add an item to the item pattern.
    final int
    Add an item to the pattern.
    final int
    addItemById(int item)
    Add an item (given by its identifier) to the item pattern.
    final int
    Add an item (given by its name) to the pattern.
    final int
    Add an item (given by its object) to the pattern.
    final int
    Compare this pattern to another (given as argument) by comparing its items lexicographically and its support.
    final Object
    Clone this item pattern (the item base is kept, the item array is copied).
    final Object
    clone(boolean iclone)
    Clone this item pattern (the item base is replaced).
    final Object
    clone(boolean iclone, util.IdMap ibase)
    Clone this item pattern (the item base is replaced).
    final Object
    clone(util.IdMap ibase)
    Clone this item pattern (the item base is kept, the item array is copied).
    clone(util.IdMap ibase, boolean iclone)
    Clone this item pattern (the item base is kept, the item array is copied).
    final int
    Compare this item pattern to another (given as argument).
    final boolean
    Whether this item pattern contains another item pattern.
    final boolean
    contains(TrAct tract)
    Whether this item pattern contains a given transaction.
    final boolean
    equals(int[] items, int cnt)
    Compare the pattern's items to a given item pattern.
    final boolean
    Check whether this pattern is equal to another (given as argument).
    boolean
    equals(Pattern pat, boolean chksupp)
    Check whether this pattern is equal to another (given as argument).
    final int
    Get the (absolute) support of the item pattern.
    final int[]
    Get the item array (length/size fits only after packing with pack(); should be considered read only).
    final int
    Get the (absolute) support of the empty pattern (i.e.
    final int
    Get the size of the item pattern (number of items).
    final int[]
    Get the cover (list of transaction identifiers) of an item pattern w.r.t.
    final double
    Get the value of the additional evaluation measure.
    final int
    getItem(int i)
    Get an item (i.e., its identifier).
    final int
    getItemId(int i)
    Get an item identifier (as assigned by the underlying item base).
    final String
    getItemName(int i)
    Get the name of an item.
    final Object
    Get the object of an item.
    final double
    Get the (relative) support of the item pattern.
    final int
    Get the size of the item pattern (number of items).
    final int
    Get the support of the item pattern.
    final double
    Get the weight of the pattern (e.g.
    final boolean
    Whether this item pattern is contained in another item pattern.
    final boolean
    Whether this item pattern is a contained in a transaction.
    protected final int
    Create the intersection of two item patterns.
    final boolean
    isSubOf(int[] items, int cnt)
    Check whether this item pattern is a subpattern of another item pattern, given as an array of items.
    final boolean
    Check whether this item pattern is a subpattern of another item pattern.
    final boolean
    isSuperOf(int[] items, int cnt)
    Whether this item pattern is a superpattern of a given item pattern.
    final boolean
    Whether this item pattern is a superpattern of another item pattern.
    final int
    Compare this pattern to another (given as argument) by comparing its items lexicographically.
    final void
    Pack an item pattern, i.e., optimize memory usage.
    static Pattern
    parse(util.IdMap ibase, InputStream inp)
    Parse an item pattern.
    static Pattern
    parse(util.IdMap ibase, Reader reader)
    Parse an item pattern.
    static Pattern
    parse(util.IdMap ibase, String desc)
    Parse an item pattern.
    static Pattern
    parse(util.IdMap ibase, util.Scanner scan)
    Parse an item pattern.
    final void
    recode(util.IdMap ibase, int[] map)
    Recode a pattern to another item base, replacing the item base.
    final void
    setSort(double value, int dir)
    Set sort value and sort direction.
    final void
    setSort(int value, int dir)
    Set sort value and sort direction.
    final void
    Sort the items of an item pattern.
    static boolean
    subpattern(int[] itemsA, int cntA, int[] itemsB, int cntB)
    Check whether a given array of items, representing an item pattern, is a subpattern of another item pattern, given as a second given array of items.
    final int
    Compare this item pattern to another (given as argument) w.r.t.
    final String
    Create a string description.
    final String
    Create a string description.
    toString(String isep, String info)
    Create a string description.
    final void
    write(Writer writer)
    Write an item pattern.
    final void
    write(Writer writer, String info)
    Write an item pattern.
    final void
    write(Writer writer, String isep, String info)
    Write an item pattern.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • ibase

      protected util.IdMap ibase
      the underlying item base
    • items

      protected int[] items
      the items of the item pattern
    • size

      protected int size
      the current number of items
    • s_pat

      protected int s_pat
      the (absolute) support of the (frequent) item pattern
    • s_base

      protected int s_base
      the (absolute) base support (number of transactions)
    • eval

      protected double eval
      the evaluation of the (frequent) item pattern
    • wgt

      protected double wgt
      the weight of the (frequent) item pattern (e.g. cover similarity)
    • sort

      protected double sort
      the value for sorting item patterns
    • dir

      protected int dir
      the comparison direction for sorting item patterns
  • Constructor Details

    • Pattern

      public Pattern()
      Create an empty item pattern.
      Since:
      2013.11.28 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase)
      Create an empty item pattern.
      Parameters:
      ibase - the underlying item base
      Since:
      2013.11.28 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int supp)
      Create a item pattern from an item array (the item array is stored, not copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      supp - the absolute support of the item pattern
      Since:
      2016.11.04 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base)
      Create a item pattern from an item array (the item array is stored, not copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      Since:
      2014.10.03 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base, double eval)
      Create an item pattern from an item array (the item array is stored, not copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      eval - the evaluation of the item pattern
      Since:
      2014.10.04 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int s_pat, int s_base, double eval, double wgt)
      Create an item pattern from an item array (the item array is stored, not copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      eval - the evaluation of the item pattern
      wgt - the weight of the item pattern (e.g. cover similarity)
      Since:
      2018.03.21 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base)
      Create a item pattern from an item array (the item array is copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      cnt - the number of items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base, double eval)
      Create an item pattern from an item array (the item array is copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      cnt - the number of items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      eval - the evaluation of the item pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • Pattern

      public Pattern(util.IdMap ibase, int[] items, int cnt, int s_pat, int s_base, double eval, double wgt)
      Create an item pattern from an item array (the item array is copied).
      Parameters:
      ibase - the underlying item base
      items - the items in the item pattern
      cnt - the number of items in the item pattern
      s_pat - the absolute support of the item pattern
      s_base - the absolute support of the empty pattern
      eval - the evaluation of the item pattern
      wgt - the weight of the item pattern (e.g. cover similarity)
      Since:
      2018.03.21 (Christian Borgelt)
  • Method Details

    • clone

      public final Object clone()
      Clone this item pattern (the item base is kept, the item array is copied).
      Overrides:
      clone in class Object
      Returns:
      a clone of this item pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • clone

      public final Object clone(util.IdMap ibase)
      Clone this item pattern (the item base is kept, the item array is copied).
      Parameters:
      ibase - the item base to use for the clone
      Returns:
      a clone of this item pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • clone

      public final Object clone(boolean iclone)
      Clone this item pattern (the item base is replaced).
      Parameters:
      iclone - whether to clone the item array
      Returns:
      a clone of this item pattern /*------------------------------------------------------------------
    • clone

      public final Object clone(boolean iclone, util.IdMap ibase)
      Clone this item pattern (the item base is replaced).
      Parameters:
      iclone - whether to clone the item array
      ibase - a possible clone of the item base to use for the clone; if null, the item base of the pattern to clone is used
      Returns:
      a clone of this item pattern /*------------------------------------------------------------------
    • clone

      public Object clone(util.IdMap ibase, boolean iclone)
      Clone this item pattern (the item base is kept, the item array is copied).
      Parameters:
      ibase - the item base to use for the clone
      iclone - whether to clone the item array
      Returns:
      a clone of this item pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • addItemById

      public final int addItemById(int item)
      Add an item (given by its identifier) to the item pattern.
      Parameters:
      item - the identifier of the item to add
      Returns:
      the index of the new item
      Since:
      2017.06.14 (Christian Borgelt)
    • addItemByName

      public final int addItemByName(String item)
      Add an item (given by its name) to the pattern.
      Parameters:
      item - the name of the item to add
      Returns:
      the index of the new item
      Since:
      2017.06.14 (Christian Borgelt)
    • addItemByObject

      public final int addItemByObject(Object item)
      Add an item (given by its object) to the pattern.
      Parameters:
      item - the object of the item to add
      Returns:
      the index of the new item
      Since:
      2017.06.14 (Christian Borgelt)
    • addItem

      public final int addItem(int item)
      Add an item to the item pattern.
      Parameters:
      item - the item identifier
      Returns:
      the index of the new item
      Since:
      2013.11.28 (Christian Borgelt)
    • addItem

      public final int addItem(String item)
      Add an item to the pattern.
      Parameters:
      item - the item name
      Returns:
      the index of the new item
      Since:
      2013.11.28 (Christian Borgelt)
    • getItem

      public final int getItem(int i)
      Get an item (i.e., its identifier).
      Parameters:
      i - the index of the item
      Returns:
      the identifier of the item at index i
      Since:
      2013.11.28 (Christian Borgelt)
    • getItemId

      public final int getItemId(int i)
      Get an item identifier (as assigned by the underlying item base).
      Parameters:
      i - the index of the item
      Returns:
      the identifier of the item at index i
      Since:
      2017.06.14 (Christian Borgelt)
    • getItemName

      public final String getItemName(int i)
      Get the name of an item.
      Parameters:
      i - the index of the item
      Returns:
      the name of the item at index i
      Since:
      2013.11.28 (Christian Borgelt)
    • getItemObject

      public final Object getItemObject(int i)
      Get the object of an item.
      Parameters:
      i - the index of the item
      Returns:
      the object of the item at index i
      Since:
      2017.06.14 (Christian Borgelt)
    • getAllItems

      public final int[] getAllItems()
      Get the item array (length/size fits only after packing with pack(); should be considered read only).
      Returns:
      the item array
      Since:
      2014.10.03 (Christian Borgelt)
    • getSize

      public final int getSize()
      Get the size of the item pattern (number of items).
      Returns:
      the size of the item pattern
      Since:
      2013.11.28 (Christian Borgelt)
    • getCount

      public final int getCount()
      Get the size of the item pattern (number of items).
      Returns:
      the size of the item pattern
      Since:
      2017.06.20 (Christian Borgelt)
    • getSupp

      public final int getSupp()
      Get the support of the item pattern.
      Returns:
      the support of the item pattern
      Since:
      2013.11.28 (Christian Borgelt)
    • getAbsSupp

      public final int getAbsSupp()
      Get the (absolute) support of the item pattern.
      Returns:
      the (absolute) support of the item pattern
      Since:
      2014.10.02 (Christian Borgelt)
    • getRelSupp

      public final double getRelSupp()
      Get the (relative) support of the item pattern.
      Returns:
      the (relative) support of the item pattern
      Since:
      2014.10.02 (Christian Borgelt)
    • getBaseSupp

      public final int getBaseSupp()
      Get the (absolute) support of the empty pattern (i.e. the size of the transaction database).
      Returns:
      the (absolute) support of the empty pattern
      Since:
      2016.04.08 (Christian Borgelt)
    • getEval

      public final double getEval()
      Get the value of the additional evaluation measure.
      Returns:
      the value of the additional evaluation measure
      Since:
      2014.10.02 (Christian Borgelt)
    • getWeight

      public final double getWeight()
      Get the weight of the pattern (e.g. cover similarity).
      Returns:
      the weight of the pattern (e.g. cover similarity)
      Since:
      2018.03.21 (Christian Borgelt)
    • sort

      public final void sort()
      Sort the items of an item pattern.
      Since:
      2015.08.12 (Christian Borgelt)
    • setSort

      public final void setSort(int value, int dir)
      Set sort value and sort direction.
      Parameters:
      value - the value to sort item patterns on
      dir - the direction to sort item patterns into
      Since:
      2016.04.13 (Christian Borgelt)
    • setSort

      public final void setSort(double value, int dir)
      Set sort value and sort direction.
      Parameters:
      value - the value to sort item patterns on
      dir - the direction to sort item patterns into
      Since:
      2016.04.13 (Christian Borgelt)
    • compareTo

      public final int compareTo(Pattern pat)
      Compare this item pattern to another (given as argument).
      Specified by:
      compareTo in interface Comparable<Pattern>
      Parameters:
      pat - the item pattern to compare to
      Returns:
      -1, 0, or +1 as the sort value of this pattern is less than, equal to, or greater than the sort value of the given pattern
      Since:
      2016.04.13 (Christian Borgelt)
    • allCmpTo

      public final int allCmpTo(Pattern pat)
      Compare this pattern to another (given as argument) by comparing its items lexicographically and its support.
      Parameters:
      pat - the pattern to compare to
      Returns:
      -1, 0, or +1 as this pattern is less than, equal to, or greater than the pattern given as an argument
      Since:
      2017.06.14 (Christian Borgelt)
    • itemsCmpTo

      public final int itemsCmpTo(Pattern pat)
      Compare this pattern to another (given as argument) by comparing its items lexicographically.
      Parameters:
      pat - the pattern to compare to
      Returns:
      -1, 0, or +1 as this pattern is less than, equal to, or greater than the pattern given as an argument
      Since:
      2017.06.14 (Christian Borgelt)
    • suppCmpTo

      public final int suppCmpTo(Pattern pat)
      Compare this item pattern to another (given as argument) w.r.t. the support value.
      Parameters:
      pat - the item pattern to compare to
      Returns:
      -1, 0, or +1 as the support of this item pattern is less than, equal to, or greater than the support of the item pattern given as an argument
      Since:
      2017.06.14 (Christian Borgelt)
    • equals

      public final boolean equals(int[] items, int cnt)
      Compare the pattern's items to a given item pattern.
      Parameters:
      items - the items of the pattern to compare to
      cnt - the number of items (if negative, the length of the given item array is used)
      Returns:
      whether the pattern equals the given item pattern
      Since:
      2017.06.14 (Christian Borgelt)
    • equals

      public boolean equals(Pattern pat, boolean chksupp)
      Check whether this pattern is equal to another (given as argument).
      Parameters:
      pat - the pattern to compare to
      chksupp - whether to compare the support values
      Returns:
      true if the two patterns have the same items (in the same order) and false otherwise
      Since:
      2017.06.14 (Christian Borgelt)
    • equals

      public final boolean equals(Pattern pat)
      Check whether this pattern is equal to another (given as argument).
      Parameters:
      pat - the pattern to compare to
      Returns:
      true if the two patterns have the same items (in the same order) and false otherwise
      Since:
      2017.06.29 (Christian Borgelt)
    • subpattern

      public static boolean subpattern(int[] itemsA, int cntA, int[] itemsB, int cntB)
      Check whether a given array of items, representing an item pattern, is a subpattern of another item pattern, given as a second given array of items.

      For item permutations and item sequences the function works directly, but for item sets the items in both passed arrays itemsA and itemsB need to be sorted (by item identifier) for this function to work correctly.

      Parameters:
      itemsA - the first array of items
      cntA - the number of items to consider in the first array
      itemsB - the second array of items
      cntB - the number of items to consider in the second array
      Returns:
      true is the first item pattern is a subpattern of the second item pattern and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • isSubOf

      public final boolean isSubOf(int[] items, int cnt)
      Check whether this item pattern is a subpattern of another item pattern, given as an array of items.

      For item permutations and item sequences the function works directly, but for item sets the item set needs to be sorted with sort() and the items in the passed array items also need to be sorted (by identifier) for this function to work correctly.

      Parameters:
      items - the array of items to check
      cnt - the number of items to consider in the given array; if negative, the length of the item array is used
      Returns:
      true if this item pattern is a subpattern of the given item array items and false
      Since:
      2017.06.17 (Christian Borgelt)
    • isSubOf

      public final boolean isSubOf(Pattern pat)
      Check whether this item pattern is a subpattern of another item pattern.

      For item permutations and sequences the function works directly, but for item patterns, both item sets must have been sorted with Sort() for this function to work correctly.

      Parameters:
      pat - the item pattern to compare to
      Returns:
      true if this item pattern is a subpattern of the given item pattern pat and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • isContainedIn

      public final boolean isContainedIn(Pattern pat)
      Whether this item pattern is contained in another item pattern.

      For item permutations and sequences the function works directly, but for item sets, both item sets must have been sorted with sort() for this function to work correctly.

      Parameters:
      pat - the item pattern to compare to
      Returns:
      true if this item pattern is a subpattern of the given item pattern argPattern and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • isContainedIn

      public final boolean isContainedIn(TrAct tract)
      Whether this item pattern is a contained in a transaction.

      For item permutations and sequences the function works directly, but for sets, both the item set and the transaction must have been sorted with sort() for this function to work correctly.

      Parameters:
      tract - the transaction to compare to
      Returns:
      true if this item pattern is a subpattern of the given transaction tract and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • isSuperOf

      public final boolean isSuperOf(int[] items, int cnt)
      Whether this item pattern is a superpattern of a given item pattern.

      For item permutations and sequences the function works directly, but for item sets the item set must have been sorted with sort() first and also the items in the passed array items need to be sorted (by identifier) for this function to work correctly.

      Parameters:
      items - the array of items to check
      cnt - the number of items to consider in the given array; if negative, the length of the item array is used
      Returns:
      true if this item pattern is a superpattern of the given item array items and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • isSuperOf

      public final boolean isSuperOf(Pattern pat)
      Whether this item pattern is a superpattern of another item pattern.

      For item permutations and sequences the function works directly, but for item sets, both item sets must have been sorted with sort() for this function to work correctly.

      Parameters:
      pat - the item pattern to compare to
      Returns:
      true is this item pattern is a superpattern of the given item pattern pat and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • contains

      public final boolean contains(Pattern pat)
      Whether this item pattern contains another item pattern.

      For item permutations and sequences the function works directly, but for item sets, both item sets must have been sorted with sort() for this function to work correctly.

      Parameters:
      pat - the item pattern to compare to
      Returns:
      true is this item pattern contains the given item pattern pat and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • contains

      public final boolean contains(TrAct tract)
      Whether this item pattern contains a given transaction.

      For item permutations and sequences the function works directly, but for item sets, both the item set and the transaction must have been sorted with sort() for this function to work correctly.

      Parameters:
      tract - the transaction to compare to
      Returns:
      true is this item pattern contains the given transaction tract and false otherwise
      Since:
      2017.06.17 (Christian Borgelt)
    • getCover

      public final int[] getCover(TrActBag tabag)
      Get the cover (list of transaction identifiers) of an item pattern w.r.t. a transaction bag.
      Parameters:
      tabag - the transaction bag w.r.t. which to get the cover
      Returns:
      an array of indices of transactions in which the item pattern is contained
      Since:
      2017.06.17 (Christian Borgelt)
    • isect

      protected final int isect(Pattern A, Pattern B)
      Create the intersection of two item patterns.

      The intersection is created in the pattern for which this function is called, which acts as a buffer to avoid memory allocation. However, if the item array of this pattern is too small to hold the intersection, it is enlarged.

      Parameters:
      A - the first pattern to intersect
      B - the second pattern to intersect
      Returns:
      the size of the intersection of the patterns
      Since:
      2015.08.12 (Christian Borgelt)
    • recode

      public final void recode(util.IdMap ibase, int[] map)
      Recode a pattern to another item base, replacing the item base.
      Parameters:
      ibase - the item base to recode the pattern to
      map - the old identifier to new identifier map; if null, the map is created by a call to IdMap.getMapTo()
      Since:
      2017.06.14 (Christian Borgelt)
    • pack

      public final void pack()
      Pack an item pattern, i.e., optimize memory usage.
      Since:
      2013.11.28 (Christian Borgelt)
    • write

      public final void write(Writer writer) throws IOException
      Write an item pattern.
      Parameters:
      writer - the writer to write to
      Throws:
      IOException - if a write error occurs
      Since:
      2017.06.17 (Christian Borgelt)
    • write

      public final void write(Writer writer, String info) throws IOException
      Write an item pattern.
      Parameters:
      writer - the writer to write to
      info - the additional information to write
      Throws:
      IOException - if a write error occurs
      Since:
      2017.06.17 (Christian Borgelt)
    • write

      public final void write(Writer writer, String isep, String info) throws IOException
      Write an item pattern.
      Parameters:
      writer - the writer to write to
      isep - the item separator
      info - the additional information to write
      Throws:
      IOException - if a write error occurs
      Since:
      2017.06.27 (Christian Borgelt)
    • parse

      public static Pattern parse(util.IdMap ibase, util.Scanner scan) throws IOException
      Parse an item pattern.
      Parameters:
      ibase - the underlying item base
      scan - the scanner to read from
      Returns:
      the parsed item pattern
      Throws:
      IOException - if a read error occurs
      Since:
      2005.07.06 (Christian Borgelt)
    • parse

      public static Pattern parse(util.IdMap ibase, Reader reader) throws IOException
      Parse an item pattern.
      Parameters:
      ibase - the underlying item base
      reader - the reader to read from
      Returns:
      the parsed item pattern
      Throws:
      IOException - if a read error occurs
      Since:
      2005.07.06 (Christian Borgelt)
    • parse

      public static Pattern parse(util.IdMap ibase, String desc) throws IOException
      Parse an item pattern.
      Parameters:
      ibase - the underlying item base
      desc - the string description to parse
      Returns:
      the parsed item pattern
      Throws:
      IOException - if a read error occurs
      Since:
      2005.07.06 (Christian Borgelt)
    • parse

      public static Pattern parse(util.IdMap ibase, InputStream inp) throws IOException
      Parse an item pattern.
      Parameters:
      ibase - the underlying item base
      inp - the input stream to read from
      Returns:
      the parsed item pattern
      Throws:
      IOException - if a read error occurs
      Since:
      2005.07.06 (Christian Borgelt)
    • toString

      public String toString(String isep, String info)
      Create a string description.
      Parameters:
      isep - the separator for the items
      info - characters specifying additional information to report
      Returns:
      the created string description
      Since:
      2005.07.06 (Christian Borgelt)
    • toString

      public final String toString(String info)
      Create a string description.
      Parameters:
      info - characters specifying additional information to report
      Returns:
      the created string description
      Since:
      2005.07.06 (Christian Borgelt)
    • toString

      public final String toString()
      Create a string description.
      Overrides:
      toString in class Object
      Returns:
      the created string description
      Since:
      2005.07.06 (Christian Borgelt)