singletons
辛格尔顿
单例
辛格顿
单身
单胎
实例行为指定可运行的服务实例的数目(例如,singleton 指定只能用单一实例来处理所有消息)。 Instance behavior specifies how many instances of the service can be run(for example, a singleton specifies only one instance to process all messages). 任何打破加密的企图都将对我们的权利,经济和整个互联网造成毁灭性的打击,”Singleton Norton说。 Any attempt to break encryption would be devastating to our rights, our economy and the internet as a whole,” Singleton Norton said. 名词,动词,介词和形容词都很常见,例如BindingAnnotation,Inject,ImplementedBy或Singleton 。 Nouns, verbs, prepositions, and adjectives are all common, for example, BindingAnnotation, Inject, ImplementedBy, or Singleton . 正如该模式集合所做的那样,将抽象的概念与特定的实现分隔开来可能会使Singleton 实现看起来非常简单。 Separating the abstract concept from a particular implementation, as this patterns collection does, may make the Singleton implementation look surprisingly simple. 如果执行过程的不同线程同时进入Instance属性方法,那么可能会创建多个Singleton 对象实例。 If separate threads of execution enter the Instance property method at the same time, more that one instance of the Singleton object may be created.
而这种方式是Singleton 类被装载了,instance不一定被初始化。 And this way the Singleton class is loaded, and the instance is not necessarily initialized. Singleton 的确是实现注册表的一种简单途径,但这只是一个实现时的决定,可以很轻松地改变它。A singleton provides a simple way of implementing a registry, but that implementation decision is easily changed.多数情况下,singleton 应该具有全局可见性,这可通过将其创建方法public来实现。 It is most often the case that the singleton should also be globally accessible, and this is achieved by making the creation method public. 因为采用privateconstructor,所以Singleton 是不能被继承的。 And please consider that in case of Singleton you cannot use inheritance because of the private constructor. 第3项描述了Singleton 模式,并给出了单例类的以下示例。 Item 3 describes the Singleton pattern and gives the following example of a singleton class. 为了维护并保证Singleton ,必须声明所有实例域都是瞬时(transient)的,并提供一个readResolve方法。 To maintain the singleton guarantee, declare all instance fields transient and provide a readResolve method. Singleton模式的另外一个优点是singleton 的创建可以被延迟到真正需要的时候,正如表1所示。 One other advantage to this pattern is that creation of the singleton can be delayed until it is actually needed. 实例控制:Singleton会阻止其他对象实例化其自己的Singleton 对象的副本,从而确保所有对象都访问唯一实例. Singleton prevents other objects from instantiating their own copies of the Singleton object, ensuring that all objects access the single instance.要得到Singleton 的工厂,你可以调用PopupFactory的getSharedInstance()方法. To get the Singleton factory, you call the getSharedInstance() method of PopupFactory. 能达到Singleton 界的分组码称为MDS(最大距离可分)codes。 Linear block codes that achieve equality in the Singleton bound are called MDS(maximum distance separable) codes. 就像刚才在BorderFactory说的那样,Factory模式不一定要和Singleton 模式一块使用。 As shown with BorderFactory, the Factory pattern does not have to be used with the Singleton pattern. Web是一个多用户环境,所以在一个静态对象中(如singleton )保持应用状态是有可能引起问题的。 The web is a multiunser environment, so holding application state in static objects such as singletons is likely to cause issues. 任何编写过MFC应用的开发人员(不管编写的应用是如何的小)都知道什么是singleton 。 Anyone who has ever written an MFC application- no matter how small- knows what a singleton is. 一种改进的思路是:服务定位器仍然是一个注册表,但不是Singleton 。 A way to think of this is that service locator is a registry not a singleton .把珍珠放在安全、华生,”他说,”和Conk-Singleton 伪造文件的情况下。 Put the pearl in the safe, Watson,' said he,'and get out the papers of the Conk-Singleton forgery case.
Display more examples
Results: 143 ,
Time: 0.0201