Class PythonCodeArtifact
java.lang.Object
net.ssehub.easy.instantiation.core.model.artifactModel.CompositeArtifact
net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeArtifact
- All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.artifactModel.IArtifact,net.ssehub.easy.instantiation.core.model.artifactModel.IArtifactChangedListener,net.ssehub.easy.instantiation.core.model.artifactModel.IFileSystemArtifact,net.ssehub.easy.instantiation.core.model.vilTypes.IActualValueProvider,net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider,net.ssehub.easy.instantiation.core.model.vilTypes.IVilType,IPythonCodeArtifact,Storable
public class PythonCodeArtifact
extends net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact
implements IPythonCodeArtifact, net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider, Storable
Represents the Python code artifact in VTL.
- Author:
- Kevin Schaperjahn
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider.StringComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PythonCodeBlockprivate PythonCodeDocCommentprivate Fileprivate List<IPythonCodeImport> private Stringprivate booleanFields inherited from class net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact
DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionPythonCodeArtifact(File file, net.ssehub.easy.instantiation.core.model.artifactModel.ArtifactModel model) PythonCodeArtifact(String moduleName) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCall(String name, PythonCodeImportScope scope) Adds a class without comment.Adds a class with comment.addComment(String comment) voidAdds an enum without comment.Adds an enum with comment.Adds a function.Adds a function.Adds a simple import.Adds a module-based import.voidaddSLComment(String comment) addSLComment(String comment, boolean enclosed) addSysPathInsert(int position, String path) Adds a call tosys.path.insertwith givenpositionaddingpathto the system path.addTry()addTypeAlias(String name, String expr) static net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifactstatic PythonCodeArtifactconvert(net.ssehub.easy.instantiation.core.model.artifactModel.IFileSystemArtifact val) static PythonCodeArtifactconvert(net.ssehub.easy.instantiation.core.model.artifactModel.Path path) static PythonCodeArtifactvoiddelete()determineActualValue(Object object) disable()enable()booleanbooleanprivate IPythonCodeImportfindMatchingImport(String imp) intvoidMoves the given import after the last import at the beginning of (this) artifact, or, if there are no imports, to the front.voidregisterImport(IPythonCodeImport imp, boolean explicit) setComment(String comment) voidstore()voidstore(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) protected voidstoreHeader(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) protected voidstoreImports(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) toHeader()validateFuncCall(String name, PythonCodeImportScope scope) voidMethods inherited from class net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact
accept, convert, copy, create, createBinary, createText, exists, getArtifactModel, getFileSeparator, getMd5Hash, getName, getPath, getPathSegments, getPathSeparator, getPlainName, getStringValue, hasSameContent, isTemporary, lastModification, move, prepare, prepareImpl, rename, selectAll, setEnableContentStore, setExecutable, substituteExtensionMethods inherited from class net.ssehub.easy.instantiation.core.model.artifactModel.CompositeArtifact
artifactChanged, getBinary, getBinaryInstance, getRepresentationChanged, getText, getTextInstance, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ssehub.easy.instantiation.core.model.artifactModel.IArtifact
getBinary, getText, updateMethods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
getStringValue
-
Field Details
-
imports
-
block
-
comment
-
file
-
moduleName
-
store
private boolean store
-
-
Constructor Details
-
PythonCodeArtifact
public PythonCodeArtifact(File file, net.ssehub.easy.instantiation.core.model.artifactModel.ArtifactModel model) -
PythonCodeArtifact
-
-
Method Details
-
create
-
enableAutoStore
public boolean enableAutoStore()- Specified by:
enableAutoStorein interfacenet.ssehub.easy.instantiation.core.model.artifactModel.IArtifact
-
enableContentStore
public boolean enableContentStore()- Specified by:
enableContentStorein interfacenet.ssehub.easy.instantiation.core.model.artifactModel.IArtifact
-
disable
-
enable
-
convert
public static net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact convert(String val) throws net.ssehub.easy.instantiation.core.model.common.VilException - Throws:
net.ssehub.easy.instantiation.core.model.common.VilException
-
convert
public static PythonCodeArtifact convert(net.ssehub.easy.instantiation.core.model.artifactModel.IFileSystemArtifact val) -
convert
public static PythonCodeArtifact convert(net.ssehub.easy.instantiation.core.model.artifactModel.Path path) throws net.ssehub.easy.instantiation.core.model.common.VilException - Throws:
net.ssehub.easy.instantiation.core.model.common.VilException
-
determineActualValue
- Specified by:
determineActualValuein interfacenet.ssehub.easy.instantiation.core.model.vilTypes.IActualValueProvider- Overrides:
determineActualValuein classnet.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact
-
getModule
-
getElementCount
public int getElementCount()- Specified by:
getElementCountin interfaceStorable
-
toImports
-
toHeader
-
storeImports
protected void storeImports(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
storeHeader
protected void storeHeader(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
store
public void store() throws net.ssehub.easy.instantiation.core.model.common.VilException- Specified by:
storein interfacenet.ssehub.easy.instantiation.core.model.artifactModel.IArtifact- Overrides:
storein classnet.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact- Throws:
net.ssehub.easy.instantiation.core.model.common.VilException
-
store
public void store(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
delete
public void delete() throws net.ssehub.easy.instantiation.core.model.common.VilException- Specified by:
deletein interfacenet.ssehub.easy.instantiation.core.model.artifactModel.IArtifact- Overrides:
deletein classnet.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact- Throws:
net.ssehub.easy.instantiation.core.model.common.VilException
-
setComment
-
add
-
addRaw
-
addClass
Adds a class without comment.- Parameters:
name- the name of the class- Returns:
- the class for chaining
-
addClass
Adds a class with comment.- Parameters:
name- the name of the classcomment- the comment for the class- Returns:
- the class for chaining
-
addEnum
Adds an enum without comment.- Parameters:
name- the name of the enum- Returns:
- the enum for chaining
-
addEnum
Adds an enum with comment.- Parameters:
name- the name of the enumcomment- the comment for the enum- Returns:
- the enum for chaining
-
addAssign
-
addAssign
-
addMatch
-
addFunc
Description copied from interface:IPythonCodeArtifactAdds a function.- Specified by:
addFuncin interfaceIPythonCodeArtifact- Parameters:
name- the name of the function- Returns:
- the function (for chaining)
-
addFunc
Description copied from interface:IPythonCodeArtifactAdds a function.- Specified by:
addFuncin interfaceIPythonCodeArtifact- Parameters:
name- the name of the functioncomment- the documentation comment of the function- Returns:
- the function (for chaining)
-
addSysPathInsert
Adds a call tosys.path.insertwith givenpositionaddingpathto the system path.- Parameters:
position- the position where to add thepathpath- the path to add- Returns:
- the function call for chaining
-
addTypeAlias
-
addCall
-
addCall
-
addComment
-
addSLComment
-
addSLComment
-
addEmptyLine
public void addEmptyLine() -
addFor
-
addFor
-
addFor
public PythonCodeForLoop addFor(String element, String rangeStart, String rangeEnd, String rangeStep) -
addIf
-
addWhile
-
addTry
-
addRaise
-
addWith
-
addWith
-
addDelete
-
addAssert
-
addAssert
-
addImport
Description copied from interface:IPythonCodeArtifactAdds a simple import.- Specified by:
addImportin interfaceIPythonCodeArtifact- Parameters:
imp- the import- Returns:
- the import (for chaining)
-
addImport
Description copied from interface:IPythonCodeArtifactAdds a module-based import.- Specified by:
addImportin interfaceIPythonCodeArtifact- Parameters:
from- the owning moduleimp- the import- Returns:
- the import (for chaining)
-
findMatchingImport
-
validateType
- Specified by:
validateTypein interfaceIPythonCodeArtifact
-
validateFuncCall
- Specified by:
validateFuncCallin interfaceIPythonCodeArtifact
-
registerImport
- Specified by:
registerImportin interfaceIPythonCodeArtifact
-
moveToImports
Description copied from interface:IPythonCodeArtifactMoves the given import after the last import at the beginning of (this) artifact, or, if there are no imports, to the front.- Specified by:
moveToImportsin interfaceIPythonCodeArtifact- Parameters:
imp- the import to move
-