-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
uowiy
committed
Jul 2, 2024
1 parent
12e523f
commit 98e3ace
Showing
5 changed files
with
164 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* This Source Code Form is subject to the terms of the Mozilla | ||
* Public License, v. 2.0. If a copy of the MPL was not distributed | ||
* with this file, You can obtain one at | ||
* https://mozilla.org/MPL/2.0/. | ||
* | ||
* Contributors: | ||
* @author Kevin Feichtinger | ||
* @author Prankur Agarwal | ||
* @author Jakob Gretenkort | ||
* | ||
* An implementation of the universal variability language. | ||
* | ||
* Copyright 2023 Johannes Kepler University Linz | ||
* LIT Cyber-Physical Systems Lab | ||
* All rights reserved | ||
*******************************************************************************/ | ||
package at.jku.cps.travart.core.basic; | ||
|
||
import at.jku.cps.travart.core.FeatureModelStatistics; | ||
import at.jku.cps.travart.core.common.IDeserializer; | ||
import at.jku.cps.travart.core.common.ILanguage; | ||
import at.jku.cps.travart.core.common.ISerializer; | ||
import at.jku.cps.travart.core.common.IStatistics; | ||
import at.jku.cps.travart.core.io.UVLDeserializer; | ||
import at.jku.cps.travart.core.io.UVLSerializer; | ||
import de.vill.model.FeatureModel; | ||
|
||
/** | ||
* An implementation of the universal variability language, providing | ||
*/ | ||
public class UVL implements ILanguage<FeatureModel> { | ||
|
||
@Override | ||
public IDeserializer<FeatureModel> getDeserializer() { | ||
return new UVLDeserializer(); | ||
} | ||
|
||
@Override | ||
public IStatistics<FeatureModel> getStatistics() { | ||
return FeatureModelStatistics.getInstance(); | ||
} | ||
|
||
@Override | ||
public ISerializer<FeatureModel> getSerializer() { | ||
return new UVLSerializer(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Universal Variability Language"; | ||
} | ||
|
||
@Override | ||
public String getAbbreviation(){ | ||
return "UVL"; | ||
} | ||
|
||
@Override | ||
public Iterable<String> getSupportedFileExtensions() { | ||
return getDeserializer().fileExtensions(); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/main/java/at/jku/cps/travart/core/common/ILanguage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/******************************************************************************* | ||
* This Source Code Form is subject to the terms of the Mozilla | ||
* Public License, v. 2.0. If a copy of the MPL was not distributed | ||
* with this file, You can obtain one at | ||
* https://mozilla.org/MPL/2.0/. | ||
* | ||
* Contributors: | ||
* @author Kevin Feichtinger | ||
* @author Prankur Agarwal | ||
* @author Jakob Gretenkort | ||
* | ||
* The base interface for a variability language. | ||
* | ||
* Copyright 2023 Johannes Kepler University Linz | ||
* LIT Cyber-Physical Systems Lab | ||
* All rights reserved | ||
*******************************************************************************/ | ||
package at.jku.cps.travart.core.common; | ||
|
||
import at.jku.cps.travart.core.basic.DefaultPrettyPrinter; | ||
|
||
/** | ||
* A variability language must provide access to a | ||
* {@link ISerializer}/{@link IDeserializer} to serialize/deserialize the | ||
* language's variability model and {@link IStatistics} to get the statistics of | ||
* the variability model. | ||
* | ||
* @author Prankur Agarwal | ||
* @author Kevin Feichtinger | ||
* @author Jakob Gretenkort | ||
*/ | ||
public interface ILanguage<T> { | ||
/** | ||
* Returns the deserializer of the language to deserializer the variability | ||
* model. | ||
* | ||
* @return the deserializer of the language to deserializer the variability | ||
* model. | ||
*/ | ||
IDeserializer<T> getDeserializer(); | ||
|
||
/** | ||
* Returns the statistics of the language to get the statistics the variability | ||
* model. | ||
* | ||
* @return the statistics of the language to get the statistics the variability | ||
* model. | ||
*/ | ||
IStatistics<T> getStatistics(); | ||
|
||
/** | ||
* Returns the serializer of the language to serialize the variability model. | ||
* | ||
* @return the serializer of the language to serialize the variability model. | ||
*/ | ||
ISerializer<T> getSerializer(); | ||
|
||
/** | ||
* Returns the pretty printer of the language to create human-readable | ||
* representations of the variability model. | ||
* | ||
* @return the pretty printer to create human-readable representations of | ||
* the variability model. | ||
*/ | ||
default IPrettyPrinter<T> getPrinter() { | ||
return new DefaultPrettyPrinter<T>(this.getSerializer()); | ||
} | ||
|
||
/** | ||
* Returns the variability model type name. | ||
* | ||
* @return the name of the variability model type. | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* Returns an abbreviation, typically an acronym of the variability type name. | ||
* | ||
* @return the abbreviated version of the variability type name. | ||
*/ | ||
String getAbbreviation(); | ||
|
||
/** | ||
* Returns a iterable of file extensions for which this language is applicable. | ||
* | ||
* @return a unmodifiable list of file extensions. | ||
*/ | ||
Iterable<String> getSupportedFileExtensions(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters