判断题建造者模式中,每一个builder都相对独立,而与其他的builder无关A对B错
判断题
建造者模式中,每一个builder都相对独立,而与其他的builder无关
A
对
B
错
参考解析
解析:
暂无解析
相关考题:
下面哪条语句可以构造正确的对话框()。 A.AlertDialog dialog=new AlertDialog(context);B.AlertDialog.Builder builder=new AlertDialog.Builder(context);C.ProgressDialog dialog=new ProgressDialog();D.ProgressDialog.Builder builder=new ProgressDialog.Builder(context);
阅读以下说明和Java代码,回答问题[说明]在某些系统中,存在非常复杂的对象,可以采用循序渐进的方式进行组合将小对象组合,成复杂的对象。以下实例展示了Builder(生成器)模式。该实例用来建立“文件”,文件内容包括:一个标题、一串字符以及一些有项目符号的项目。Builder类规定组成文件的方法,Director类利用这个方法产生一份具体的文件。图6-1显示了各个类间的关系。以下是Java语言实现,能够正确编译通过。[Java代码]//Builder. java文件public (1) class Builder {public abstract void makeTitle(String title);public abstract void makeString(String str);public abstract void makeItems(String[] items);public abstract Object getResult();}//Director. java文件public class Director{private (2) builder;public Director(Builder builder){this. builder = builder;}public Object construct(){builder.makeTitle("Greeting");builder.makeString("从早上到白天结束");builder.makeItems(new String[]{"早安", "午安",});builder.makeString("到了晚上");builder.makeItems(new String[]("晚安", "好梦",});return builder.getResult();}}//TextBuilder.java文件public class TextBuilder (3) Builder{private StringBuffer buffer = new StringBuffer();public void makeTitle(String title){buffer.append("『" + title + "』"\n\n");}public void makeString(String str){buffer.append('■' + str + "\n\n ");}public void makeItems(String[] items){for(int i = 0; i (4) ; i++){buffer.append('·' + items[i] + "\n");}buffer.append("\n");}public Object getResult(){return buffer.toString();}}//Main.java文件public class Main {public static void main(String[] args) {Director director = new Director(new TextBuilder());String result = (String)director. (5) ;System.out.println(result);
创建型设计模式抽象了实例化过程,帮助一个系统独立于如何创建、组合和表示它的那些对象。以下( )模式是创建型模式。A.组合(Composite) B.构建器(Builder)C.桥接(Bridge) D.策略(Strategy)
阅读下列说明和 C++代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】生成器( Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图 5-1 所示为其类图。【C++代码】#include #include using namespace std;class Product {private:? ??string partA, partB;public:Product() {?? }? ? ?voidsetPartA(const string}???? voidsetPartB(const string}//? 其余代码省略};class Builder {public:??????? (1)?? ;virtual void buildPartB()=0;??????? (2)?? ;};class ConcreteBuilder1 : public Builder {private:Product*?? product;public:ConcreteBuilder1() {product = new Product();???? }??? voidbuildPartA() {????? (3)???? ("Component A"); }??? voidbuildPartB() {????? (4)???? ("Component B"); }Product* getResult() { return product; }//? 其余代码省略};class ConcreteBuilder2 : public Builder {? ??/*??? 代码省略??? */};class Director {private:?Builder* builder;public:? ?Director(Builder* pBuilder) { builder= pBuilder;}???? voidconstruct() {? ? ? ? ? ? ? (5)???? ;? ? ?//? 其余代码省略????? }//? 其余代码省略};int main() {Director* director1 = new Director(new ConcreteBuilder1());?director1->construct();? ?delete director1;? ??return 0;
阅读下列说明和 Java 代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】生成器( Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图 6-1 所示为其类图。阅读下列说明和C++代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】???? 生成器(Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图5-1所示为其类图。?【C++代码】#include #include using namespace std;class Product {private:?string partA, partB;public:?Product() {?? }? ?void setPartA(const string}???? void setPartB(const string}? ?//? 其余代码省略};class Builder {public:? ? ??(1)??;?virtual void buildPartB()=0;? ? ?(2)??;};class ConcreteBuilder1 : public Builder {private:?Product*?? product;public:ConcreteBuilder1() {product = new Product();???? }void buildPartA() {????? (3)???? ("ComponentA"); }?void buildPartB() {????? (4)???? ("ComponentB"); }??Product* getResult() { return product; }//? 其余代码省略};class ConcreteBuilder2 : public Builder {? ??? ? ? ?/*??? 代码省略??? */};class Director {private:? ??Builder* builder;public:??Director(Builder* pBuilder) { builder= pBuilder;}? ??void construct() {????????????????? (5)???? ;?????????????? //? 其余代码省略? ?}??//? 其余代码省略};int main() {? ? ??Director* director1 = new Director(new ConcreteBuilder1());? ?director1->construct();? ? ??delete director1;? ? ?return 0;【Java代码】import jav(6)A.util.*;class Product {? ? ? ?private String partA;? ? ? ?private String partB;? ? ? ??public Product() {}? ? ??public void setPartA(String s) { partA = s; }? ? ? ?public void setPartB(String s) { partB = s; }}interface Builder {? ?public?????? (1)???? ;? ??public void buildPartB();? ? ??public?????? (2)???? ;}class ConcreteBuilder1 implements Builder {? ? ? ?private Product product;? ? ? ?public ConcreteBuilder1() { product = new Product();?? }? ? ? ??public void buildPartA() {????????(3)??("Component A"); }public void buildPartB() {???? ????(4)?? ("Component B"); }? ? ??public Product getResult() { return product;}}class ConcreteBuilder2 implements Builder {?? ? ? ? ?//? 代码省略}class Director {? ? ? ?private Builder builder;? ? ? ?public Director(Builder builder) {this.builder = builder; }public void construct() {? ? ? ? ? ? ? ? ? (5)???? ;? ? ? ? ? ? ? //? 代码省略? ? ??}}class Test {? ? ??public static void main(String[] args) {???????????????? Director director1 = newDirector(new ConcreteBuilder1());???????????????? director1.construct();? ? ? ??}
以下哪个设计模式是着重于一步步构造一个复杂对象并且是最后步骤才将返回此对象?()A、简单工厂模式(Simple Factory)B、抽象工厂模式(Abstract Factory)C、建造者模式(Builder)D、单例模式(Singleton)
The IT department is creating a human resources application that will require several new tables. You need to develop a standard alone executable that will defines these tables and their relationships. Which developer/2000 component could you use to create the executable?()A、Procedure builder. B、Query builder. C、Schema builder. D、Form builder. E、Project builder. F、Transactional builder.
单选题The IT department is creating a human resources application that will require several new tables. You need to develop a standard alone executable that will defines these tables and their relationships. Which developer/2000 component could you use to create the executable?()AProcedure builder. BQuery builder. CSchema builder. DForm builder. EProject builder. FTransactional builder.
单选题以下哪个设计模式是着重于一步步构造一个复杂对象并且是最后步骤才将返回此对象?()A简单工厂模式(Simple Factory)B抽象工厂模式(Abstract Factory)C建造者模式(Builder)D单例模式(Singleton)
单选题在J2EE中,接受一个XML文档,返回document对象,以分析该XML文档,可以使用如下()方法获得document对象ADocument doc=DocumentBuilderFactory.parse(“my.xml”);BDocument doc=DocumentBuilder.parse(“my.xml”);CDocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance(); DocumentBuilder builder=dbf.newDocumentBuilder(); Document doc=builder.parse(“my.xml”);DDocumentBuilder builder=new DocumentBuilder(); Document doc=builder.parse(“my.xml”);
填空题HMIWEB Display Builder中,()意思为解组。