Package jgromacs.data
Class IndexSet
- java.lang.Object
-
- jgromacs.data.IndexSet
-
- All Implemented Interfaces:
java.lang.Cloneable
public class IndexSet extends java.lang.Object implements java.lang.Cloneable
Objects of this class represent a single index set
-
-
Constructor Summary
Constructors Constructor Description IndexSet()
Constructs a new IndexSet objectIndexSet(java.lang.String name)
Constructs a new IndexSet object of a given nameIndexSet(java.util.ArrayList<java.lang.Integer> list)
Constructs a new IndexSet object and loads data from an ArrayListIndexSet(java.util.ArrayList<java.lang.Integer> list, java.lang.String name)
Constructs a new IndexSet object of a given name and loads data from an ArrayListIndexSet(java.util.TreeSet<java.lang.Integer> set)
Constructs a new IndexSet object and loads data from a TreeSetIndexSet(java.util.TreeSet<java.lang.Integer> set, java.lang.String name)
Constructs a new IndexSet object of a given name and loads data from a TreeSetIndexSet(IndexSet set)
Constructs a new IndexSet object identical to a given IndexSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIndex(int index)
Adds a new index to the index setjava.lang.Object
clone()
Returns an identical IndexSet objectboolean
equals(java.lang.Object other)
Returns true if this index sets is identical to anotherjava.util.ArrayList<java.lang.Integer>
getAsArrayList()
Returns index set as an ArrayListjava.util.TreeSet<java.lang.Integer>
getAsTreeSet()
Returns index set as a TreeSetjava.lang.String
getName()
Returns the name of index setint
getNumberOfIndices()
Returns the number of indices in this index setint
hashCode()
Returns hash codeIndexSet
intersect(IndexSet other)
Returns the intersection of this index set and anotherboolean
isIndexIn(int index)
Returns true if the index set contains a given indexvoid
removeIndex(int index)
Removes an index from the index setvoid
setName(java.lang.String name)
Sets the name of index setIndexSet
subtract(IndexSet other)
Returns the subtraction of another index set from this index setjava.lang.String
toString()
Returns the String representation of index setjava.lang.String
toStringInfo()
Returns summary information about the index setIndexSet
union(IndexSet other)
Returns the union of this index set and another
-
-
-
Constructor Detail
-
IndexSet
public IndexSet()
Constructs a new IndexSet object
-
IndexSet
public IndexSet(java.lang.String name)
Constructs a new IndexSet object of a given name
-
IndexSet
public IndexSet(java.util.ArrayList<java.lang.Integer> list)
Constructs a new IndexSet object and loads data from an ArrayList
-
IndexSet
public IndexSet(java.util.ArrayList<java.lang.Integer> list, java.lang.String name)
Constructs a new IndexSet object of a given name and loads data from an ArrayList
-
IndexSet
public IndexSet(java.util.TreeSet<java.lang.Integer> set)
Constructs a new IndexSet object and loads data from a TreeSet
-
IndexSet
public IndexSet(java.util.TreeSet<java.lang.Integer> set, java.lang.String name)
Constructs a new IndexSet object of a given name and loads data from a TreeSet
-
IndexSet
public IndexSet(IndexSet set)
Constructs a new IndexSet object identical to a given IndexSet
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of index set- Returns:
- Name of index set
-
setName
public void setName(java.lang.String name)
Sets the name of index set
-
getAsTreeSet
public java.util.TreeSet<java.lang.Integer> getAsTreeSet()
Returns index set as a TreeSet- Returns:
- index set as a TreeSet
-
getAsArrayList
public java.util.ArrayList<java.lang.Integer> getAsArrayList()
Returns index set as an ArrayList- Returns:
- index set as an ArrayList
-
getNumberOfIndices
public int getNumberOfIndices()
Returns the number of indices in this index set- Returns:
- number of indices
-
isIndexIn
public boolean isIndexIn(int index)
Returns true if the index set contains a given index
-
addIndex
public void addIndex(int index)
Adds a new index to the index set
-
removeIndex
public void removeIndex(int index)
Removes an index from the index set
-
intersect
public IndexSet intersect(IndexSet other)
Returns the intersection of this index set and another- Returns:
- intersection of two index sets
-
subtract
public IndexSet subtract(IndexSet other)
Returns the subtraction of another index set from this index set- Returns:
- subtraction of two index sets
-
union
public IndexSet union(IndexSet other)
Returns the union of this index set and another- Returns:
- union of two index sets
-
toString
public java.lang.String toString()
Returns the String representation of index set- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation
-
toStringInfo
public java.lang.String toStringInfo()
Returns summary information about the index set- Returns:
- summary information
-
equals
public boolean equals(java.lang.Object other)
Returns true if this index sets is identical to another- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns hash code- Overrides:
hashCode
in classjava.lang.Object
-
clone
public java.lang.Object clone()
Returns an identical IndexSet object- Overrides:
clone
in classjava.lang.Object
- Returns:
- clone of the index set
-
-