//////////////////////////////////////////////////////////////////////////////
// 
//                    Copyright 2012, Cornutum Project
//                             www.cornutum.org
//                           All Rights Reserved
//
//////////////////////////////////////////////////////////////////////////////

package org.cornutum.tcases;

/**
 * Builds {@link TestCase} instances.
 *
 */
public class TestCaseBuilder
  {
  /**
   * Creates a new builder for a TestCase with the given id.
   */
  public static TestCaseBuilder with( int id)
    {
    return new TestCaseBuilder().id( id);
    }
  
  /**
   * Creates a new builder for the given TestCase.
   */
  public static TestCaseBuilder with( TestCase testCase)
    {
    return new TestCaseBuilder( testCase);
    }


  /**
   * Creates a new TestCaseBuilder object.
   */
  public TestCaseBuilder()
    {
    start();
    }

  /**
   * Creates a new TestCaseBuilder object.
   */
  public TestCaseBuilder( TestCase testCase)
    {
    start( testCase);
    }

  /**
   * Returns the current test case.
   */
  public TestCase build()
    {
    return testCase_;
    }

  /**
   * Starts building a new test case.
   */
  public TestCaseBuilder start()
    {
    return start( null);
    }

  /**
   * Starts building a new test case.
   */
  public TestCaseBuilder start( TestCase testCase)
    {
    testCase_ =
      testCase == null
      ? new TestCase(0)
      : testCase;
    
    return this;
    }

  /**
   * Changes the test case id.
   */
  public TestCaseBuilder id( int id)
    {
    testCase_.setId( id);
    return this;
    }

  /**
   * Adds variable bindings to the test case.
   */
  public TestCaseBuilder bind( VarBinding... bindings)
    {
    for( VarBinding binding : bindings)
      {
      testCase_.addVarBinding( binding);
      }
    return this;
    }

  /**
   * Adds variable bindings of the given type to the test case.
   */
  public TestCaseBuilder bind( String type, VarBinding... bindings)
    {
    for( VarBinding binding : bindings)
      {
      binding.setType( type);
      testCase_.addVarBinding( binding);
      }
    return this;
    }

  /**
   * Add a test case annotation.
   */
  public TestCaseBuilder has( String name, String value)
    {
    testCase_.setAnnotation( name, value);
    return this;
    }

  /**
   * Resets ids for the given sequence of test cases.
   */
  public static TestCase[] sequence( TestCase ... testCases)
    {
    for( int i = 0; i < testCases.length; i++)
      {
      testCases[i].setId( i);
      }
    return testCases;
    }

  TestCase testCase_;
  }


@@ -2322,263 +2322,8 @@
  %7D%0A%0A
-  /**%0A   * Resets ids for the given sequence of test cases.%0A   */%0A  public static TestCase%5B%5D sequence( TestCase ... testCases)%0A    %7B%0A    for( int i = 0; i %3C testCases.length; i++)%0A      %7B%0A      testCases%5Bi%5D.setId( i);%0A      %7D%0A    return testCases;%0A    %7D%0A%0A
   Te

Remove unused method