// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/Combinatoric.java
// public interface Combinatoric<T> extends List<T[]> {
//   /**
//    * The number of elements in each combination or permutation.
//    * 
//    * @return the number of elements in each combination or permutation.
//    */
//   public int getK();
// 
//   /**
//    * The elements that are combined or permuted by this combinatoric collection.
//    * 
//    * @return the elements that are combined or permuted by this combinatoric collection.
//    */
//   public GroupedDomain<T> getDomain();
// 
//   /**
//    * The size of this combinatoric collection, as a long.
//    * 
//    * @return the size of this combinatoric collection, as a long.
//    */
//   public long longSize();
//   
//   /**
//    * Returns the index of an element in this combinatoric collection.
//    */
//   public int indexOf( T[] element );
//   
//   /**
//    * Returns the index of an element in this combinatoric collection, as a long.
//    */
//   public long longIndexOf( T[] element );
// 
//   /**
//    * The iterator for this combinatoric collection.
//    * 
//    * @return the iterator for this combinatoric collection.
//    */
//   public CombinatoricIterator<T> iterator();
// 
// 	public T[] get(long index);
// 	
// 	public Combinatoric<T> subList( long fromIndex, long toIndex );
// }
// 
// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/CombinatoricFactory.java
// public interface CombinatoricFactory {
//   public <T> Combinatoric<T> createCombinations(int k, T... domain);
//   public <T> CombinatoricEngine<T> createCombinationsEngine(int k, T... domain);
//   public <T> Combinatoric<T> createPermutations(int k, T... domain);
//   public <T> CombinatoricEngine<T> createPermutationsEngine(int k, T...domain );
//   public <T> GroupedDomain<T> createGroupedDomain(T... domain);
//   public <T> GroupedDomain<T> createGroupedDomain(int maxElementK, T... domain);
//   public CombMathUtils getMathUtils();
// }
// 
// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/CombinatoricFactoryImpl.java
// public class CombinatoricFactoryImpl
//   implements CombinatoricFactory
// {
//   private CombMathUtils mathUtils = new CombMathUtilsImpl();
//   
//   public CombinatoricFactoryImpl() {
//   	
//   }
//   
//   public CombinatoricFactoryImpl( CombMathUtils mathUtils ) {
//   	this.mathUtils = mathUtils;
//   }
//   
//   @Override
//   public <T> Combinations<T> createCombinations(int k, T... domain) {
//     return new Combinations<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> IndexBasedPermutations<T> createPermutations(int k, T... domain) {
//     return new IndexBasedPermutations<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> GroupedDomain<T> createGroupedDomain(T... domain) {
//     return new FastGroupedDomain<T>(domain);
//   }
// 
//   @Override
//   public <T> FastGroupedDomain<T> createGroupedDomain(int maxElementK, T... domain) {
//     return new FastGroupedDomain<T>(maxElementK, domain);
//   }
// 
//   @Override
//   public CombMathUtils getMathUtils() {
//     return mathUtils;
//   }
// 
//   @Override
//   public <T> CombinationsEngine<T> createCombinationsEngine(int k, T... domain) {
//     return new CombinationsEngine<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> IndexBasedPermutationsEngine<T> createPermutationsEngine(int k, T... domain) {
//     return new IndexBasedPermutationsEngine<T>(k, domain, getMathUtils());
//   }
// 
// }


