Esempio n. 1
0
        public override SolidityStatement GetStatementForPrevious(ProcessElement previous)
        {
            var statement = new SolidityStatement();

            statement.Add(GetChangeActiveStateStatement(true));
            statement.Add(GetFunctionCallStatement());
            return(statement);
        }
Esempio n. 2
0
        SolidityStatement CreateNextElementStatement()
        {
            var statement = new SolidityStatement();

            statement.Add(GetChangeActiveStateStatement(false));
            statement.Add(processConverter.GetStatementOfNextElement(callActivity));
            return(statement);
        }
        public void MultipleLineStatementTest()
        {
            var statement = new SolidityStatement();

            statement.Add(line1);
            statement.Add(line2);
            Assert.Equal(line1 + ";\n" + line2 + ";\n", statement.ToString());
        }
Esempio n. 4
0
        public override SolidityStatement GetStatementForPrevious(ProcessElement previous)
        {
            var statement = new SolidityStatement();

            if (counterVariablePresent)
            {
                statement.Add(new SolidityStatement($"{ConversionTemplates.MultiInstanceCounterVariable(GetElementCallName())} = 0"));
            }
            statement.Add(GetChangeActiveStateStatement(true));
            return(statement);
        }
Esempio n. 5
0
        SolidityStatement CreateTouchFunctionLogic(TaskConverter attachedToConverter)
        {
            var touchLogic = new SolidityStatement();

            //Disable the current state
            touchLogic.Add(attachedToConverter.GetChangeActiveStateStatement(false));
            //place the call statement of the next element
            touchLogic.Add(processConverter.GetStatementOfNextElement(eventElement));
            touchLogic.Add(new SolidityStatement("return false"));
            return(touchLogic);
        }
Esempio n. 6
0
        public override SolidityStatement GetStatementForPrevious(ProcessElement previous)
        {
            var statement = new SolidityStatement();

            statement.Add(GetChangeActiveStateStatement(true));
            //Call the return function of the parent call element, if it exists
            if (processConverter.ParentProcessConverter != null)
            {
                var callActivityReturnName = ConversionTemplates.CallActivityReturnFunctionName(processConverter.GetParentCallActivityCallName());
                statement.Add($"{callActivityReturnName}({processConverter.ParentProcessConverter.GetIdentifierNames()})");
            }
            return(statement);
        }
Esempio n. 7
0
        public override SolidityStatement GetStatementForPrevious(ProcessElement previous)
        {
            SolidityStatement statement = new SolidityStatement();

            if (gateway.Incoming.Count > 1)
            {
                var commonFlow = gateway.Incoming.Intersect(previous.Outgoing);
                statement.Add(incVaribaleName + " += 1");
            }

            statement.Add(gateway.Id + "Logic" + "()");

            return(statement);
        }
Esempio n. 8
0
        public override SolidityStatement GetStatementForPrevious(ProcessElement previous)
        {
            SolidityStatement statement = new SolidityStatement();

            statement.Add(GetFunctionCallStatement());
            return(statement);
        }
        public void NoSemicolonTest()
        {
            var statement = new SolidityStatement();

            statement.Add(line1, false);
            Assert.Equal(line1 + "\n", statement.ToString());
        }
        public SolidityStatement GetConstructorStatements()
        {
            var statement = new SolidityStatement();

            foreach (var tokenConverter in tokenConverters)
            {
                statement.Add(tokenConverter.GetConstructorStatement());
            }
            return(statement);
        }
        public SolidityStatement ConvertProperty(Property property)
        {
            SolidityStatement propertyStatement = new SolidityStatement();
            string            propertyType      = Helpers.PropertyTypeToString(property, contractConverter);
            var propertyName = Helpers.ToLowerCamelCase(property.Name);

            if (property.PropertyType == PropertyType.Single || property.PropertyType == PropertyType.Collection)
            {
                propertyStatement.Add($"{propertyType} {propertyName}");
            }
            else if (property.PropertyType == PropertyType.Dictionary)
            {
                var keyType = Helpers.PrimitivePropertyTypeToString(property.KeyDataType);
                propertyStatement.Add(ConversionTemplates.MappingTypeVariableDefinition(propertyName, keyType, propertyType));
                //Also an an array to store the key values (used when iteration through the mapping is required)
                propertyStatement.Add($"{keyType}[] {ConversionTemplates.MappingKeysArrayName(propertyName)}");
            }
            return(propertyStatement);
            //TODO: exception propertytype not defined
        }
Esempio n. 12
0
        SolidityStatement CreateCallsToOutgoing()
        {
            var nextElementConverters = processConverter.GetTargetConvertersOfElement(gatewayElement).ToList();
            var statement             = new SolidityStatement();

            nextElementConverters.ForEach(e =>
            {
                e.GetStatementForPrevious(gatewayElement).GetStatements().
                ForEach(f => statement.Add(f));
            });
            return(statement);
        }
Esempio n. 13
0
        SolidityStatement CreateParallelism(List <ElementConverter> nextElements)
        {
            var statement = new SolidityStatement();

            nextElements.ForEach(e => { e.GetStatementForPrevious(gateway).GetStatements().ForEach(e => statement.Add(e)); });
            return(statement);
        }