コード例 #1
0
 public IdfField(bool required,
                 string units,
                 double minimum,
                 double maximum,
                 string defaultValue,
                 bool autoCalculatable,
                 bool autoSizeable,
                 IdfFieldAlphaNumeric alphaNumeric,
                 HashSet <string> keys,
                 string name,
                 IdfFieldMinMaxType minType,
                 IdfFieldMinMaxType maxType,
                 List <string> referenceList,
                 List <string> referenceClassList,
                 List <string> objectList)
 {
     Required           = required;
     Units              = units;
     Minimum            = minimum;
     Maximum            = maximum;
     Default            = defaultValue;
     AutoCalculatable   = autoCalculatable;
     AutoSizeable       = autoSizeable;
     AlphaNumeric       = alphaNumeric;
     Keys               = keys;
     Name               = name;
     MinType            = minType;
     MaxType            = maxType;
     ReferenceList      = referenceList;
     ReferenceClassList = referenceClassList;
     ObjectList         = objectList;
 }
コード例 #2
0
ファイル: IddListener.cs プロジェクト: mitchpaulus/idflint
        public IdfField GetField(IddParser.Field_propertiesContext context, IdfFieldAlphaNumeric alphaNumeric)
        {
            IdfField field = new IdfField();

            field.AlphaNumeric = alphaNumeric;

            IddParser.Field_propertiesContext propertyContext = context;
            IddParser.Field_propertyContext[] properties      = propertyContext.field_property();

            foreach (IddParser.Field_propertyContext prop in properties)
            {
                if (prop.AUTOSIZABLE_STATEMENT() != null)
                {
                    field.AutoSizeable = true;
                }
                else if (prop.AUTOCALCULATABLE_STATEMENT() != null)
                {
                    field.AutoCalculatable = true;
                }
                else if (prop.REQUIRED_FIELD_STATEMENT() != null)
                {
                    field.Required = true;
                }
                else if (prop.UNITS_STATEMENT() != null)
                {
                    field.Units = prop.UNITS_STATEMENT().GetText().Substring(7).Trim();
                }
                else if (prop.KEY_STATEMENT() != null)
                {
                    field.Keys.Add(prop.KEY_STATEMENT().GetText().Substring(5).Trim());
                }
                else if (prop.FIELD_STATEMENT() != null)
                {
                    field.Name = prop.FIELD_STATEMENT().GetText().Substring(7).Trim();
                }
                else if (prop.REFERENCE_STATEMENT() != null)
                {
                    field.ReferenceList.Add(prop.REFERENCE_STATEMENT().GetText().Substring(11).Trim());
                }
                else if (prop.REFERENCE_CLASS_NAME_STATEMENT() != null)
                {
                    field.ReferenceClassList.Add(prop.REFERENCE_CLASS_NAME_STATEMENT().GetText().Substring(22).Trim());
                }
                else if (prop.OBJECT_LIST_STATEMENT() != null)
                {
                    field.ObjectList.Add(prop.OBJECT_LIST_STATEMENT().GetText().Substring(13).Trim());
                }
                else if (prop.minimum_inclusive_statement() != null)
                {
                    field.MinType = IdfFieldMinMaxType.Inclusive;
                    field.Minimum = double.Parse(prop.minimum_inclusive_statement().minval.Text.Trim());
                }
                else if (prop.minimum_exclusive_statement() != null)
                {
                    field.MinType = IdfFieldMinMaxType.Exclusive;
                    field.Minimum = double.Parse(prop.minimum_exclusive_statement().minval.Text.Trim());
                }
                else if (prop.maximum_inclusive_statement() != null)
                {
                    field.MaxType = IdfFieldMinMaxType.Inclusive;
                    field.Maximum = double.Parse(prop.maximum_inclusive_statement().maxval.Text.Trim());
                }
                else if (prop.maximum_exclusive_statement() != null)
                {
                    field.MaxType = IdfFieldMinMaxType.Exclusive;
                    field.Maximum = double.Parse(prop.maximum_exclusive_statement().maxval.Text.Trim());
                }
                else if (prop.DEFAULT_STATEMENT() != null)
                {
                    field.Default = prop.DEFAULT_STATEMENT().GetText().Substring(9).Trim();
                }
            }

            return(field);
        }