import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import com.xiantrimble.combinatorics.Combinatoric;
import com.xiantrimble.combinatorics.CombinatoricFactory;
import com.xiantrimble.combinatorics.CombinatoricFactoryImpl;
/**
 * Copyright (C) 2012 Christian Trimble (xiantrimble@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.xiantrimble.combinatorics.cli;




@Parameters(commandNames = "count", commandDescription = "Counts the elements of the combination or permutation of length k")
public class CommandCount
implements Runnable
{
  @Parameter(names="-k", description="The length of the elements", required=true)
  public int k;
  
  @ParametersDelegate
  public TypeDelegate type = new TypeDelegate();
  
  @Parameter(names="-d", description="The domain", variableArity=true)
  public List<String> domain;

@Override
public void run() {
// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/Combinatoric.java
// public interface Combinatoric<T> extends List<T[]> {
//   /**
//    * The number of elements in each combination or permutation.
//    * 
//    * @return the number of elements in each combination or permutation.
//    */
//   public int getK();
// 
//   /**
//    * The elements that are combined or permuted by this combinatoric collection.
//    * 
//    * @return the elements that are combined or permuted by this combinatoric collection.
//    */
//   public GroupedDomain<T> getDomain();
// 
//   /**
//    * The size of this combinatoric collection, as a long.
//    * 
//    * @return the size of this combinatoric collection, as a long.
//    */
//   public long longSize();
//   
//   /**
//    * Returns the index of an element in this combinatoric collection.
//    */
//   public int indexOf( T[] element );
//   
//   /**
//    * Returns the index of an element in this combinatoric collection, as a long.
//    */
//   public long longIndexOf( T[] element );
// 
//   /**
//    * The iterator for this combinatoric collection.
//    * 
//    * @return the iterator for this combinatoric collection.
//    */
//   public CombinatoricIterator<T> iterator();
// 
// 	public T[] get(long index);
// 	
// 	public Combinatoric<T> subList( long fromIndex, long toIndex );
// }
// 
// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/CombinatoricFactory.java
// public interface CombinatoricFactory {
//   public <T> Combinatoric<T> createCombinations(int k, T... domain);
//   public <T> CombinatoricEngine<T> createCombinationsEngine(int k, T... domain);
//   public <T> Combinatoric<T> createPermutations(int k, T... domain);
//   public <T> CombinatoricEngine<T> createPermutationsEngine(int k, T...domain );
//   public <T> GroupedDomain<T> createGroupedDomain(T... domain);
//   public <T> GroupedDomain<T> createGroupedDomain(int maxElementK, T... domain);
//   public CombMathUtils getMathUtils();
// }
// 
// Path: combinatorics/src/main/java/com/xiantrimble/combinatorics/CombinatoricFactoryImpl.java
// public class CombinatoricFactoryImpl
//   implements CombinatoricFactory
// {
//   private CombMathUtils mathUtils = new CombMathUtilsImpl();
//   
//   public CombinatoricFactoryImpl() {
//   	
//   }
//   
//   public CombinatoricFactoryImpl( CombMathUtils mathUtils ) {
//   	this.mathUtils = mathUtils;
//   }
//   
//   @Override
//   public <T> Combinations<T> createCombinations(int k, T... domain) {
//     return new Combinations<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> IndexBasedPermutations<T> createPermutations(int k, T... domain) {
//     return new IndexBasedPermutations<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> GroupedDomain<T> createGroupedDomain(T... domain) {
//     return new FastGroupedDomain<T>(domain);
//   }
// 
//   @Override
//   public <T> FastGroupedDomain<T> createGroupedDomain(int maxElementK, T... domain) {
//     return new FastGroupedDomain<T>(maxElementK, domain);
//   }
// 
//   @Override
//   public CombMathUtils getMathUtils() {
//     return mathUtils;
//   }
// 
//   @Override
//   public <T> CombinationsEngine<T> createCombinationsEngine(int k, T... domain) {
//     return new CombinationsEngine<T>(k, domain, getMathUtils());
//   }
// 
//   @Override
//   public <T> IndexBasedPermutationsEngine<T> createPermutationsEngine(int k, T... domain) {
//     return new IndexBasedPermutationsEngine<T>(k, domain, getMathUtils());
//   }
// 
// }


// Path: combinatorics-cli/src/main/java/com/xiantrimble/combinatorics/cli/CommandCount.java
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import com.xiantrimble.combinatorics.Combinatoric;
import com.xiantrimble.combinatorics.CombinatoricFactory;
import com.xiantrimble.combinatorics.CombinatoricFactoryImpl;

/**
 * Copyright (C) 2012 Christian Trimble (xiantrimble@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.xiantrimble.combinatorics.cli;




@Parameters(commandNames = "count", commandDescription = "Counts the elements of the combination or permutation of length k")
public class CommandCount
implements Runnable
{
  @Parameter(names="-k", description="The length of the elements", required=true)
  public int k;
  
  @ParametersDelegate
  public TypeDelegate type = new TypeDelegate();
  
  @Parameter(names="-d", description="The domain", variableArity=true)
  public List<String> domain;

@Override
public void run() {
  CombinatoricFactory factory = new CombinatoricFactoryImpl();