Class Project

    • Constructor Detail

      • Project

        Project()
        Constructor for serialization.
      • Project

        public Project​(java.lang.String name)
        Constructor for the project.
        Parameters:
        name - Name of project
    • Method Detail

      • addImport

        public boolean addImport​(ProjectImport pimport)
        Adds an import to this project. Conflicts are added always, imports are checked for duplicates.
        Parameters:
        pimport - The import
        Returns:
        true if the addition was successful, false else due to duplicated names
      • removeImport

        public boolean removeImport​(ProjectImport pimport)
        Removes an import from this project.
        Parameters:
        pimport - the import to be removed
        Returns:
        true if the removal was successful, false else due to duplicated names
      • removeElements

        public boolean removeElements​(java.util.List<ContainableModelElement> elementsToRemove)
        Removes all specified elements from this project.
        Parameters:
        elementsToRemove - elements which should be removed. See Configuration.toProject(false).
        Returns:
        true if this project changed as a result of the call
        See Also:
        removeElement(ContainableModelElement)
      • removeElement

        public boolean removeElement​(ContainableModelElement element)
        Removes the specified element from from this project.
        Parameters:
        element - the element that should be removed. See Configuration.toProject(false).
        Returns:
        true if this project changed as a result of the call
      • clear

        public void clear()
        Removes the content of the project. Removes:
        • All model elements
          • All Internal constraints
        • All Imports
      • setVersion

        public void setVersion​(Version version)
        Changes the version of this project.
        Specified by:
        setVersion in interface IModel
        Parameters:
        version - Version to set
      • getVersion

        public Version getVersion()
        Returns the version of this project.
        Specified by:
        getVersion in interface IModel
        Specified by:
        getVersion in interface IModelData
        Returns:
        the version or null if no version is specified for this project.
      • getElement

        public ContainableModelElement getElement​(int index)
        Returns a contained model element specified by index.
        Specified by:
        getElement in interface IResolutionScope
        Parameters:
        index - a 0-based index specifying the operation to be returned
        Returns:
        the contained element
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getElementCount()
      • getCommentBefore

        public Comment getCommentBefore​(IModelElement element,
                                        boolean ensureStructured)
        Returns the comment before the specified model element.
        Parameters:
        element - the element to search for
        ensureStructured - whether a default structured comment shall be inserted before element if no comment was found
        Returns:
        the comment assigned to element or null if none was found or ensureStructured is false, respectively
      • getElementCount

        public int getElementCount()
        Returns the number of contained elements.
        Specified by:
        getElementCount in interface IResolutionScope
        Returns:
        the number of contained elements
      • containsByName

        public boolean containsByName​(java.lang.String name)
        Returns whether this project contains an element and its name.
        Parameters:
        name - the name to search for
        Returns:
        true if this project contains the specified element, false else
      • getElement

        public ContainableModelElement getElement​(java.lang.String name)
        Description copied from interface: IResolutionScope
        Returns a contained model element specified by its name.
        Specified by:
        getElement in interface IResolutionScope
        Parameters:
        name - the qualified or unqualified name to search for
        Returns:
        the related element or null if no such element is known
      • add

        public boolean add​(ContainableModelElement element)
        Method to add an object to the modelElement list of the project. Only named elements are considered for checking duplicates!
        Parameters:
        element - which should be added
        Returns:
        true if the addition was successful, false else due to duplicated names
      • add

        public boolean add​(OperationDefinition definition)
        Method to add an operation definition to the modelElement list of the project.
        Parameters:
        definition - the operation definition which should be added
        Returns:
        true if the addition was successful, false else due to duplicated names
      • remove

        public boolean remove​(OperationDefinition definition)
        Removes the given operation definition.
        Parameters:
        definition - the definition to be removed
        Returns:
        true if the operation was removed, false else
      • accept

        public void accept​(IModelVisitor visitor)
        Accept method for the visitor.
        Specified by:
        accept in interface IFreezable
        Specified by:
        accept in interface IModelElement
        Parameters:
        visitor - The visitor, which should process this model element.
      • getOperation

        public CustomOperation getOperation​(int index)
        Returns the operation specified by index.
        Specified by:
        getOperation in interface ICustomOperationAccessor
        Parameters:
        index - a 0-based index specifying the operation to be returned
        Returns:
        the operation
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getOperationCount()
      • getVariable

        public DecisionVariableDeclaration getVariable()
        Returns the (pseudo) variable for this project. We need this variable to attribute a project.
        Returns:
        the (pseudo) variable
      • hasInterfaces

        public boolean hasInterfaces()
        Returns whether this project has interfaces.
        Specified by:
        hasInterfaces in interface IResolutionScope
        Returns:
        true if it has interfaces, false else
      • attribute

        public boolean attribute​(Attribute attribute)
        Description copied from interface: IAttributableElement
        Attributes this element.
        Specified by:
        attribute in interface IAttributableElement
        Parameters:
        attribute - the attribute to be added
        Returns:
        true if the operation was successful, false if the element is about being attributed multiple times with the same attribute
      • getAttributesCount

        public int getAttributesCount()
        Description copied from interface: IAttributeAccess
        Returns the number of (declared) attributes.
        Specified by:
        getAttributesCount in interface IAttributeAccess
        Returns:
        the number of attributes
      • getAttribute

        public Attribute getAttribute​(java.lang.String name)
        Description copied from interface: IAttributeAccess
        Returns a specific (declared) attribute.
        Specified by:
        getAttribute in interface IAttributeAccess
        Parameters:
        name - the name of the attribute
        Returns:
        the attribute (or null if not found)
      • getAttribute

        public Attribute getAttribute​(int index)
        Description copied from interface: IAttributeAccess
        Returns a specific attribute.
        Specified by:
        getAttribute in interface IAttributeAccess
        Parameters:
        index - the index of the attribute
        Returns:
        the attribute
      • isInterface

        public boolean isInterface()
        Description copied from interface: IResolutionScope
        Returns whether this scope is an interfaces.
        Specified by:
        isInterface in interface IResolutionScope
        Returns:
        true if it is an interface, false else
      • getNameSpace

        public java.lang.String getNameSpace()
        Description copied from interface: IModelElement
        Returns the namespace introduced by this model element.
        Specified by:
        getNameSpace in interface IModelElement
        Overrides:
        getNameSpace in class ModelElement
        Returns:
        the namespace introduced by this model element.
      • setParent

        void setParent​(Project parent)
        Changes the parent of this project (intended to be used internally by the copy mechanism).
        Parameters:
        parent - the new parent
      • setComments

        public void setComments​(StructuredComment comment)
        Sets a structured comment object for this project.
        Parameters:
        comment - the comment object (may be null)
      • getComments

        public StructuredComment getComments()
        Returns the structured comment for this project.
        Returns:
        structured comment instance
      • getNestedComment

        public Comment getNestedComment​(java.lang.Object element)
        Returns a comment for an element from within the getComments().
        Parameters:
        element - the element to return the comment for
        Returns:
        the element, may be null
      • sortContainedElements

        public void sortContainedElements​(java.util.Comparator<ContainableModelElement> comp)
        Sorts the contained elements according to the specified comparator. Please note the following requirements for applying this method:
        • All Elements which were added before this operation must still be member of this project after executing this operation.
        • Comments related to an element must occur before the element in the final sequence.
        Parameters:
        comp - a comparator which fulfills the requirements above
      • propagateAttribute

        public boolean propagateAttribute​(Attribute attribute)
        Description copied from interface: IModelElement
        Propagates an attribute application from the parent to this element or contained elements. This may imply the creation of clones of the given attribute.
        Specified by:
        propagateAttribute in interface IModelElement
        Overrides:
        propagateAttribute in class ModelElement
        Parameters:
        attribute - the attribute to be propagated
        Returns:
        true if the operation was successful, false if the element is about being attributed multiple times with the same attribute
      • getSuper

        public ModelImport<Project> getSuper()
        Returns the reference to the super model (if it exists).
        Specified by:
        getSuper in interface IModel
        Returns:
        always null as this does not exist in IVML
      • getIndentationConfiguration

        public IndentationConfiguration getIndentationConfiguration()
        Returns the indentation configuration for this model. The indentation configuration is considered to be immutable.
        Specified by:
        getIndentationConfiguration in interface IModel
        Returns:
        the indentation configuration (disabled if null)
      • dispose

        public void dispose()
        Description copied from interface: IModel
        Shall be called at the end of the lifetime of the model in order to clean up references such as listeners.
        Specified by:
        dispose in interface IModel
      • getRestrictionEvaluationContext

        public IRestrictionEvaluationContext getRestrictionEvaluationContext()
        Description copied from interface: IModel
        Returns the context for evaluating import / conflict restrictions. This context shall only contain the information that is necessary to evaluate restriction information.
        Specified by:
        getRestrictionEvaluationContext in interface IModel
        Returns:
        the evaluation context