Class Utils
- java.lang.Object
-
- de.uni_hildesheim.sse.translation.Utils
-
public class Utils extends java.lang.ObjectSome public utility methods.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUtils.SplitResultThe result of splitting a contents object.
-
Constructor Summary
Constructors Modifier Constructor Description privateUtils()Prevents this class from being instantiated from outside.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static <T> java.util.List<T>assign(java.util.List<T> list, java.lang.Object element, java.lang.Class<T> type)Helper function to assign theelementtolistifelementis of typetypeand to createlistif not defined before.static java.lang.StringgetQualifiedNameString(de.uni_hildesheim.sse.ivml.QualifiedName name)Returns a string representing a qualified name.static java.lang.StringgetQualifiedNameString(de.uni_hildesheim.sse.ivml.QualifiedName name, de.uni_hildesheim.sse.ivml.AccessName aName)Returns a string representing a qualified name.static booleanisImportResolutionEnabled()Returns whether the import resolution shall be enabled.static <T> java.util.List<T>select(java.util.List<org.eclipse.emf.ecore.EObject> list, java.lang.Class<T> type)Selects those elements out oflistwhich are an instance oftype.static Utils.SplitResultsplit(java.util.List<org.eclipse.emf.ecore.EObject> elements)Splits the now heterogeneous list of elements inelementsinto individual lists stored in the result instance.static voidsplit(java.util.List<org.eclipse.emf.ecore.EObject> elements, Utils.SplitResult result)Splits the now heterogeneous list of elements inelementsinto individual lists stored inresultinstance.static java.lang.StringtoString(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl)Turns the declared variable names of thevarDeclinto a string.
-
-
-
Method Detail
-
getQualifiedNameString
public static java.lang.String getQualifiedNameString(de.uni_hildesheim.sse.ivml.QualifiedName name)
Returns a string representing a qualified name. (May change in future to structured qualified names.)- Parameters:
name- the qualified name- Returns:
- the corresponding string representation
-
getQualifiedNameString
public static java.lang.String getQualifiedNameString(de.uni_hildesheim.sse.ivml.QualifiedName name, de.uni_hildesheim.sse.ivml.AccessName aName)Returns a string representing a qualified name. (May change in future to structured qualified names.)- Parameters:
name- the qualified nameaName- optional access to a compound (may be null)- Returns:
- the corresponding string representation
-
select
public static <T> java.util.List<T> select(java.util.List<org.eclipse.emf.ecore.EObject> list, java.lang.Class<T> type)Selects those elements out oflistwhich are an instance oftype.- Type Parameters:
T- the type of elements to be selected- Parameters:
list- the list to select fromtype- the type to select upon- Returns:
- a list of elements which are an instance of
type
-
assign
private static <T> java.util.List<T> assign(java.util.List<T> list, java.lang.Object element, java.lang.Class<T> type)Helper function to assign theelementtolistifelementis of typetypeand to createlistif not defined before.- Type Parameters:
T- the type of elements to be processed- Parameters:
list- the list to insertelementintoelement- the element to be insertedtype- the type to check for- Returns:
listor a new list includingelementiftypematches
-
split
public static Utils.SplitResult split(java.util.List<org.eclipse.emf.ecore.EObject> elements)
Splits the now heterogeneous list of elements inelementsinto individual lists stored in the result instance.- Parameters:
elements- the elements to split- Returns:
- the result instance
-
split
public static void split(java.util.List<org.eclipse.emf.ecore.EObject> elements, Utils.SplitResult result)Splits the now heterogeneous list of elements inelementsinto individual lists stored inresultinstance.- Parameters:
elements- the elements to splitresult- the result instance to be modified as a side effect
-
isImportResolutionEnabled
public static final boolean isImportResolutionEnabled()
Returns whether the import resolution shall be enabled. This method is legacy and was created while the editor was in an early stage. Please check and remove if adequate.- Returns:
trueif import resolution is enabled,falseelse
-
toString
public static java.lang.String toString(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl)
Turns the declared variable names of thevarDeclinto a string. [debugging]- Parameters:
varDecl- the variable declaration- Returns:
- the names of the declared variables
-
-