Package org.xcsp.common.structures
Class TableSymbolic
- java.lang.Object
-
- org.xcsp.common.structures.TableAbstract
-
- org.xcsp.common.structures.TableSymbolic
-
public class TableSymbolic extends TableAbstract
-
-
Field Summary
-
Fields inherited from class org.xcsp.common.structures.TableAbstract
positive, TABLE_SYNTAX_PB
-
-
Constructor Summary
Constructors Constructor Description TableSymbolic()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TableSymbolic
add(String... tuple)
Adds the specified symbolic tuple to the table.TableSymbolic
add(String[]... tuples)
Adds the specified symbolic tuples to the table.TableSymbolic
add(java.util.stream.Stream<String[]> stream)
Adds all tuples of the specified stream to the table.TableSymbolic
addSequence(String s)
Adds the tuples obtained after parsing the specified string.static String[][]
clean(String[][] tuples)
Returns an array of tuples in lexicographic order, and without any duplicates.static String[][]
clean(List<String[]> tuples)
TableSymbolic
positive(Boolean positive)
Sets if the table is positive (i.e, contains supports) or negative (i.e., contains conflicts)int
size()
Returns the number of tuples in this tableString[][]
toArray()
Returns a 2-dimensional array corresponding to the collected tuples.-
Methods inherited from class org.xcsp.common.structures.TableAbstract
controlStringRepresentationOfTuples
-
-
-
-
Method Detail
-
clean
public static String[][] clean(String[][] tuples)
Returns an array of tuples in lexicographic order, and without any duplicates.- Parameters:
tuples
- an array of tuples- Returns:
- an array of tuples in lexicographic order, and without any duplicates
-
positive
public TableSymbolic positive(Boolean positive)
Description copied from class:TableAbstract
Sets if the table is positive (i.e, contains supports) or negative (i.e., contains conflicts)- Overrides:
positive
in classTableAbstract
- Parameters:
positive
- a Boolean value indicating if the table is positive (true
) or negative (false
)- Returns:
- this table
-
size
public int size()
Description copied from class:TableAbstract
Returns the number of tuples in this table- Specified by:
size
in classTableAbstract
- Returns:
- the number of tuples in this table
-
add
public TableSymbolic add(String... tuple)
Adds the specified symbolic tuple to the table.- Parameters:
tuple
- a symbolic tuple- Returns:
- this symbolic table
-
add
public TableSymbolic add(String[]... tuples)
Adds the specified symbolic tuples to the table.- Parameters:
tuples
- a sequence of tuples- Returns:
- this symbolic table
-
add
public TableSymbolic add(java.util.stream.Stream<String[]> stream)
Adds all tuples of the specified stream to the table.- Parameters:
stream
- a stream of tuples to be added to the table- Returns:
- this symbolic table
-
addSequence
public TableSymbolic addSequence(String s)
Adds the tuples obtained after parsing the specified string. The string must represent a sequence of tuples as defined in XCSP3. For example, it could be"(a,a,b)(a,c,a)(b,a,b)(b,b,c)"
.- Parameters:
s
- a string representing a sequence of tuples- Returns:
- this symbolic table
-
toArray
public String[][] toArray()
Returns a 2-dimensional array corresponding to the collected tuples.- Returns:
- a 2-dimensional array corresponding to the collected tuples
-
-