コード例 #1
0
        //Print declaration template of Solidity struct wrapping up output clauses.
        public virtual SolidityStruct CreateOutputStruct()
        {
            OutputStructName = string.Concat(Regex.Replace(Decision.Id, @" ", "").ToUpperCamelCase(), "Output");
            var outputStruct = new SolidityStruct(OutputStructName);

            //Print struct's Solidity property based on its DMN modeller counterpart.
            foreach (var outputClause in Decision.DecisionTable.Outputs)
            {
                outputStruct.AddToBody(new SolidityStatement($"{ConvertDecisionDataType(outputClause.TypeRef)} {outputClause.Name.ToLowerCamelCase().Replace(".", "__")}"));
            }
            return(outputStruct);
        }
コード例 #2
0
        private SolidityStruct GetSampleStruct()
        {
            Entity   entity   = new Entity();
            Property property = new Property();

            property.Id       = propertyId;
            property.Name     = propertyName;
            property.DataType = propertyType;

            entity.Id   = structId;
            entity.Name = structName;
            entity.Properties.Add(property);

            var s = new SolidityStruct(entity.Name);

            s.AddToBody(new SolidityStatement(propertyType.ToString().ToLower() + " " + propertyName));
            return(s);
        }
コード例 #3
0
 void ConvertEntities()
 {
     foreach (var entity in contractConverter.Contract.Entities)
     {
         if (entity.IsRootEntity)
         {
             foreach (var property in entity.Properties)
             {
                 rootProperties.Add(ConvertProperty(property));
             }
         }
         else
         {
             SolidityStruct solidityStruct = new SolidityStruct(entity.ToStructureName());
             foreach (var property in entity.Properties)
             {
                 solidityStruct.AddToBody(ConvertProperty(property));
             }
             structs.Add(solidityStruct);
         }
     }
 }