本文整理汇总了Java中de.ovgu.featureide.fm.core.io.UnsupportedModelException类的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedModelException类的具体用法?Java UnsupportedModelException怎么用?Java UnsupportedModelException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnsupportedModelException类属于de.ovgu.featureide.fm.core.io包,在下文中一共展示了UnsupportedModelException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFModelStep
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
/**
* Processes a single Xml-Tag.
* @param n
* @throws UnsupportedModelException
*/
private void buildFModelStep(Node n) throws UnsupportedModelException {
if (n.getNodeType() != Node.ELEMENT_NODE) return;
String tag = n.getNodeName();
if (tag.equals("feature_tree")) {
handleFeatureTree(n);
} else if (tag.equals("feature_model")) {
line++;
return;
} else if (tag.equals("constraints")) {
line++;
handleConstraints(n);
} else {
throw new UnsupportedModelException("Unknown Xml-Tag", line);
}
}
示例2: handleArbitrayCardinality
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
/**
* If there are groups with a cardinality other then [1,*] or [1,1], this
* function makes the necessary adjustments to the model
* @param featList List of features with arbitrary cardinalities
* @throws UnsupportedModelException
*/
private void handleArbitrayCardinality(LinkedList<FeatCardinality> featList)
throws UnsupportedModelException {
org.prop4j.Node node;
for (FeatCardinality featCard : featList) {
Feature feat = featCard.feat;
node = new And();
LinkedList<Feature> children = feat.getChildren();
for (Feature child : children) child.setMandatory(false);
int start = featCard.start;
int end = featCard.end;
if ((start < 0) || (start > end) || (end > children.size()))
throw new UnsupportedModelException("Group cardinality " +
"invalid", line);
int f = children.size();
node = buildMinConstr(children, f - start + 1, feat.getName());
featureModel.addPropositionalNode(node);
if ((start > 0) && (end < f)) {
node = buildMaxConstr(children, end + 1);
featureModel.addPropositionalNode(node);
}
}
}
示例3: handleSingleConstraint
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
/**
* Handles a single constraints.
* @param lineText Text description of a Constraint
* @throws UnsupportedModelException
*/
private void handleSingleConstraint(String lineText)
throws UnsupportedModelException {
String newLine = lineText.replace("(", " ( ");
newLine = newLine.replace(")", " ) ");
newLine = newLine.replace("~", " ~ ");
Scanner scan = new Scanner(newLine);
scan.skip(".*:");
LinkedList<String> elements = new LinkedList<String>();
while (scan.hasNext()) {
elements.add(scan.next());
}
scan .close();
org.prop4j.Node propNode = buildPropNode(elements);
featureModel.addPropositionalNode(propNode);
}
示例4: buildLeafNodes
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
private org.prop4j.Node buildLeafNodes(LinkedList<String> list)
throws UnsupportedModelException {
String element;
if (list.isEmpty())
throw new UnsupportedModelException("Fehlendes Element", line);
element = list.removeFirst();
if ((element.equals("(")) && (!list.isEmpty()))
element = list.removeFirst();
if (element.equals("~")) {
return new Not(buildPropNode(list));
} else {
Feature feat = idTable.get(element);
if (feat == null)
throw new UnsupportedModelException("The feature '" + element +
"' does not occur in the grammar!", 0);
return new Literal(feat.getName());
}
}
示例5: parseInputStream
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Override
public void parseInputStream(InputStream inputStream)
throws UnsupportedModelException {
warnings.clear();
try {
synchronized (lock) {
Parser myParser = Parser.getInstance(inputStream);
Model root = (Model) myParser.parseAll();
readModelData(root);
}
featureModel.handleModelDataLoaded();
}
catch (ParseException e) {
int line = e.currentToken.next.beginLine;
throw new UnsupportedModelException(e.getMessage(), line);
}
}
示例6: readGProduction
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
private void readGProduction(GProduction gProduction) throws UnsupportedModelException {
String name = gProduction.getIDENTIFIER().name;
Feature feature = featureModel.getFeature(name);
if (feature == null)
throw new UnsupportedModelException("The compound feature '" + name + "' have to occur on a right side of a rule before using it on a left side!", gProduction.getIDENTIFIER().lineNum());
feature.setAND(false);
Pats pats = gProduction.getPats();
AstListNode astListNode = (AstListNode) pats.arg[0];
do {
Feature child = readPat((Pat) astListNode.arg[0]);
feature.addChild(child);
feature.setAbstract(!noAbstractFeatures);
astListNode = (AstListNode) astListNode.right;
} while (astListNode != null);
simplify(feature);
}
示例7: readConsStmt
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
private void readConsStmt(ConsStmt consStmt) throws UnsupportedModelException {
ESList eSList = consStmt.getESList();
AstListNode astListNode = (AstListNode) eSList.arg[0];
do {
line = 0;
Node node = exprToNode(((EStmt) astListNode.arg[0]).getExpr());
try {
if (!new SatSolver(new Not(node.clone()), 250).isSatisfiable())
warnings.add(new ModelWarning("Constraint is a tautology.", line));
if (!new SatSolver(node.clone(), 250).isSatisfiable())
warnings.add(new ModelWarning("Constraint is not satisfiable.", line));
} catch (Exception e) {
}
featureModel.addPropositionalNode(node);
astListNode = (AstListNode) astListNode.right;
} while (astListNode != null);
}
示例8: getGUIDSL
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
public GUIDSL getGUIDSL() throws UnsupportedModelException{
// bug: Have to redirect out
PrintStream out = System.out;
ByteArrayOutputStream fos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(fos);
System.setOut(ps);
fm.dumpXML();
System.setOut(out);
String xml = new String(fos.toByteArray());
try {
fos.close();
} catch (IOException e) {
}
ps.close();
de.ovgu.featureide.fm.core.FeatureModel m = new de.ovgu.featureide.fm.core.FeatureModel();
WaterlooReader wr = new WaterlooReader(m);
xml = xml.substring(0, xml.indexOf("<meta>")) + xml.substring(xml.indexOf("<feature_tree>"));
//System.out.println(xml);
wr.readFromString(xml);
return new GUIDSL(m);
}
示例9: sat_time
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
long sat_time(Map<String, String> argsMap)
throws UnsupportedModelException, IOException,
FeatureModelException, ContradictionException, TimeoutException {
loadFM(argsMap.get("fm"));
System.out.println("Satisfying the feature model");
long start, end;
SAT4JSolver s = null;
s = cnf.getSAT4JSolver();
//start = System.currentTimeMillis();
start = System.nanoTime();
boolean issat = s.isSatisfiable();
//end = System.currentTimeMillis();
end = System.nanoTime();
System.out.println("SAT done: " + (end-start)/1000 + " microseconds, sat: " + issat);
return (end-start)/1000;
}
示例10: testConvertToCNF
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testConvertToCNF() throws UnsupportedModelException, IOException, FeatureModelException{
for(String file : new FileUtility().traverseDirCollectFiles("TestData/Realistic")){
SXFM fm = null;
if(file.endsWith(".m")){
System.out.println("Testing conversion GUIDSL file to CNF: " + file);
GUIDSL m1 = new GUIDSL(new File(file));
fm = m1.getSXFM();
}else if(file.endsWith(".xml")){
System.out.println("Testing conversion SXFM file to CNF: " + file);
fm = new SXFM(file);
}else continue;
CNF cnf = fm.getCNF();
assertNotNull(cnf);
}
}
示例11: testLimitCoverage
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testLimitCoverage() throws IOException, UnsupportedModelException, FeatureModelException, TimeoutException, CoveringArrayGenerationException{
GUIDSL m1 = new GUIDSL(new File("TestData/Realistic/Apl.m"));
SXFM fm = m1.getSXFM();
CNF cnf = fm.getCNF();
CoveringArray ca = cnf.getCoveringArrayGenerator("ICPL", 2);
ca.generate(75, Integer.MAX_VALUE);
// Calculate the valid pairs
List<Pair2> uncovered = cnf.getAllValidPairs(1);
System.out.println("Valid pairs: " + uncovered.size());
// Calculate the covered pairs
List<List<Integer>> sols = ca.getSolutionsAsList();
Set<Pair2> coveredPairs = ca.getCovInv(sols, uncovered);
System.out.println("Covered pairs: " + coveredPairs.size());
// Coverage
System.out.println("Coverage: " + coveredPairs.size() + "/" + uncovered.size() + " = " + (float)coveredPairs.size()*100/uncovered.size() + "%");
assertTrue(ca.getCoverage() >= (int)((float)coveredPairs.size()*100/uncovered.size()));
}
示例12: testCNFModelLoad2
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testCNFModelLoad2() throws UnsupportedModelException, IOException, FeatureModelException, ContradictionException, TimeoutException, BDDExceededBuildingTimeException, java.util.concurrent.TimeoutException, CSVException{
File testFile = new File("TestData/Realistic/Berkeley.cnf.ca1.csv");
if(testFile.exists()){
testFile.delete();
}
SPLCATool.main(new String [] {
"-t", "t_wise",
"-s", "1",
"-fm", new File("TestData/Realistic/Berkeley.cnf").getAbsoluteFile().toString()
}
);
assertTrue(testFile.exists());
}
示例13: testDIMACSModelLoad2
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testDIMACSModelLoad2() throws UnsupportedModelException, IOException, FeatureModelException, ContradictionException, TimeoutException, BDDExceededBuildingTimeException, java.util.concurrent.TimeoutException, CSVException{
File testFile = new File("TestData/Realistic/Eshop-fm.dimacs.ca1.csv");
if(testFile.exists()){
testFile.delete();
}
SPLCATool.main(new String [] {
"-t", "t_wise",
"-s", "1",
"-fm", new File("TestData/Realistic/Eshop-fm.dimacs").getAbsoluteFile().toString()
}
);
assertTrue(testFile.exists());
}
示例14: testSXFMModelLoad2
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testSXFMModelLoad2() throws UnsupportedModelException, IOException, FeatureModelException, ContradictionException, TimeoutException, BDDExceededBuildingTimeException, java.util.concurrent.TimeoutException, CSVException{
File testFile = new File("TestData/Realistic/smart_home_fm.xml.ca1.csv");
if(testFile.exists()){
testFile.delete();
}
SPLCATool.main(new String [] {
"-t", "t_wise",
"-s", "1",
"-fm", new File("TestData/Realistic/smart_home_fm.xml").getAbsoluteFile().toString()
}
);
assertTrue(testFile.exists());
}
示例15: testGUIDSLModelLoad2
import de.ovgu.featureide.fm.core.io.UnsupportedModelException; //导入依赖的package包/类
@Test
public void testGUIDSLModelLoad2() throws UnsupportedModelException, IOException, FeatureModelException, ContradictionException, TimeoutException, BDDExceededBuildingTimeException, java.util.concurrent.TimeoutException, CSVException{
File testFile = new File("TestData/Realistic/Violet.m.ca1.csv");
if(testFile.exists()){
testFile.delete();
}
SPLCATool.main(new String [] {
"-t", "t_wise",
"-s", "1",
"-fm", new File("TestData/Realistic/Violet.m").getAbsoluteFile().toString()
}
);
assertTrue(testFile.exists());
}