毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

温湿度采集系统,单片机;串行通信;数据交换 第19页

更新时间:2008-9-24:  来源:毕业论文

温湿度采集系统C#

explicit operator. Such a UML operation should specify the target type of the conversion as the return type and the source or input type of the conversion as a parameter type.

Figure 2 shows an examples for modeling C# unary, binary, and conversion operators. The unary operator ++ takes a parameter of type Point and returns a Point. The binary operator != takes two parameters each of type Point and returns a bool type. The implicit conversion operator is defined, which converts a Point type to int.

                       Figure 2. C# unary, binary, and conversion operators

 

Part 3.Modeling properties

A C# property is modeled as a UML property (either a UML attribute or an association end) along with a <<CSharp Property>> stereotype. The UML property should have the same name and type as its corresponding C# property. Modifiers for a C# property are available as Boolean stereotype properties. For example, abstract, virtual, extern, and override are available in the <<CSharp Property>> stereotype properties.

In addition to the modifiers, the stereotype has a property called accessors that which can be set to one of the following values: read-only, write-only or read & write. The read-only value should be used whenever the corresponding C# property has only the get accessor method. Similarly, write-only should be used whenever the corresponding C# property has only set accessor. When the C# property has both get and set accessors, the read & write value should be used.

An abstract property is modeled as a UML property with <<CSharp Property>> stereotype with its abstract stereotype property set to true. For this example, you will model a C# property called distance for the Point structure. This property represents the distance of the point from its origin. Because the distance is calculated from the X and Y coordinates, you will model it as a read-only property. To do this, follow these steps (also see Figure 3):

1.      Add a public field named distance to Point, and set its type to int.

2.      Apply the <<CSharp Property>> stereotype to the distance field.

3.      Set the accessors property of the stereotype to read-only .

       Figure 3. C# distance property

Part 4.Modeling indexers

A  C# indexer is modeled as a UML operation with <<CSharp Indexer>> stereotype. A UML operation representing an indexer should always be named as this . The formal parameters of the C# indexer become the parameters of the corresponding UML operation and the type of the indexer becomes the return type of the UML operation. Indexer modifiers like new, virtual, extern etc. are available as stereotype properties. A sealed indexer is represented by selecting the Leaf property of the corresponding UML operation.<<CSharp Indexer>> has a property named accessors which can take values : read-only, write-only and read & write depending on whether the C# indexer has only get accessor or only set accessor or both get and set accessors respectively. This is very much similar to accessors property of <<CSharp Property>>.

For this example (Figure 4), you will model a read-only indexer (thus it has only a get accessor) in the DrawingSurface class. This indexer will have two parameters of type int, and it will return a Point type. Basically, the purpose of this indexer is to return a point corresponding to a given row and column on the drawing surface. Follow these steps:

1.      Add a UML operation named this to the UML DrawingSurface class.

2.      Apply the <<CSharp Indexer>> stereotype to the operation that you added in previous step.

3.      Add two parameters of type int to the operation, and name them row and column.

4.      Set the return type of the operation as Point structure.

Set the property accessors in the stereotype to read-only (see Figure 4).

 << 上一页  [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]  ... 下一页  >> 

温湿度采集系统,单片机;串行通信;数据交换 第19页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。