Class IdRanges

java.lang.Object
com.pnfsoftware.jeb.core.units.code.IdRanges

@Ser public class IdRanges extends Object
A collection of var-id ranges.
  • Constructor Details

    • IdRanges

      public IdRanges()
      Create an empty range collection.
    • IdRanges

      public IdRanges(IdRanges o)
      Create a copy of a range collection.
      Parameters:
      o - source range collection
  • Method Details

    • clear

      public void clear()
      Clear all ranges.
    • bsize

      public int bsize()
      Get the total bit range size.
      Returns:
      total bit size
    • size

      public int size()
      Provide the number of accessed variables.
      Returns:
      accessed variable count
    • isEmpty

      public boolean isEmpty()
      Determine whether this collection is empty.
      Returns:
      true if empty
    • remove

      public void remove(IVariable var)
      Remove a variable.
      Parameters:
      var - variable
    • remove

      public void remove(int varId)
      Remove a variable by id.
      Parameters:
      varId - variable id
    • addAll

      public void addAll(Collection<? extends IVariable> vars, Collection<? extends IVariable> exclusions)
      Add variables excluding selected variables.
      Parameters:
      vars - variables to add
      exclusions - variables to exclude
    • addAll

      public void addAll(Collection<? extends IVariable> vars, IdRanges exclusions)
      Add variables excluding variables present in another range collection.
      Parameters:
      vars - variables to add
      exclusions - ranges to exclude
    • addAll

      public void addAll(Collection<? extends IVariable> vars)
      Add variables.
      Parameters:
      vars - variables to add
    • add

      public void add(IVariable var)
      Add a full variable range.
      Parameters:
      var - variable to add
    • add

      public void add(IVariable var, int beg, int len)
      Add a partial variable range.
      Parameters:
      var - variable to add
      beg - range start
      len - range length
    • add

      public void add(int varid, int bitsize)
      Add a full variable range.
      Parameters:
      varid - variable id
      bitsize - variable bit size
    • containsVarPart

      public boolean containsVarPart(IVariable var)
      Determine whether any part of a variable is present.
      Parameters:
      var - variable
      Returns:
      true if any part is present
    • containsVarFull

      public boolean containsVarFull(int varid, int bitsize)
      Determine whether a full variable range is present.
      Parameters:
      varid - variable id
      bitsize - variable bit size
      Returns:
      true if the full range is present
    • containsVarFull

      public boolean containsVarFull(int varid)
      Determine whether a full variable range is present.
      Parameters:
      varid - variable id
      Returns:
      true if the full range is present
    • getVarIds

      public List<Integer> getVarIds()
      Generate a list (modifiable copy) containing the variable ids stored in this object. Not all variables may be accessed fully.
      Returns:
      variable ids
    • collectVarIds

      public void collectVarIds(Collection<Integer> r)
      Collect variable ids.
      Parameters:
      r - output collection
    • getBits

      public List<Integer> getBits()
      Get all bit ids.
      Returns:
      bit ids
    • collectBits

      public void collectBits(List<Integer> r)
      Collect bit ids.
      Parameters:
      r - output list
    • intersection

      public IdRanges intersection(IdRanges other)
      Return common range between current range and the other range.
      Parameters:
      other - other range
      Returns:
      intersection
    • hasIntersection

      public boolean hasIntersection(IdRanges other)
      Check if there is common range between current range and the other range.
      Parameters:
      other - other range
      Returns:
      true if there is a non empty intersection
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object