Пример #1
0
        public void setUp()
        {
            if (model == null)
            {
                reader = getReader();
                Assert.IsNotNull(model = reader.getModel());
                OclTypesFactory.setEnvironment(model);
            }

            environment = model.getEnvironmentWithoutParents();
        }
Пример #2
0
        /* (non-Javadoc)
         * @see ocl20.CoreOperation#getReturnType()
         */

        public virtual CoreClassifier getReturnType()
        {
            CoreClassifier returnType = getSpecificReturnParameterType();

            if (returnType != null && OclTypesDefinition.typeNeedsToBeParsed(returnType))
            {
                return(OclTypesFactory.createTypeFromString(returnType.getName()));
            }
            else
            {
                return(returnType);
            }

//		return	getSpecificReturnParameterType();
        }
Пример #3
0
        /* (non-Javadoc)
         * @see ocl20.CoreOperation#getParametersTypesExceptReturn()
         */

        public List <object> getParametersTypesExceptReturn()
        {
            List <object> parameters = getSpecificParameterTypesExceptReturn();
            List <object> result     = new List <object>();

            if (parameters != null)
            {
                foreach (CoreClassifier paramType in parameters)
                {
                    if (OclTypesDefinition.typeNeedsToBeParsed(paramType.getName()))
                    {
                        result.Add(OclTypesFactory.createTypeFromString(paramType.getName()));
                    }
                    else
                    {
                        result.Add(paramType);
                    }
                }
            }
            return(result);


//		return	adjustCollectionResult(getSpecificParameterTypesExceptReturn());
        }
Пример #4
0
        /// <summary>
        /// Retorna a representação de uma planilha em memória que satisfaz o modelo passado como parâmetro
        /// </summary>
        /// <param name="classDiagramPath">caminho para o arquivo .classdiagram que contém o modelo</param>
        /// <returns>represetação da planilha em memória</returns>
        public XWorkbook createXWorkbook(string classDiagramPath)
        {
            ModelReader   reader = new VscdReader(classDiagramPath);
            CoreModelImpl model  = (CoreModelImpl)reader.getModel();

            OclTypesFactory.setEnvironment(model);

            XWorkbook xWorkbook = new XWorkbook();

            xWorkbook.setName(model.getName());

            environment = model.getEnvironmentWithoutParents();
            IEnumerable <CoreClassifier> modelClasses = getClasses(model);

            foreach (CoreClassifier coreClassifier in modelClasses)
            {
                XWorksheet xWorksheet = new XWorksheet();
                xWorksheet.setName(coreClassifier.getName());
                xWorksheet.setWorkbook(xWorkbook);
                updateWorkbook(xWorkbook, xWorksheet);

                XDataTable xDataTable = new XDataTable();
                xDataTable.setName(coreClassifier.getName());
                xDataTable.setWorksheet(xWorksheet);
                updateWorksheet(xWorksheet, xDataTable);

                createFeatureColumns(coreClassifier, xDataTable, model);
                createAssociationColumn(model, coreClassifier, xDataTable);
            }

            IEnumerable <CoreClassifier> enumerations = getEnumerations(model);
            var iEnumerable = enumerations as IList <CoreClassifier> ?? enumerations.ToList();

            if (enumerations != null && iEnumerable.Any())
            {
                foreach (CoreClassifier enumeration in iEnumerable)
                {
                    XWorksheet xWorksheet = new XWorksheet();
                    xWorksheet.setName(enumeration.getName());
                    xWorksheet.setWorkbook(xWorkbook);
                    updateWorkbook(xWorkbook, xWorksheet);

                    XDataTable xDataTable = new XDataTable();
                    xDataTable.setName(enumeration.getName());
                    xDataTable.setWorksheet(xWorksheet);
                    updateWorksheet(xWorksheet, xDataTable);

                    XDataTableColumn xDataTableColumn = new XDataTableColumn();
                    xDataTableColumn.setName(enumeration.getName());
                    xDataTableColumn.setDataTable(xDataTable);
                    updateDataTable(xDataTable, xDataTableColumn);

                    XDataArray dataArray   = new XDataArray();
                    var        arraySymbol =
                        (from CoreAttributeImpl attribute in
                         enumeration.getClassifierFeatures().Where(f => f is CoreAttributeImpl)
                         select attribute.getName()).ToList();
                    dataArray.setArray(arraySymbol);
                    xDataTableColumn.setDataContent(dataArray);
                }
            }

            return(xWorkbook);
        }