Scoped Types and Aspects for Real-Time Java Memory Management
- 格式:pdf
- 大小:361.85 KB
- 文档页数:44
国外体检英文全部单词和语句1. “Physical examination” is the basic term for “体检” in English. For example, when I first went abroad, I was so confused and asked the nurse, "Where can I have my physical examination?"2. “Medical check - up” is also a common phrase. It's l ike a routine inspection for your body. Just think of it as a regular maintenance for a car. You know, my friend Jack said to me, "I'm going for my medical check - up tomorrow. I hope everything is okay."3. “Health screening” is another way to say it. It sounds like a screening process for a movie, but instead, it's for your health. My mom always tells me, "Don't forget your health screening this year. It's important!"4. “Body check” is a very simple and straightforward expression. It's as if you are checking every part of your body. I once told my sister, "Let's go for a body check together. It'll make us feel more at ease."5. “General physical assessment” is a more formal term. It's not justa simple check, but a comprehensive assessment. One doctor said to his patient, "We need to do a general physical assessment on you to make sure there are no hidden problems."6. “Pre - employment physical examination” is for those who are about to start a new job. It's like a pass you need to get before entering a new workplace. I heard a colleague say, "I'm so nervous about this pre - employment physical examination. What if I fail?"7. “Annual physical exam” means a physical examination once a year.It's like an annual celebration for your health. My neighbor always says, "I never miss my annual physical exam. It's like a promise to myself."8. “Complete physical examination” implies a thorough check of the whole body. It's similar to a detective investigating every clue in a case.A patient asked the doctor, "Is this complete physical examination going to be very painful?"9. “Routine physical check - up” is something we should do regularly. It's like brushing your teeth every day. I told my cousin, "You should have a routine physical check - up. It's a good habit."10. “Comprehensive health check” is a broad - scoped check for your health. It's as comprehensive as a big report covering all aspects. My aunt said, "I'm thinking of having a comprehensive health check. I'm not getting any younger."11. “Full - body scan” refers to scanning the whole body, usually in some advanced medical examinations. It's like taking a 360 - degree photo of your body. My uncle joked, "I'm afraid they'll find out all my secrets during this full - body scan."12. “Pre - travel physical ex amination” is necessary for those who are about to travel abroad. It's like getting your passport ready for the journey. A traveler said, "I can't wait to start my trip, but first, I need to do this pre - travel physical examination."13. “Post - illness p hysical examination” is for checking your body after getting ill. It's like a follow - up to see if your body has fully recovered. A patient's mother asked the doctor, "When should we do the post - illness physical examination?"14. “Specialized physical examination” is for specific parts or conditions. It's like a special mission for a particular target. I asked my doctor, "Do I need a specialized physical examination for my back pain?"15. “Occupational physical examination” is related to your job requirements. It's like a customized check according to your work environment. A factory worker said, "This occupational physical examination is really important for our safety at work."16. “Well - person examination” focuses on healthy people to keep them in good shape. It's like a booster for your good health. My yoga teacher said, "Even though I'm healthy, I still go for a well - person examination regularly."17. “Baseline physical examination” is the initial check to establisha baseline for your health. It's like drawing a starting line for a race. I told my new acquaintance, "Before starting any fitness plan, it's better to have a baseline physical examination."18. “Geriatric physical examination” is for the elderly. It's like a special care package for their bodies. An old man said, "I'm glad I can have this geriatric physical examination. It gives me peace of mind."19. “Pediatric physical examination” is for children. It's like a gentle exploration of a little flower's growth. A mother cooed to her baby, "We're going for a pediatric physical examination soon, sweetie."20. “Pre - surgery physical examination” is crucial before having an operation. It's like a final inspection before a big construction project.A patient worriedly asked, "What if there are problems in this pre - surgery physical examination?"。
分辨虚拟和现实英语作文Title: Distinguishing Between the Virtual and the Real。
In today's fast-paced world, the line between thevirtual and the real has become increasingly blurred. With the rise of technology and the prevalence of virtual experiences, it can sometimes be challenging todifferentiate between what is virtual and what is real. In this essay, we will explore the distinctions between thetwo realms and examine how they shape our perceptions and experiences.Firstly, let us define what we mean by the virtual and the real. The virtual refers to anything that exists or occurs in a digital or simulated environment, often created by technology. This includes virtual reality simulations, online interactions, and digital representations ofphysical objects or experiences. On the other hand, thereal encompasses the tangible, physical world that we experience through our senses. It includes our interactionswith other people, our surroundings, and the natural environment.One of the key differences between the virtual and the real lies in the nature of experience. In the virtual realm, experiences are mediated through technology and often lack the sensory richness of real-world experiences. For example, while a virtual reality simulation may provide a visually immersive experience, it cannot replicate the tactile sensations or emotional depth of real-life interactions. In contrast, real-world experiences are characterized by their immediacy and authenticity, engaging all of our senses and emotions in a way that virtual experiences often cannot match.Another important distinction is the level of control and agency we have in each realm. In the virtual world, we often have a greater degree of control over our environment and experiences. We can manipulate digital objects, create new identities, and explore virtual landscapes withrelative freedom. However, this control is ultimatelylimited by the constraints of the digital environment andthe algorithms that govern it. In the real world, our agency is constrained by physical laws, social norms, and the actions of others. While we may have more freedom toact in the real world, we are also subject to itslimitations and uncertainties.Furthermore, the consequences of our actions differ in each realm. In the virtual world, the impact of our actions is often limited to the digital domain, with few real-world consequences. For example, we can engage in virtual combatin a video game without causing harm to ourselves or others. In contrast, actions taken in the real world can have far-reaching effects on ourselves and others, influencing relationships, communities, and the environment. The stakes are higher in the real world, requiring us to consider the ethical and moral implications of our choices more carefully.Despite these differences, it is important to recognize that the virtual and the real are not mutually exclusive categories. In fact, they often intersect and influenceeach other in complex ways. For example, our interactionsin virtual spaces can shape our perceptions and behaviors in the real world, and vice versa. The rise of virtual communication platforms has blurred the boundaries between online and offline social interactions, leading to new forms of identity expression and social connection.In conclusion, while the virtual and the real may seem distinct at first glance, they are intricately intertwined in our modern world. By understanding the differences between them, we can navigate the complexities of digital technology more effectively and make informed choices about how we engage with both realms. Ultimately, it is ourability to critically reflect on our experiences and cultivate a balanced relationship between the virtual and the real that will enable us to thrive in an increasingly digital age.。
MAC ISO Term1-“Intersection Types In Practice”David P.CunninghamSupervisor:Steffen van BakelFebruary14,2005AbstractIntersection type systems are introduced as a solution to limitations of the Curry Type Sys-tem for the lambda calculus.It is summarised how Forsythe uses an intersection type system effectively,for the purposes of typing combinations of expressive language features that are used to represent conventional language features.We study some intersection type systems with type variables,which are generalisations of the Curry Type System,explain how they are expressive, but how undecidability renders them unsuitable for practical use in their unrestricted form.Keywords:•Forsythe•Intersection Types•Programming Language•Type Systems/DisciplinesContents1Introduction to Intersection Types21.1Some Typical Features and Motivations of Type Systems (2)1.2The Curry Type System for the Lambda Calculus (3)1.3Limitations of Curry Type System (5)1.4Intersection Types (8)2Forsythe-A Case Study102.1Introduction (10)2.2Primitive Data Types (11)2.3Intersections (11)2.4Arithmetic (12)2.5Imperative Commands (12)2.6Arrows (13)2.7Examples of Variables and Assignment (13)2.8Decidable Type Inference Algorithm (15)2.9Objects (15)2.10Arrays (18)2.11Conclusion (19)3Intersection Type Systems with Type Variables213.1Essential Intersection Type System (23)3.2Terms Typable With This System (24)3.3Principal Typings (24)3.4Operations On Typings (25)3.4.1Substitution (25)3.4.2Lifting (26)3.4.3Expansion (26)3.4.4Comments (29)3.5Unification (29)3.6Undecidability (32)3.7Conclusion (33)1Chapter1Introduction to Intersection TypesTraditional and well understood type systems like the Curry Type System,or the ML Type System,have limitations in the scope of correct programs that they can type.Since our interest is motivated by shortcomings in other systems,it is of interest to quickly review both the purpose of type systems in general,and the limitations of“conventional”type systems.Then it will be shown how extending the Curry Type System with intersection types provides a type system that does not exhibit these limitations.1.1Some Typical Features and Motivations of Type Systems The motivation for type systems stems from the need for static reasoning about programs,par-ticularly to determine correctness,but also to allow certain optimisations in the compilation process.Some syntactically valid programs can be thought of as“semantically invalid”-for example if their meaning is not specified by the language definition.A suitable type system can be used to detect semantically invalid programs automatically.Type systems are necessarily designed to support the syntax and uphold the defined semantics of a specific language.Despite this,we can make a few general and typical observations about them.Types can be thought of in terms of the set of constant values that agree with them.Typically the types of literals and such are defined in keeping with the implementation’s representation of these values.To type an expression,a syntax which may evaluate during the course of program execution,it is usual that the expression agrees with a type if all the possible evaluations of the expression agree with that type,not making any unwarranted assumptions about the values of any variable data that might be referenced by the expression.This is useful because it is likely that a language allows an expression to be used in place of a literal,specifying that the expression is evaluated to produce a concrete value,at runtime, when such a value is required by the evaluation of its context.Naturally then,we will allow any expression to form the sub-syntax in this context,if we can guarantee that the expression will evaluate to an allowed value,so thus we require the expression to agree with a certain type.This places a constraint on what expressions are allowed as sub-syntax.This property of a type system,where an expression’s hypothetical evaluation result will always agree with the expression’s type,is called the“subject reduction property”and is highly desirable in a type2system for any language with the feature described.Traditionally,the type system has not evaluated the expression(in the conventional sense)to determine the set of possible results,but has inferred some conservative estimate of agreement using the syntax of the expression,and a predefined set of syntax directed rules.The set of rules is compatible with the semantics of the language.This results in a general assertion about the character of the expression’s behaviour,and its invariance to runtime state gives us the universal certainty we desire:“For all possible inputs and executions,we know this about the run-time behaviour:...”Because the rules in a type system are simple and syntax directed,the type inference(the de-termining of a type that code agrees with)is efficient and decidable,and can thus be performed autonomously by a compiler.Inventing a type system is a creative process,and there might be many type systems that are consistent for a language.Some of them might not be able to type some important programs,and also some might not have the useful properties we require.In particular,it is a challenge to define a type system with enough scope and useful features with-out losing decidability,which is essential if the type inference mechanism is to be autonomous within a compiler.There is little more that can be said about type systems in general,so we shall visit the Curry Type System for the lambda calculus,as it the foundation for the Intersection Type System. 1.2The Curry Type System for the Lambda CalculusHere we demonstrate the notation used in this document,and introduce the type system whose limitations will be overcome when we extend it with intersection types.The system is simple,well-known and well-understood,and despite being defined for the lambda calculus,can be extended to form the type systems that are used in practical program-ming languages today.A lot of the information in this section is summarised from the course “Type Systems for Programming Languages”,and its lecture notes,[10].Note that the original motivations given for type systems(detecting erroneous programs and efficiency)do not apply here,since there are no“stuck”lambda terms(assuming infinite evalua-tion is valid),and thus a type system should type all lambda terms.Also,efficiency is irrelevant when dealing with a mathematical formalisation.Nevertheless,it is interesting to study type systems for the lambda calculus because of its simple definition,and the fact that many features of conventional programming languages have analogies within the lambda calculus.This gives us confidence that our results here will scale to more complex languages.Definition1.1.Syntax of the lambda calculus:E::=x|(E1E2)|(λx.E)The categories are named‘term variable’‘application’and‘abstraction’respectively.To im-prove readability of the concrete syntax,the following conventions are used:Application binds to the left and binds tighter than abstraction,consecutive abstractions are merged together,and redundant brackets are removed.Definition1.2.Semantics of the lambda calculus:(λx.M)N−→βM[N/x]This definition of reduction models computation and is Turing-complete.M[N/x]stands for the syntax of M but for each term variable x in M,N is substituted in its place.The syntax(λx.M)N is called a redex,and where multiple redexes exist as sub-terms within an expression,any can be reduced to form the reduction of that expression.A detailed account of reduction in the lambda calculus is beyond the scope of this document,but information can be found in[10].Definition1.3.The set of types in the Curry system is defined to be:τ::=ϕ|τ→σWhereσandτrange over types,andϕranges over type variables.Note that an arbitrary type is therefore a tree structure,the nodes being arrows and the leaves being variables.In extensions of the system,the set of types is more complex,but for the simple lambda calculus,just variables and arrows are used.Values(closed normalised terms with predefined meaning),for example the church numerals,are represented as abstractions in the lambda calculus,and thus their types are expressed as arrows.Definition1.4.Curry type assignment natural deduction rules:(Ax)B Cλx.M:σ→τB C M1:σ→τB C M2:σ(→E)Conditions to the right hand side of the rule are additional conditions that must be true before the rule can be applied.It is possible to convert a valid typing for a given lambda term,to a new,different,but still valid typing,by replacing a given type variable with a given type,consistently throughout the types in the typing.This is called substitution.Substitution is called an operation on typings, it can be thought of as making a consistent change to the derivation tree for thefirst typing,in order to produce a different derivation that is also valid,and thus a new,valid,typing for the original lambda term.For every term,there exists a typing from which all other valid typings can be derived with some substitution operations,this typing is called the principal typing.The typings that are the result of operations on the principal typing are called instances of the principal typing.In addition to this,it is possible to derive the principal typing itself with the rules of the Curry Type System,therefore the system has the“principal typing property”.Some general remarks on principal typings and this property can be found in[11].Since we are concerned with the practical issues of type systems,it is interesting to note here the practical benefits of this property.[2]describes how they are useful for efficient separate compilation and recompilation of a module(if the principal typing is known,the type for a term need never be re-inferred),and accurate error messages(since we can detect errors in the course of unifying two principal typings rather than through attempting to type-check one sub-term against another erroneous sub-term that has an erroneous type).There exists a principal typing algorithm for the Curry Type System,which can generate the principal typing for a given term.Its definition is not covered here but of interest is its auxiliary algorithm unify.This algorithm takes two types and determines the sequence of operations required to convert both of them into the same(new)type,an instance of both of the initial types.This is essential for solving the constraints placed upon sub-typings on both sides of an application,when building the principal typing for that application.Unification will be the subject of much more detailed discussion in section3.5.Some Curry types cannot be instantiated into the same thing through substitution operations,and unification returns an exception in these cases.When this happens,the principal typing algorithm declares that there is no typing for the term.1.3Limitations of Curry Type SystemA large class of lambda terms are not typeable.Consider self-application xx,here the type of x has to be both a function,and also the argument of that function,which is not possible within our inductively-defined type syntax.The principal typing algorithm will throw an exception with this term as described above.Thefix combinator cannot,therefore,be typed,and this is a very useful term for program-ming,since it allows us to write programs that do not have an upper bound on the time they take to execute,e.g.the algorithm to calculate a factorial.Also,some strongly normalisable terms,and even terms that are normal forms cannot be typed.The lack offix would make the system impractical for programming languages,but as it turns out it is quite easy to sidestepthis issue,for the majority of practical requirements,by extending the syntax and semantics of the language to include an operator that behaves as thefix combinator does,but has a special typing rule,as is done with the language ML.Note that ML’s solution while being decidable, cannot type all programs,specifically not those using polymorphic recursion.This technique is sometimes desirable,as shown in[1].There is a trade offin this area between decidability and the scope of the type system.A useful property that the Curry Type System does have,is the subject reduction property,as discussed earlier,this can be seen by showing thatB (λx.M)N:τ=⇒B M[N/x]:τ,but the converse(subject expansion)does not hold.This is because terms can‘forget’their sub-terms as they reduce,e.g.M in the term(λx.y)M is forgotten,but these sub-terms are not forgotten by the type inference algorithm.The beta-forgotten terms might force certain basis types to be instances of what they really need to be,which will affect the resulting typing.Also the beta-forgotten sub-terms might not be typeable at all in the system,so beta-expansions of typeable terms may not be typeable.A useful technique in software engineering is the use of modules to factor out duplicated code,in a program,to ease the task of maintanance.To correctly type this circumstance,we need to ensure that the typing required by the context of each reference to the factored-out code is a valid typing for the factored-out code itself.This can be done by by successfully typing these references with instances of the principal typing of the factored-out code.This,however presents a problem with the Curry Type System in the lambda calculus.Factoring out code in the lambda calculus can be represented by coding a redex into the program.Example1.5.A program in the lambda calculus,typed with the Curry Type System: {} (λx.x)(λx.x):ϕ→ϕWe can factor the(λx.x)out to produce a redex,this can be seen as referencing the definition of the identity abstraction(λx.x)multiple times with the term variable I,but the resulting program cannot be typed,we have self-application:Example1.6.The same program,defined in a modular way,untypeable with the Curry Type System:{} (λI.II)(λx.x):?The problem is that we need to express that each of the two“I”term variables has a different type,according to its context,and that each I type is a valid type for the factored out code with respect to the same basis.This cannot be expressed without extending the type system,since the two“I”variables are forced to have the same type in the basis of II.There is no“subsumption”when typing term variables that reference polymorphic code.When factored-out code can be referenced in a variety of typing environments,it is called polymorphic.Type polymorphism allows us to type such code in a manner that allows the typing of references to the factored-out code despite them being in different type environments.Subsumption is the act of typing a term with one type,on the premise that it already has the type of another different type,this can be formalised with a rule like B M:τ=⇒B M:σ.This means that even though we are given that M has typeτ,we can use it in a context that requires typeσ,with the same basis.This act of subsumption is really the key to bridging the typing“abstraction gap”that arises when code is factored out of a program.If we only need polymorphism for our term variables,M can be x,in the above definition,and thus squashed into the(Ax)rule.Note how the basis remains the same during subsumption,this has to be true since the typing of all the instances is bound by the basis of their contexts.Of course,the basis contains the link to the more general type of the polymorphic code being referenced,and cannot be disturbed.If the subsumption is to be the operation of substitution,as seems natural in the Curry System,i.e. ifσ=S(τ),then clearly the variable being substituted must not exist in the basis,i.e.B=S(B). This will never be true with the Curry System since ultimately the type for the polymorphic term variable must be extracted from this very same basis,so the type variable in the substitution will always exist in there.Thus the Curry Type System does not admit a simple subsumption rule that uses substitution.In[10],a type system is presented for combinator systems where the principal typings for each combinator are stored in an“environment”.When the combinators come to be used,the equivalent(Ax)rule for the combinator terms allows the type in the environment to be instanti-ated to whatever is required by the context of the combinator term.This is a form of polymor-phism but does not extend to term variables in general,only combinator terms.It does,however, avoid the problem of damaging the basis during instantiation by storing the principal typings (whose type variables are disjoint to those present in the basis)for the combinators outside of the basis.In ML,there is a let syntax construct which is semantically equivalent to the redex mech-anism of factoring out code that is discussed above.It is typed in a different manner to an application of an abstraction however,since itfirst asserts a typing for the factored-out code,say B,τ .It then“marks”each“unconstrained”type variable inτwith a quantified symbol before embedding this as a type for the polymorphic term variable in the basis for the typing of the rest of the code.(An unconstrained type variable inτis one that does not occur anywhere in B).When different term variables need to be typed with instantiations of this“marked”principal typing,a special rule is used to convert the“marked”type variables into whatever is required, using an extended notion of substitution designed to ignore the marked variables in the basis. This prevents the operation affecting the basis so that it can used soundly for subsumption.The ML type system is decidable,but does not type some terms,particularly uses of polymorphic recursion,and of course using a new syntax to implement the factoring out of code does not solve the problem thatλx.xx is not ing generalisations of the ML type system that type more terms has not lead to much success,since these type systems are often complex and undecidable,or without principal typings.The main limitations of the Curry Type System as it stands as a type system for practical programming languages,can be summarised as:•Some terms cannot be typed(e.g.self-application)•Fix(an essential term in practical programming)cannot be typed•No support for polymorphismThese criticisms are linked.The second is due to thefirst,so by solving thefirst we also solve the second.If we had some support for polymorphism for general term variables,we could actually solve thefirst.Both of the solutions to polymorphism referenced above,sidestep the issue of subsumption by substitution in the Curry Type System,byfirst calculating the principal typing and storing it separately from the other types in the basis.We shall now see how the Intersection Type System employs a similar,but somewhat opposite approach to supporting polymorphism:It collects together the requirements of the term variables in the basis,and then ensures that the polymorphic code can be typed to each of the collected types.1.4Intersection TypesThere are many intersection type systems in existence,they are each slightly different but they share so much in common that it makes sense to discuss them in a general way in this introduc-tion,before examining a few in detail later in this document.Recall that we are motivated by the idea that two identical term variables in a term must both agree with different,but non-unifiable types.However,we are constrained by the fact that in the basis,the term variable can only be given a single type.A type system can overcome this by having a type constructor that groups a set of types into a single type.Thus each term variable can be typed with a different type,and the basis can presume both.The subsumption operation is then simply to reduce this set of types to the subset that is required by each context in the term.Another way of looking at this is that the basis contains a list of types,any of which can be required of a term.The type syntax for representing several types as a single type is usually a binary infix con-junction,or intersection operator:&,∧,or∩.This is intuitive since we need the operator to be commutative and associative,such that the order of types,or positioning of parentheses,in τ1∩τ2∩τ3is not important.Note that it is also usually possible for a term to be assigned the empty set of types,this is sometimes denotedω,and called the“nullary intersection”.Previously this was treated as a type constant,possibly because its appearance is removed from the usual notation for intersections.Perhaps it is more intuitive to represent intersection types as aflat set, e.g. τ1,τ2,τ3 thus the nullary intersection can be stated as ,and ordinary curry types as τ (abbreviated to justτ),but in this document I will use the conventional binary notation andω.Assigning a term the nullary intersection is not particularly useful,since it allows no deduc-tion about what types the term’s value or evaluation will definitely agree with,and thus the term cannot be used in any context that requires a specific type.Intuitively,all the typeωprovides us with,is the information that the term could potentially evaluate to anything,which we already knew.It is useful though,for typing terms that we do not care about,e.g.terms that are forgotten during reduction.This is the key to the property of beta expansion,held by intersection type systems.The intuition behind the naming of intersection types is that if a value agrees withτandσ, then it agrees withτ,and it agrees withσ,so it agrees with a hypothetical type that is representedCHAPTER1.INTRODUCTION TO INTERSECTION TYPES9 by an intersection of the sets of agreeing values for both types.Understanding the members of such hypothetical agreement sets for data types is trivial,but trying to understand how the value of a function might be represented is not.Ifind it best to think about intersection types directly in terms of the rules that define them,without using any intuitive notion of sets and set intersection.To formalise the claims about intersection types,here is stated the type rules used to intro-duce and eliminate the intersection type constructor in the derivations of many intersection type systems.Definition1.7.Typical rules involving intersections:B M:τB M:σ(∩I)B M:τThese are intuitive from the English definition given above-a term can be typed to an intersection of two types if it can be typed to both types,and subsumption is the removal of a type from the intersection.Example1.8.To end this chapter,it is shown how the example in the previous section can be typed with intersection types:(τstands in place of“(ϕ→ϕ)∩((ϕ→ϕ)→(ϕ→ϕ)) .)(Ax)I:τ I:(ϕ→ϕ)→(ϕ→ϕ)(Ax)I:τ I:ϕ→ϕ(→E)λI.II:τ→(ϕ→ϕ)(Ax)λx.x:ϕ→ϕ(Ax)λx.x:(ϕ→ϕ)→(ϕ→ϕ) (∩I)(λI.II)(λx.x):ϕ→ϕNote how the deduction collects together both typings for I,and then deduces them both inde-pendently for the typing ofλx.x.This is in contrast to the ML system which wouldfirst type λx.x and then generate a type that can subsume any valid typing for I.An interesting character of intersection types,that complements universal types(from ML)is that we can type the use-cases of the polymorphic code before the polymorphic code itself,which may prove useful in modular programming languages.Now we leave the lambda calculus for a while to study an Algol-like language that uses intersection types extensively.Chapter2Forsythe-A Case StudyForsythe is described in detail in[4]and[5],we focus here upon its type system,but the referred papers contain information about the language as a whole.2.1IntroductionThe design goal of Forsythe is to be as“artistically”expressive as a practical programming language,indeed more expressive than most programming languages to date,while retaining a simple type system and well formed operational semantics(like the lambda calculus).By “artistically”expressive,it is meant that Forsythe should allow typical programming code to be elegantly expressed,in a concise,readable,and maintainable fashion.The language’s design contains a few new and abstract concepts,that suffice to represent many conventional ideas,thus these ideas need not be explicitly built in to the language as rules in the type system and operational semantics.For instance;assignment,arrays and objects can all be represented in terms of more primitive forms,as shall be seen.Typically syntax sugaring is used to translate the conventional form of code into the new representations,in order to keep the programs readable.Part of the fuel for the generalisation is Forsythe’s type system,which makes creative use of intersection types to safely describe how data can be constructed from many different things combined together.The type system of Forsythe is not an extension of the Curry Type System,since although it has→,it does not have type variables.Thus there are no principal typings in Forsythe, and no notion of unification.Instead of type variables,there are6primitive type constants, and a primitive subsumption relation defined over them.Note that without type variables and substitution,we have no way of writing truly re-usable‘template’code,since the type of such code would have to be the intersection of all possible types,including types yet to be defined by the programmer.In this document,τ,σandρare metavariables that range over the various possible Forsythe types.102.2Primitive Data TypesThe primitive data types(for terms that are,or evaluate to,a value)are real,int,bool and char.Note that the type for variables,in the sense of objects that can store data,is not any of these types,and will be defined later.These types are simply the types of variable evaluations, arithmetic expressions,and literals.In short,these are the objects that represent data itself, rather than data storage.Forsythe defines the reflexive,transitive subsumption relation(≤)which relates two types if agreement with the type of the left-hand-side implies agreement with the type on the right-hand-side.Initially the subsumption relation is specified here over the data types, but as more features of the Forsythe type system are discussed,its definition will be extended. Definition2.1.Subsumption for primitive data types:int≤realreal≤valuebool≤valuechar≤valueThere is a subsumption rule that allows types to be relaxed in a derivation,according to the subsumption relation.Definition2.2.Subsumption derivation rule:B M:τ(≤)B M:τ∩σB M:τ∩σ(∩E)B M:nsNote that ns denotes the nullary intersection,or“nonsense”.The subsumption relation is ex-tended over types involving the(∩)type constructor.Definition2.4.Subsumption for intersections,∀σ,σ ,τ,τ ∈T ypes:σ≤nsσ≤σ∩σσ∩σ ≤σσ∩σ ≤σ(σ ≤σ)∧(τ ≤τ)=⇒(σ ∩τ )≤(σ∩τ)Note that now the subsumption relation has lost its property of antisymmetry since,for example int≤(int∩int)≤int,so the relation is now just a pre-order.If,however we consider types modulo equivalence,where types are equivalent if they subsume each other,we squash the cycles of the relation into single nodes,and we get a partial order again.Type equivalence,as defined here,is given the operator(∼).This is a byproduct of redundancy in the syntax used to express intersection types,rather than a property of the ideas the type system represents.2.4ArithmeticForsythe has syntax,semantics,and type rules for the usual binary integer/real arithmetic and for boolean logic.Overloaded syntax(such as(+)for int and real)is given a type rule for each of its meanings,thus it can be typed to the intersection of all its typings using(∩I).There is also syntax and typing rules for literals such as true,false,3,’a’,etc.The precise rules are omitted here since they are not very interesting.2.5Imperative CommandsIn Forsythe,the type comm is a type for syntax that is,or evaluates to a command.A command is something which causes the state to m is therefore not a data type like int,because it expresses the character of code that changes state,rather than code that returns a value.Despite looking a lot like the lambda calculus atfirst glance,Forsythe is an imperative language with a program state that can be altered by commands.Variables can be written to,and then later on can be read to determine what was last written to pl is a special subset of commands that never return control,this could be used for exceptions,early returns,and exiting a program.Commands can be sequentially composed with the“;”syntax,and looped with a while con-struct,as in conventional imperative languages.Both of these controlflow constructs are typed with comm or compl as appropriate to their sub-terms.As will be shown,it is the prerogative of abstraction to define new variables on the implicit stack,and the operation of assignment is actu-ally represented in terms of an application,so there is no need to type either of these imperative features to comm.Definition2.5.Subsumption for commands and completions:compl≤comm。
试验实时综合态势显示软件的设计与实现*常兴华(中国人民解放军92941部队45分队,辽宁葫芦岛125000)摘要:在靶场指挥显示系统中,软件系统的各项具体功能均通过运行在通用试验体系结构(GPTA)软件平台上的各种功能组件软件实现。
本文针对靶场试验中试验实时综合态势显示需求,为完成试验实时综合态势显示各类具体功能实现,以Visual C++2010为开发环境,经过需求分析把不同的功能,诸如地理信息管理、航迹显示、量测与辅助分析等分配给不同的逻辑包进行设计,各逻辑包再合理划分成多个子单元进行详细设计与实现。
该软件操作简捷、显示样式丰富,提升了靶场试验实时综合态势显示能力。
关键词:通用试验体系结构(GPTA);航时计算;军事地理信息系统(MGIS);落点预报中图分类号:TP311.52文献标志码:A文章编号:1003-7241(2019)06-0029-05Design and Implementation of Test Real-time Comprehensive Situational Display SoftwareCHANG Xing-hua(No.45unit of 92941troop of Chinese People's Liberation Army,Huludao 125000China )Abstract:In the range command display system,the specific software system functions are through the operation in the Hit-GPTAsoftware platform to realize all kinds of functional softwares.In this paper,in view of the real time comprehensive situa-tion of the test in the range test,this paper shows the realization of various specific functions in order to complete the re-al-time comprehensive situation of the test.The Visual C++2010is the development environment,and the different func-tions,such as geographic information management,track display,measurement and auxiliary analysis,are allocated to dif-ferent logic after the requirement analysis.The package is designed,and each logical package is divided into several sub units and designed and implemented in detail.The software is simple in operation and rich in display style,which enhanc-es the ability of real-time comprehensive situational display in range test.Key words :General Purpose Test Architecture(GPTA);endurance calculate;Military Geographic Information System(MGIS);land-ing point prediction*基金项目:国家自然科学基金(编号61501135)收稿日期:2018-05-151引言靶场指挥态势显示系统是采用基于公共体系结构技术的分布式试验系统[1],利用局域和广域网络将分布在不同节点的试验设备联结起来,共同完成武器装备试验、仿真、无边界靶场试验等先进仿真训练和实时试验任务[2],由于各类实时测控任务类型多、数量大、显示样式多样化要求高,急需研制一套操作简捷、配置灵活的试验实时综合态势显示软件来支持靶场各型任务的试验显示方案辅助设计工作,以提高指挥显示系统综合保障能力。
说半体现人的鲜活艺术思维和审美体验英语作文全文共3篇示例,供读者参考篇1The Vibrant Tapestry: Artistic Expression as a Mirror of Human VitalityAs a student, I've come to realize that art, in all its multifaceted glory, is an intrinsic reflection of the human experience – a tapestry woven with the threads of our emotions, thoughts, and perceptions. It is a universal language that transcends borders, cultures, and epochs, allowing us to communicate the ineffable complexities of our existence. Through the lens of artistic expression, we catch glimpses of the vibrant, ever-evolving essence of humanity, encapsulating the depth of our creativity, our struggles, and our triumphs.The canvas of life is a perpetual work-in-progress, and artists, with their keen observations and innovative perspectives, serve as chroniclers of this journey. Their creations are not mere representations but living, breathing entities that invite us to immerse ourselves in their narratives, evoking a profound sense of resonance within our souls. Whether it's the bold strokes of apainter's brush, the melodic cadence of a composer's symphony, or the poetic verses etched by a writer's pen, each artistic endeavor reflects the indomitable spirit of human ingenuity.One of the most captivating aspects of art is its ability to capture the ephemeral moments that often elude our conscious awareness. A skilled artist possesses the remarkable talent of freezing time, preserving the fleeting beauty of a sunset, the whimsical dance of light and shadow, or the raw intensity of human emotion. In doing so, they invite us to pause and savor the richness of life, encouraging us to cultivate a heightened sense of awareness and appreciation for the world around us.Furthermore, artistic expression serves as a powerful catalyst for self-discovery and introspection. As we engage with a work of art, we are prompted to delve into the depths of our own psyche, confronting our fears, desires, and the complexities that shape our individual identities. Art becomes a mirror, reflecting back to us the multifaceted layers of our existence, compelling us to confront our vulnerabilities and embrace our authentic selves.The realm of artistic expression is not confined to the realms of traditional mediums; it permeates every aspect of our lives, infusing our daily experiences with a sense of beauty and wonder. From the architectural marvels that adorn our cities to theculinary delights that tantalize our taste buds, art manifests itself in myriad forms, enriching our lives and elevating the ordinary into the extraordinary.Moreover, art serves as a potent vehicle for social commentary and cultural preservation. Through their creations, artists challenge societal norms, shed light on injustices, and advocate for change. They give voice to the marginalized, amplifying the narratives that might otherwise remain unheard. By preserving traditions, customs, and stories, artists ensure that the rich tapestry of our collective heritage is woven into the fabric of the present, serving as a bridge between the past and the future.In our increasingly digitized world, where the virtual realm often overshadows the tangible, artistic expression stands as a powerful reminder of the enduring essence of human creativity. It grounds us in the present moment, inviting us to engage with the tactile, the sensory, and the raw emotions that define our existence. Whether it's the tactile sensation of sculpting clay or the rhythmic movements of a dancer's body, art awakens our senses, reminding us of the profound connection between our physical beings and the creative process.Ultimately, artistic expression is a testament to the indomitable spirit of humanity – our ability to find beauty amidst chaos, to create order from disorder, and to weave narratives that transcend the boundaries of time and space. It is a celebration of our capacity for wonder, our insatiable curiosity, and our relentless pursuit of self-expression. As students, it is our responsibility to embrace and nurture this vital aspect of our existence, for it is through art that we not only interpret the world around us but also shape the narratives that will define our collective future.篇2The Visceral Power of Art: A Window into the Living Human ExperienceAs a student, I've come to realize that art is so much more than just pretty pictures or melodies that are nice to look at or listen to. Art, in all its myriad forms, is a pulsing, breathing manifestation of the depth of human consciousness and the persisting drive to make sense of our experiences. Whether it's a thought-provoking novel, a haunting musical composition, or a visually arresting painting, great works of art provide us with a tangible expression of the intangible - the ideas, emotions,questions, and perspectives that collectively make up our lived reality.At its core, art is an inherently human endeavor. It emerges from the yearning to capture the ephemeral and distill the essence of existence into something palpable. Each artistic creation, regardless of the medium, bears the unmistakable fingerprint of its creator, embodying their unique perspective, emotions, and wrestlings with the age-old questions that have perplexed humanity since the dawn of sentient thought.Consider the great literary works that have stood the test of time. From the poetic musings of the ancient Greek philosophers to the richly layered narratives of modern novelists, these texts offer a glimpse into the innermost depths of the human psyche, illuminating the timeless themes of love, loss, mortality, and the relentless quest for meaning that define our shared experience. With each turn of the page, we find ourselves confronted with reflections of our own struggles, triumphs, and uncertainties, intricately woven into the tapestry of words and characters.The visual arts, too, possess an unparalleled power to evoke visceral responses and spark introspection. A single brushstroke, a carefully curated composition, or a masterful use of light and shadow can convey a torrent of emotions and ideas that wordsalone cannot adequately capture. From the hauntingself-portraits of Frida Kahlo, which lay bare the artist's pain and resilience, to the vibrant, larger-than-life canvases of Jackson Pollock, which seem to pulsate with raw, untamed energy, visual art invites us to confront the depths of the human condition in all its complexity and nuance.Music, perhaps more than any other art form, possesses the uncanny ability to bypass the rational mind and speak directly to the soul. The soaring melodies of a symphony, the raw emotion of a blues ballad, or the relentless pulse of a hard-hitting drumline can transport us to realms of feeling and experience that defy verbal articulation. Through music, we are offered a glimpse into the vast spectrum of human emotions – joy, sorrow, passion, longing – and are reminded of the profound interconnectedness that binds us all.Ultimately, what distinguishes truly great art is its capacity to challenge our preconceptions, push the boundaries of our understanding, and compel us to engage with the world and ourselves in new and profound ways. Art serves as a mirror, reflecting back to us the intricacies of the human experience in all its messy, beautiful, and multifaceted glory. It forces us to confront uncomfortable truths, wrestle with existential questions,and acknowledge the inherent contradictions and complexities that give depth and richness to our lived experiences.In this sense, art is not merely a static representation or a passive form of entertainment; it is a living, breathing entity that demands active engagement and participation from its audience. Each encounter with a truly great work of art is a dialogue, a two-way exchange in which the creator's vision is filtered through the lens of our own unique perspectives, experiences, and biases. This dialogic nature of art is what lends it its enduring relevance and power, ensuring that the same piece can resonate differently with each individual viewer or listener, and can reveal new layers of meaning and significance with each revisiting.As a student, my journey through the world of art has been one of constant discovery, self-reflection, and growth. Through the study of literature, music, painting, and other artistic disciplines, I have gained a deeper appreciation for the complexities of the human experience and the myriad ways in which artists have sought to capture and communicate the ineffable. Each great work of art I encounter serves as a reminder of the boundless potential of human creativity and the enduring power of artistic expression to illuminate the depths of our shared existence.In a world that often seems consumed by the pursuit of the practical and the tangible, art stands as a defiant beacon, reminding us of the essential role that beauty, emotion, and the transcendent play in shaping our lived experiences. It challenges us to embrace ambiguity, to revel in the ephemeral, and to find meaning in the spaces between the lines, the notes, and the brushstrokes.As I continue on my academic and personal journey, I carry with me the indelible imprint of the great works of art that have enriched my understanding and sparked my imagination. These creations serve as a constant reminder of the vibrancy and depth of human thought and emotion, and of the enduring power of art to illuminate the very essence of what it means to be alive.篇3The Boundless Realm of Art: Portraying the Vivid Artistic Mind and Aesthetic ExperienceArt, in its myriad forms, has long been a gateway to exploring the depths of human expression, emotion, and perception. As a student captivated by the power of artistic creation, I have come to realize that art is not merely a static canvas or a lifeless sculpture; it is a dynamic, ever-evolvingmanifestation of the human spirit. Through art, we glimpse into the vivid minds of artists, each stroke, each note, each movement a testament to their unique perspectives and interpretations of the world around us.The artistic mind is a kaleidoscope of creativity, where thoughts and emotions intertwine, giving birth to masterpieces that transcend the boundaries of the ordinary. It is a realm where imagination knows no limits, where the conventional is challenged, and where the extraordinary emerges from the depths of the artist's soul. As a student of art, I have witnessed firsthand the transformative power of this creative force, how it can take a simple canvas and turn it into a window to a parallel universe, where colors dance and shapes come alive.One of the most captivating aspects of art is its ability to evoke profound emotional responses within the viewer. A single painting can transport us to a different time and place, evoking a nostalgia for memories long forgotten or igniting a yearning for experiences yet to be had. The brushstrokes of a masterpiece can elicit a visceral reaction, a torrent of emotions that words alone cannot adequately convey. It is in these moments that we become acutely aware of the power of art to transcend languagebarriers and cultural divides, forging a universal connection that resonates deep within our souls.The artistic mind is not confined to the realm of visual arts alone; it extends its reach into the realms of music, dance, and literature, each discipline offering its own unique perspective on the human experience. A symphony has the ability to transport us through a vast emotional landscape, from the soaring heights of joy to the depths of sorrow, all within the span of a few notes.A choreographed dance can capture the essence of passion, love, and struggle, conveying narratives that words alone cannot fully encapsulate.As a student of art, I have come to appreciate the profound impact that artistic expression can have on our understanding of the world and our place within it. Art has the power to challenge our preconceptions, to shed light on societal issues, and to ignite discussions that might otherwise remain unexplored. Through the lens of an artist, we are invited to see the world through a different set of eyes, to question the status quo, and to embrace the complexity and nuances that often go unnoticed in our daily lives.The aesthetic experience, that moment when we are truly captivated by a work of art, is a profound and transformative one.It is a moment when time seems to stand still, and our senses are heightened, allowing us to fully immerse ourselves in the artist's creation. In these moments, we are not merely observers; we become active participants in the artistic journey, our minds and souls intertwined with the artist's vision.As I continue to explore the realms of artistic expression, I am constantly reminded of the incredible power that art holds over our lives. It has the ability to inspire, to provoke thought, and to challenge our perceptions of reality. Art is not merely a luxury or a frivolous pursuit; it is a fundamental aspect of the human experience, a testament to our capacity for creativity, expression, and self-discovery.In a world that often values practicality and efficiency above all else, the artistic mind serves as a reminder of the importance of embracing the intangible, the ethereal, and the deeply personal. It is a reminder that true beauty lies not only in the tangible, but in the invisible threads that connect us to one another, to our shared experiences, and to the vast tapestry of human existence.As I continue on my journey as a student of art, I am filled with a profound sense of gratitude for the artists who have come before me, whose works have inspired generations andchallenged the boundaries of what is possible. Their legacies serve as a beacon, guiding us towards a deeper understanding of ourselves and the world around us.In conclusion, the artistic mind and the aesthetic experience are not mere pursuits of leisure; they are essential components of the human condition, a celebration of our capacity for wonder, creativity, and self-expression. Through art, we bear witness to the depths of the human spirit, and in doing so, we come one step closer to understanding the true essence of what it means to be alive.。
Roles as Entity Types:A Conceptual Modelling PatternJordi Cabot and Ruth RaventósUniversitat Politècnica de CatalunyaDept. Llenguatges i Sistemes InformàticsJordi Girona 1-3, 08034 Barcelonaemail: {jcabot,raventos}@lsi.upc.esAbstract: Roles are meant to capture dynamic and temporal aspects of real-world objects. The role concept has been used with many semantic meanings:dynamic class, aspect, perspective, interface or mode. This paper identifiescommon semantics of different role models found in the literature. Moreover, itpresents a conceptual modelling pattern for the role concept that includes boththe static and dynamic aspects of roles. A conceptual modelling pattern isaimed at representing a specific structure of knowledge that appears in differentdomains. In particular, we adapt the pattern to UML. The use of this patterneases the definition of roles in conceptual schemas. In addition, we describe thedesign of schemas defined using our pattern in order to implement them in anyobject-oriented language. We also discuss the advantages of our approach overprevious ones.1. IntroductionAccurate and complete conceptual modelling is an essential premise for a correctdevelopment of an information system. Reusable conceptual schemas facilitate thisdifficult and time-consuming activity. The use of patterns is a key aspect to increasethe reusability in all stages of software development.A pattern identifies a problem and provides the specification of a generic solutionto that problem. The definition of patterns in conceptual modelling may be regardedin two different ways: conceptual modelling patterns and analysis patterns.In this paper, we distinguish between a conceptual modelling pattern that is aimedat representing a specific structure of knowledge encountered in different domains(for instance the MemberOf relationship), and an analysis pattern that specifies ageneric and domain-dependent knowledge required to develop an application forspecific users (for instance a pattern for electronic marketplaces). Authors do notalways make this distinction. For example, to Fowler, in [8], patterns correspond toour conceptual modelling patterns while to Fernandez and Yuan, in [7], patternscorrespond to our definition of analysis patterns. For a further discussion on analysispatterns see Teniente in [29].The goal of this paper is to propose a conceptual modelling pattern for roles. Arole is meant to capture dynamic and temporal aspects of real-world objects. Thereare some dynamic situations from the real world that are not well suited just with the basic modelling language constructs. For example, when we want to model situations where an entity can present different properties depending on the context where it is used.Although definitions of the role concept abound in the literature of conceptual modelling [2][4][5][8][13][24][25] a non-uniform and globally accepted definition is given. Roles are difficult to represent. They are not merely reified names for the participants in events. As we show in section 3, they can neither be represented as subtypes of other entity types even assuming multiple classification and inheritance. Rather, roles have their own characteristics that require them to be specified with a particular language construct in conceptual schemas.We identify common semantics of role models found in the literature and present a pattern that fulfils them. The use of this pattern eases the definition of roles in conceptual schemas. Moreover, we also discuss the design and the implementation of conceptual schemas that use our pattern to facilitate their implementation in object-oriented languages. We adapt the pattern to UML [19]. As far as we know, ours is the first approach that allows the definition of roles by using the standard UML.The rest of this paper is organized as follows: the next section presents the Role Pattern. Section 3 comments related work and compare it with our proposal. Finally, conclusions and further work are presented.2. Roles as entity types PatternIn order to describe the role pattern we adopt the template proposed by Geyer-Schulz and Hahsler in [11] to describe conceptual modelling patterns (called by the authors analysis patterns). They adopt a uniform and consistent format, in contrast to Fowler in [8] who uses a very free format for pattern writing. Geyer-Schulz and Hahsler stress that adhering to a structure for writing patterns is essential since patterns are easier to teach, learn, compare, write and use once the structure has been understood.Their template preserves the typical context/problem/forces/solution structure of design patterns but adapted for the description of conceptual modelling patterns. The template includes the following sections: (1) Pattern Name. (2) Intent: what the pattern does and what problems it addresses. (3) Motivation: a scenario that illustrates the problem and how the pattern contributes to the solution in the specific scenario.(4) Forces and Context that should be resolved by the pattern. (5) Solution: description of all relevant structural and behavioural aspects of the pattern. (6) Consequences: how the pattern achieves its objectives and the existing trade-off. (7) Design and implementation: how the pattern can be realized in the design stage. (8) Known uses: examples of the pattern.Note that, in the same way design patterns include the outline of possible implementations of the pattern [10], our conceptual modelling pattern includes the outline of the design of the pattern.Following this template, next sections present the Roles as entity types Pattern.2.1 IntentThe intent is the representation of roles that entities play through their life span and the control of their evolution.2.2 MotivationThe role concept appears very frequently in conceptual modelling. However, the possibilities that offer conceptual modelling languages to deal with them are very limited and cover only a small part of the role features (see, for example, what UML supports in [6] and [27]).There is not a uniform and globally accepted definition of roles. We illustrate here some of the most relevant ones:• “It is a defined behaviour pattern which may be assumed by entities of different kinds”, Bachman and Daya in [1].• “Role classes capture the temporal and evolutionary aspects of the real-word objects”, Dahchour et al. in [5].• “Roles allow an object to receive and send different messages at different stages of evolution”, Pernici in [24].• “Roles are founded; defined in terms of relationship to other things, and lacks of “semantics rigidity” (something is semantically rigid if its existence is tied to its class)”, Guarino in [13].To summarize the above definitions, we could say that roles are useful to model the properties and behaviour of entities that evolve over time. The entity type Person is an illustrative example. During his or her life, a person may play different roles, for example he or she may become a student, an employee, a project manager, and so forth. Besides this, a person may have different properties and behaviour depending on the role or roles he/she is playing in a certain instant of time.For instance, consider the following scenario: let Maria be a person who starts studying at a University (Maria plays the role of student). After some years of study she registers to a second university degree (Maria plays twice the role of student) and starts to work in a company (Maria plays the role of employee). In that company she may become a project manager (now Maria through her employee role plays the role of project manager). Note that, in this scenario, if we ask for the telephone number of Maria, the answer is not trivial since depending on the role or roles she is playing it may be her personal or her company phone number.Taking into account the complexity of the notion of role and the lack of support for roles in present conceptual modelling languages, it is clear that a pattern to define such a common construct is needed in conceptual modelling.2.3 Forces and ContextOur definition of the role concept is refined by describing the set of features that roles must meet, most of which have been identified by Steinmann [26]. In our case, these features are the forces that influence and should be resolved by the pattern.We describe them using some examples over the scenario introduced above:1. Ownership. A role comes with its own properties [15][5][14][30], i.e., an instanceof Employee has its own properties which may be different than the ones of the entity type that plays such a role.2. Dependency. An instance of a role is related to a unique instance of its entity typeand its existence depends on the entity type to which it is associated to [15][4][5],i.e., it is not possible to have an instance of Student not related to an instance ofPerson.3. Diversity. An entity may play different roles simultaneously [15][5][12][24][14][30][31], i.e., an instance of Person may play simultaneously the roleof Student and Employee.4. Multiplicity. An instance of an entity type may play several instances of the samerole type at the same time [15][5][12][14][24][30][31]. For instance, a person that registers to more than a University have multiple instaces of Student related to it. 5. Dynamicity. An entity may acquire and relinquish roles dynamically [1][15][5][12][14][22], i.e., a person may become a student, after some years become anemployee, finish his/her studies, become a project manager, start another degree and so forth.6. Control. The sequence in which roles may be acquired and relinquished can besubject to restrictions [5][24][30], i.e., a person may not become an employee when he/she is older than 65 years.7. Roles can play roles [15][4][5][30][31]. This mirrors that an instance of Personcan play the role of Employee and an instance of Employee can also play de role of ProjectManager.8. Role identity [30]. Each instance of a role has its own role identifier, which isdifferent from that of all other instances of the entity to which is associated with.This solves the so-called counting problem introduced by Wieringa et al in [30]. It refers to the fact that we need to distinguish the instances of the roles from the instances of the entity types that play them. For example, if we want to count the number of people that are students in a university (i.e. every person who is registered to at least a program in such university), the total number is less than the number of registered students in such university (in this case a person is counted twice if he or she is registered at two programs).9. Adoption. Roles do not inherit from their entity types [15][12]. Instead, instancesof roles have access to some properties of their corresponding entities i.e., Student may adopt name and address properties of Person but neither religion nor marital status properties. Therefore, the Student role cannot use the last two referred properties.2.4 SolutionWe divide the solution of our role pattern in two subsections. The first one deals with the structural aspects of roles while the second one deals with their evolution.2.4.1 Structural Aspects of RolesWe believe there is not a fundamental difference between roles and entity types since roles have their own properties and identity. Therefore, we represent roles as entity types with their own attributes, relationships and generalisation/specialisation hierarchies. For practical reasons we call role entity types (or simply role if the context is clear)the entity types that represent roles and natural entity types1 (or simply entity types) the entity types that may play those roles.We define the relationship between a role entity type and its natural entity type by means of a RoleOf relationship. This special relationship relates a natural entity type with a role entity type to indicate that the natural entity type may play the role represented by the role entity type. In the relationship we also specify the properties (attributes and associations) of the natural entity type that are adopted by the role entity type.Note that, since roles may play other roles, the same entity type may appear as a role entity type in a RoleOf relationship and as a natural entity type in a different RoleOf relationship.Although this representation may be expressed in many conceptual modelling languages, in this work, we only adapt it to UML. In particular, we use UML 2.0 [19] and OCL 2.0 [18] versions.To be able to represent the RoleOf relationship we use the extension mechanisms provided by UML, such as stereotypes, tags and constraints. Stereotypes allow us to define (virtual) new subclasses of metaclasses by adding some additional semantics.A stereotype may also define additional constraints on its base class and add some new properties through the use of tags.The <<RoleOf>> stereotype allows us to define a RoleOf relationship between the natural and role entity types. The base class of the stereotype is the Association metaclass, which represents association relationships among classes. The <<RoleOf>> stereotype also includes the properties2 the role adopts from the natural entity type. They are represented with a multivalued tag, called adoptedProperties. We may pack this stereotype in a new UML Profile [19] for Roles. Figure 1 shows the definition of the <<RoleOf>> stereotype.1 The natural entity type of a role relationship has sometimes been called object class [5][30]¡Error! No se encuentra el origen de la referencia., ObjectWithRoles [12], natural type [13] [26], base class[4], entity type [1], entity class [2], base role [23], or core object [3].2 A property in UML 2.0 [19] represents both the attributes and associations of an entity type.Figure 1. Definition of the RoleOf stereotype.The multiplicity of the role towards its entity type is ‘1’ (since a role can only be related to a single instance of the entity type) and its settability is readOnly (the role instance must always be related to the same instance of the entity type).As an example, figure 2 shows the extended example introduced in section 2.2 specified in UML. The figure illustrates a natural entity type, Person, with its own properties, playing two roles: Student and Employee. The role Student is a generalisation of domestic and foreign students. The role Employee may play also the role of ProjectManager, who manages a set of tasks. Student adopts properties name, phone number and country (represented as attributes) and address (represented as an association) from Person, and Employee adopts the name and the derived age attribute. ProjectManager adopts name, employee number and the contract expiration date from Employee.Note that Employee has its own phone number different from the Person’s phone number, i.e., Employee does not adopt the phone number attribute from Person. Therefore the answer to the question: “which is the phone number of Maria?” will vary depending on whether we are considering Maria as an instance of Person or Employee. The stereotyped operations shown in the figure will be taken up in the following section.To complete the definition of the static aspects of roles we must attach some constraints to the <<RoleOf>> stereotype in order to control the correctness of its use. The constraints are the following:•A stereotyped <<RoleOf>> association is a binary association with multiplicity ‘1’ and settability readOnly in a member end• Each value of the adoptedProperty tag must coincide with the name of a property of the natural entity type.• A role entity type can only be related throughout a RoleOf relationship to at most a natural entity type.• No cycles of roles are permitted; a role entity type may not be related throughout a direct or indirect RoleOf relationship to itself.Adopted properties by the role from its natural entity type may be considered as implicit properties of the role entity type. Nevertheless, in order to facilitate the use of this adopted properties (for instance, when writing OCL expressions) we may need to include them explicitly in the role entity type. In this case, we add an extra property in the role entity type for each adopted property. These extra properties are labeled with the <<adopted>> stereotype to distinguish them from the own properties of the role entity type. In addition, they are derived. Their derivation rule always follows the general form: context RoleEntityType::adoptedPropertyX: Typederive : naturalEntityType.propertyXNote that, to facilitate the work of designers, these added properties can be automatically generated. Figure 3 extends a subset of the previous example illustrating the Student role entity type including its adopted properties. Student student#: Integer <<adopted>>/name: String <<adopted>>/phone#: PhoneNumber <<adopted>>/country: String Personname: String phone#: PhoneNumber birthDate: Date country: String /age: Integer<<RoleOf>>{adoptedProperties = name, address, phone#, country}1 {readOnly}Address street: String number: Integer ZIPcode: String***1 1<<adopted>>context Student::name: Stringderive : context Student::phone#: PhoneNumber derive : person.phone#context Student::country: Stringderive : person.countrycontext Student::address: Addressderive : person.addressFigure 3.Example of the Student role entity type.2.4.2 Role Acquisition and RelinquishmentSo far, we have introduced a representation of the static part of the Roles as entity types Pattern. Nevertheless, this is not enough since role instances may be added or removed dynamically from an entity during its lifecycle and this addition or removal may be subjected to user-defined restrictions.Since roles are represented as entity types we may define constraints on roles in the same way as we define constraints on entity types. Some of the constraints are inherent to our role representation (for example, that a person must play the role of Employee to play the role of ProjectManager , is already enforced by the schema).Other restrictions involved may be expressed by means of the predefined constraints of UML. For example, to restrict that an Employee cannot play more than twice the ProjectManager role simultaneously, it is enough to define a cardinality constraint in the relationship. The definition of the rest of constraints requires the use of a general-purpose language, commonly OCL in the case of UML. For instance, we could specify OCL constraints to control that:• A Person can only play the role of Employee if he/she is between 18 and 65 years old:context Employee inv:self.age>=18 and self.age<=65• Any task of a ProjectManager must finish before his contract expires context Task inv:self.dueDate<self.projectManager.expirationDateThese OCL constraints are static, and thus, the role instances must satisfy them at any time. However, many of the restrictions that may be involved in the evolution of roles only apply at particular times, concretely they only need to be satisfied when the role is acquired or when it is relinquished. To specify such constraints we use the notion of creation-time constraints defined by Olivé in [17] and, in a similar way, we define the deletion-time constraints.Creation-time constraints must hold when the instances of some entity type are created (in our case when the role is created). Deletion-time constraints must hold when the instances of some entity type are deleted (in our case when the role is deleted). These constraints are represented as operations, also called constraint operations, attached to the entity types and identified by a special stereotype. The creation-time constraint operations are marked with the stereotype <<IniIC>>. We define the stereotype <<DelIC>> for the deletion-time constraint operations.These operations return a boolean that must be true to indicate that the constraint is satisfied. If the operation returns false (i.e., the constraint is not satisfied) then the creation or deletion event of the role is not accomplished. When appropriate, the operations are automatically executed by the information system.As an example, we have defined the following restrictions in figure 2:• A person cannot become an employee if he/she is studying two university degrees simultaneously. Note that this does not imply that a person that is already an employee may apply for two degrees.context Employee :: mayBeHired () : Booleanbody: self.person.student->size()<2• An employee may not be fired if he or she is in maternity leave.context Employee :: mayBeFired () : Booleanbody: self.state<>’MaternityLeave’• An employee may not become a new project manager if he/she still holds more than ten pending tasks.context ProjectManager:: notTooManyPendingTasks(): Booleanbody self.employee.projectManager.tasks->select(dueDate>Today)->size()<=102.5 ConsequencesOur pattern of roles achieves the objectives proposed in Section 2.3 since it fulfils the role features outlined before:• Ownership. As roles are represented as entity types, they may have their own properties.• Dependency. The cardinality ‘1’ with the tag {readOnly} ensures that all role instances depend on a unique instance of the natural entity type.• Diversity. As the RoleOf relationship is an association, entity types may have many RoleOf relationships.• Multiplicity. This is obtained by the cardinality at the RoleOf relationship.• Dinamicity. Entities are related to their roles through an association. Thus, an entity may acquire or retract instances of a role many times.• Control. The sequence in which roles may be acquired and relinquished can be subjected to restrictions.• Roles can play roles. Roles are represented by ordinary classes. So, they can be participants of a RoleOf relationship.• Role identity. As roles are represented as entity types, their instances have their own identifier.• Adoption. The adoptedProperty tag of the RoleOf relationship allows the definition of this mechanism.A trade-off that one may find in our representation is that we do not consider that roles cannot be associated to different natural entity types. We consider that this situation may be solved by defining a common supertype for all the natural entity types that play such role. For instance, if we need C lient to be role of both Company and Person (understood as a physical person), we could define a common supertype for Company and Person, called LegalPerson, which plays the role of Client.On the other hand, we do not allow roles to remain unconnected to any entity, as for instance, Employee understood as a vacant position not played by any Person. This approach is commonly used when considering roles just as interfaces. We discuss the limitations of this approach in Section 3.2.6 Design and ImplementationThere are some design patterns useful for designing and implementing roles in object oriented languages [8]. However, most of them are unable to deal with our proposed role semantics completely. A well-known pattern close to our role defined semantics is the Role Object Pattern [3]. This pattern is especially well suited for role implementation when roles are deemed as a specialization (or a kind of specialization) of its entity type (see Pelechano et al. in [23] as an example).Nevertheless, this pattern is not entirely appropriate for designing our conceptual modelling pattern. We encounter two main problems in the Role Object Pattern. First, it uses a common superclass for all the roles of the entity type. In our approach, the roles are independent entity types so they do not need to present any common properties that justify this superclass. Secondly, all the roles are forced to have thesame inherited properties; it is not possible to define different adopted properties for each role.This is the reason why we advocate here for an adapted version of this pattern that it takes into account our complete role semantics, including the adoption mechanism and the creation-time and deletion-time constraints.Given a natural entity type and the set of its roles, we create a class for the natural entity type and a class for each role. We create a different relationship between the natural entity type and each of its roles. This relationship will be used to navigate from the natural entity type to its roles and vice versa. We add to the natural entity type two new operations addRole and deleteRole in charge of adding (deleting) roles to the natural entity after checking the creation-time (deletion-time) constraints. We could also add other useful operations when dealing with roles, such as hasRole or getRole .The problem of the design of the adopted properties may be regarded as the same problem as designing derived information. In general, from a design and/or implementation point of view, there are two different approaches to deal with derived information. The attributes may be computed if they are calculated by means of an operation or may be materialized if they are explicitly stored in the class. In this case, for each adopted property we add an extra operation to the role class that returns the value of the property of the natural entity type. The operation accesses the property of the natural entity type navigating through the relationship.Figure 4 summarizes our proposal. In figure 5 we apply the proposed design pattern to a part of the conceptual schema of figure 2. Note that Employee is both a role for the Person entity type and a natural entity type for the ProjectManager role, and thus, it presents both a reference to Person (as a role entity type) and the operations addRole and deleteRole (as a natural entity type). *NaturalEntityTypeOperationsaddRole()deleteRole()1 * RoleEntityType1 Properties Operations opPropertyAdopted1() … RoleEntityTypeN 1 . . .PropertiesFigure 4. Summarized class diagram of the design.This structure can be directly implemented in any common object-oriented language. As an example, in the Appendix, we show part of the implementation of Person and Employee classes in the Java language.Employee Studentstudent#: Integername()address()phone#()country() ProjectManager name() employee#()expirationDate()Personname: Stringphone#: PhoneNumberbirthDate: Datecountry: String1*0..2 employee#: Integer category: String phone#: PhoneNumber state: String expirationDate: Date name() age() addRole() deleteRole()age()addRole()deleteRole()1 1 * projectName: String startDate: DateFigure 5.Example of an application of the design.2.7 Known UsesThe role concept appears frequently in many different domains of the real world, since in each domain we can find entity types that present some properties that evolve over time.Papazoglou et al. in [22] note that roles can be useful for several type of applications based on the use of object-oriented technology and they describe two examples of broad types of application that need role support: security and workflows . Some more examples are discussed by Jodlowski et al. in [14].3. Related WorkPrevious research can be grouped in four basic approaches to representing roles. We discuss the major drawbacks of each approach according to our role defined semantics. However they may suffice when considering more limited semantics.The first approach represents a role as a label assigned to a participant in an event[19]. This representation does not achieve our objectives because roles come with their own properties different from those of the entity types playing them, which cannot be defined within the label.A second approach considers that roles and entity types can be combined into a single hierarchy [1][4][25]. Role entity types are represented as subtypes of the natural entity type. For instance, if Person were a natural entity type, then Student, Employee and ProjectManager roles would appear as subtypes. Quite obviously, such a solution requires dynamic and multiple classification, since a person can change his/her role and play several roles simultaneously. However we would like to make。
科技英语_秦荻辉_科技英语语法习题以及答案练习 1I、将下列句子译成汉语,注意句中有些冠词的特殊位置:1. In this case the current(电流)exists for only half the cycle(周期).2. In such a case there is no current flowing in the circuit(电路).3. Sensitivity(灵敏度)is a measure of how small a signal(信号)a receiver(接收机)canpick up and amplify(放大)to a level useful for communications.4. ε may be as small a positive constant as you please.5. Even so fundamental a dimension,量纲,as time was measured extremely crudely with sandand water clocks hundreds of years ago.6. Nonlinear distortion,非线性失真,can be caused by too large an input signal.7. The method used is quite an effective one.8. A series,级数,solution of this kind of problem allows as close a calculation of the error as needed.II、将下列句子译成汉语,注意句中“and”和“or”的确切含义:1. Air has weight and occupies space.2. In this way less collector dissipation(集电极功耗)results, and the efficiency increases.3. We can go one step farther and take into account the nonzeroslope of the actual curves.4. Try hard, and you will work the nut(螺母)loose.5. The first step in analyzing a physical situation is to select those aspects of it which are essential and disregard the others.6. This satellite was used for communications between the United States and Great Britain, France and Italy.7. Some physical quantities require only a magnitude and a unit tobe completely specified. Thus it is sufficient to say that the mass of a man is 85 kg, that the area of a farm is 160 acres, that the frequencyof a sound wave is 660 cycles/sec, and that a light bulb consumes electric energy at the rate of 100 watts.8. Geothermal energy, or energy from within the earth, can be usedto generate electricity.o9.The current in a capacitor(电容器)leads(导前)the voltage by 90, or, the voltage lagsothe current by 90.10. The message is a logical unit of user data, control data, or both.III、将下列句子译成汉语,注意句中分数和倍数的正确译法:1. By varying V only a few hundredths of a volt, the base current(基极电流)can be BEchanged significantly.2. The standard meter is accurate to about two parts in one billion.3. Cromatographic(层析的)techniques have been developed to detectair pollutants atconcentrations(浓度)of one part per million or less.4. The volume coefficient(体膨胀系数)of a solid is almost exactlythree times its linearcoefficient.5. The demand for this kind of equipment in the near future will be20 times what it is.6. The wavelength of this musical note(音符)is7.8 ft, over threetimes longer than thewavelength of the same note in air (2.5 ft).7. This causes the collector current(集电极电流)to change by afactor of approximately β.8. This factor(因子)is now equal to 9, a reduction by a factor of 11.IV、将下列句子译成英语:1、火箭是由金属制成的。