// Path: 3-sat-core/src/main/java/com/anjlab/sat3/Helper.java
// public static ITabularFormula createFormula(int... values)
// {
//     if (values.length%3 != 0)
//     {
//         throw new IllegalArgumentException("Number of values must be a multiple of 3");
//     }
//     ITabularFormula formula = new SimpleFormula();
//     for (int i = 0; i < values.length; i +=3)
//     {
//         SimpleTriplet triplet = new SimpleTriplet(values[i], values[i + 1], values[i + 2]);
//         formula.unionOrAdd(triplet);
//     }
//     return formula;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimplePermutation.java
// public static IPermutation createPermutation(int... variables)
// {
//     IPermutation permutation = new SimplePermutation();
//         
//     for (int varName : variables)
//     {
//         permutation.add(varName);
//     }
//         
//     return permutation;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _101_instance = new _101();
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _000_instance = new _000();


import org.junit.BeforeClass;
import org.junit.Test;
import static com.anjlab.sat3.Helper.createFormula;
import static com.anjlab.sat3.SimplePermutation.createPermutation;
import static com.anjlab.sat3.SimpleTripletValueFactory._101_instance;
import static com.anjlab.sat3.SimpleTripletValueFactory._000_instance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

                    assertValueEquals(tier, a1);
                    assertValueEquals(tier, b1);
                    assertValueEquals(tier, c1);
                }
                catch (AssertionError e)
                {
                    System.out.println("Formula: " + formula);
                    System.out.println("Tier: " + tier);
                    
                    throw e;
                }
            }
    }
    
    @Test
    public void tryJoin2Right() throws EmptyStructureException
    {
        for (int a1 = 1; a1 <= 3; a1++)
        for (int b1 = 1; b1 <= 3; b1++)
        for (int c1 = 1; c1 <= 3; c1++)
            for (int a2 = 2; a2 <= 4; a2++)
            for (int b2 = 2; b2 <= 4; b2++)
            for (int c2 = 2; c2 <= 4; c2++)
            {
                if (a1 == b1 || a1 == c1 || b1 == c1) continue;
                if (a2 == b2 || a2 == c2 || b2 == c2) continue;
                
                Join2Right method = new Join2Right();
                ITabularFormula formula = createFormula(a2, b2, c2);
                SimpleTier tier = new SimpleTier(a1, b1, c1);

// Path: 3-sat-core/src/main/java/com/anjlab/sat3/Helper.java
// public static ITabularFormula createFormula(int... values)
// {
//     if (values.length%3 != 0)
//     {
//         throw new IllegalArgumentException("Number of values must be a multiple of 3");
//     }
//     ITabularFormula formula = new SimpleFormula();
//     for (int i = 0; i < values.length; i +=3)
//     {
//         SimpleTriplet triplet = new SimpleTriplet(values[i], values[i + 1], values[i + 2]);
//         formula.unionOrAdd(triplet);
//     }
//     return formula;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimplePermutation.java
// public static IPermutation createPermutation(int... variables)
// {
//     IPermutation permutation = new SimplePermutation();
//         
//     for (int varName : variables)
//     {
//         permutation.add(varName);
//     }
//         
//     return permutation;
// }
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _101_instance = new _101();
// 
// Path: 3-sat-core/src/main/java/com/anjlab/sat3/SimpleTripletValueFactory.java
// public static final ITripletValue _000_instance = new _000();


// Path: 3-sat-core/src/test/java/com/anjlab/sat3/TestJoinMethods.java
import org.junit.BeforeClass;
import org.junit.Test;
import static com.anjlab.sat3.Helper.createFormula;
import static com.anjlab.sat3.SimplePermutation.createPermutation;
import static com.anjlab.sat3.SimpleTripletValueFactory._101_instance;
import static com.anjlab.sat3.SimpleTripletValueFactory._000_instance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

                    assertValueEquals(tier, a1);
                    assertValueEquals(tier, b1);
                    assertValueEquals(tier, c1);
                }
                catch (AssertionError e)
                {
                    System.out.println("Formula: " + formula);
                    System.out.println("Tier: " + tier);
                    
                    throw e;
                }
            }
    }
    
    @Test
    public void tryJoin2Right() throws EmptyStructureException
    {
        for (int a1 = 1; a1 <= 3; a1++)
        for (int b1 = 1; b1 <= 3; b1++)
        for (int c1 = 1; c1 <= 3; c1++)
            for (int a2 = 2; a2 <= 4; a2++)
            for (int b2 = 2; b2 <= 4; b2++)
            for (int c2 = 2; c2 <= 4; c2++)
            {
                if (a1 == b1 || a1 == c1 || b1 == c1) continue;
                if (a2 == b2 || a2 == c2 || b2 == c2) continue;
                
                Join2Right method = new Join2Right();
                ITabularFormula formula = createFormula(a2, b2, c2);
                SimpleTier tier = new SimpleTier(a1, b1, c1);

                tier.add(_000_instance);
