本文整理汇总了Java中org.paukov.combinatorics.ICombinatoricsVector.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java ICombinatoricsVector.getSize方法的具体用法?Java ICombinatoricsVector.getSize怎么用?Java ICombinatoricsVector.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.paukov.combinatorics.ICombinatoricsVector
的用法示例。
在下文中一共展示了ICombinatoricsVector.getSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComplexCombinationGenerator
import org.paukov.combinatorics.ICombinatoricsVector; //导入方法依赖的package包/类
/**
* Constructor
*
* @param originalVector
* Original vector/set which is used for combination generation
* @param combinationsLength
* Length of combination to generate
* @param isOrderImportant
* true if the order of the generated combinations is important
* @param excludeEmptySet
* true if the empty set has to be excluded from the generated
* combinations
*/
public ComplexCombinationGenerator(ICombinatoricsVector<T> originalVector,
int combinationsLength, boolean isOrderImportant,
boolean excludeEmptySet) {
if (excludeEmptySet && combinationsLength > originalVector.getSize())
throw new RuntimeException(
"Unable to generate complex combinations, the requested combination length is more then the size of the original vector, length: "
+ combinationsLength
+ ", originalVector: "
+ originalVector);
_originalVector = Factory.createVector(originalVector);
_combinationLength = combinationsLength;
_isOrderImportant = isOrderImportant;
_excludeEmptySet = excludeEmptySet;
}
示例2: convertIndexes2String
import org.paukov.combinatorics.ICombinatoricsVector; //导入方法依赖的package包/类
/**
* This method converts a composition into a string
*
* @param vector
* The vector
* @return A string representation of the given vector
*/
public static <T> String convertIndexes2String(T[] elements,
ICombinatoricsVector<ICombinatoricsVector<Integer>> vector) {
StringBuilder sb = new StringBuilder();
sb.append("(");
for (int i = 0; i < vector.getSize(); i++) {
sb.append("[");
for (int j = 0; j < vector.getValue(i).getVector().size(); j++) {
sb.append(elements[vector.getValue(i).getValue(j)]);
if (j != vector.getValue(i).getVector().size() - 1)
sb.append(",");
}
sb.append("]");
if (i != vector.getSize() - 1)
sb.append(",");
}
sb.append(")");
return sb.toString();
}
示例3: validateWithAllCombinations
import org.paukov.combinatorics.ICombinatoricsVector; //导入方法依赖的package包/类
/**
* Validates processor against many combinations built from available converters. For more details check
* https://github.com/dpaukov/combinatoricslib#5-subsets
*
* @param content
* content that should be converted
*/
public void validateWithAllCombinations(String content) {
ICombinatoricsVector<Converter> allConverters = Factory.createVector(CONVERTERS);
Generator<Converter> subSet = Factory.createSubSetGenerator(allConverters);
for (ICombinatoricsVector<Converter> subConverters : subSet) {
if (subConverters.getSize() != 0) {
Converter[] converters = subConverters.getVector().toArray(new Converter[subConverters.getSize()]);
validateWithSetsOfDecisions(converters, content);
}
}
}
示例4: validateWithSetsOfDecisions
import org.paukov.combinatorics.ICombinatoricsVector; //导入方法依赖的package包/类
private void validateWithSetsOfDecisions(Converter[] converters, String content) {
ICombinatoricsVector<Decision> allDecisions = Factory.createVector(DECISIONS);
Generator<Decision> subSet = Factory.createSubSetGenerator(allDecisions);
for (ICombinatoricsVector<Decision> subDecisions : subSet) {
if (subDecisions.getSize() != 0) {
Decision[] decisions = subDecisions.getVector().toArray(new Decision[subDecisions.getSize()]);
Execution[] executions = { new Execution(decisions, converters) };
validateProcessor(executions, content);
}
}
}
示例5: convert2String
import org.paukov.combinatorics.ICombinatoricsVector; //导入方法依赖的package包/类
/**
* This method converts a composition into a string
*
* @param vector
* The vector
* @return A string representation of the given vector
*/
public static <T> String convert2String(
ICombinatoricsVector<ICombinatoricsVector<T>> vector) {
StringBuilder sb = new StringBuilder();
sb.append("(");
for (int i = 0; i < vector.getSize(); i++) {
sb.append(vector.getValue(i).getVector().toString());
if (i != vector.getSize() - 1)
sb.append(",");
}
sb.append(")");
return sb.toString();
}