OO pattern Question

the Question:
In the file system, there are many files, their's file format is FormatA.
and now come two new file formats, FormatB and FormatC.
Now the old files with file format FormatA should be converted into files with FormatB,and In the future the FormatB maybe convertend into FormatC,
how to design using design patterns?

Hi myQA,
what exactly are you considering the client?
The one calling readFile and writeFile?
If you are concerned about explicitly creating FileXReaderWriter
and thus knowing about the differnt file types, one could easily overcome
this limitation by using a Factory class:
public class ReaderWriterFactory {
    public FileReaderWriter createReaderWriter(){
        if (someCondition) { // the condition might be depend on some parameter provided (filename for example) or the state of the system or ...
             return new FileAReaderWriter();
        } else {
             return new FileAReaderWriter();
}If you only need this whole stuff for converting (thus you don't want to read files in order to work with the data inside) you could wrap all
the logic behind on function call convert(String fromName, String toName) maybe with some additional information what formats to use.
Although this really belongs in its own class Converter I guess one could add It to the Factory, which then shouldn't be named Factory anymore. If the other classes and Interfaces aren't needed anywhere outside your Converter you should make them private to the converter.
regards
Spieler

Similar Messages

  • Display pattern questions

    I would like to be able to set up a display patter that will add some asterisks or some other characters on each side of what ever a user enters in a field in order to flag the text. Is that possible? or is there a better way to do this than using display patters. I check the Designer help but could find much to answer my question.

    Amanda,
    Try to put a single quote around the parenthesis like this:
    '('$ZZ,ZZ9.99')' for your display pattern.

  • Regex pattern question

    Hi,
    I'm trying to get my feet wet wtih java and regular expressions, done a lof of it in perl, but need some help with java.
    I have an xml file (also working through the sax tutorial, but this question is related to regex)that has multiple elements, each element has a title tag:
    <element lev1>10<title>element title</title>
    <element lev2>20<title>another element title</title>
    </element lev2>
    </element lev1>If I have the following pattern:
    Pattern Title = Pattern.compile("(?i)<title>([^<]*)</title>");that picks up the titles, but I can't distinguish which title belongs to which element. Basically what I want to have is:
    Pattern coreTitle = Pattern.compile("(?i)<element lev1>(**any thing that isn't an </title> tag**)</title>");looked through the tutorials, will keep looking, I'm sure it's in there somewhere, but if someone could point me in the right direction, that would be great.
    thanks,
    bp

    Just guessing, but maybe...
    Pattern.compile("(?i)<element lev1>*<title>([^<]*)</title>");
    But it seems that things like parsing with SAX (or loading to a DOM) or XPath would be much better suited to parsing out XML then regexp.

  • Patterns Question

    Hey everyone, got a question regarding patterns in Illustrator and this one is sorta bugging me.
    Basically, I have a single object, a 3 leaf clover. When I import this object into the swatch pallet, it can make a pattern...yet it is more of a x and y axis pattern (clovers that make 90 degree angles and 180 angles). Is there an easy way to make the clovers pattern everywhere (making 45 degree angles , 90 degree angles, and 180)?
    Thanks in advance for your input. I appreciate it.

    Teri Petit has a sort of tutorial on how to do this do a search for Teri Petit Pattern Fill.

  • Service Locator pattern question.

    Hi,
    We have this kind of service locator which provides the caller a reference to a remote interface instead of to the home interface of the session bean. We're working with weblogic 6.1. My question, is it ok to store a reference to a remote interface in the service locator or is it better to store a reference to the home interface or .... is it better to not store them but every time create one when a client wants one. What is the best way and the pros and cons.
    Cheers!

    Hi,
    typically it is more common to just cache Homes and Factories in the ServiceLocator pattern.
    We have a detailed example of the Service Locator pattern applied in an application at http://java.sun.com/blueprints/patterns/ServiceLocator.html
    We cache the EJB Homes and other Factories.
    http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/servicelocator/web/ServiceLocator.java.html
    This allows the Service Locator to be used as a utility class. We have a Service Locator used by the web tier, and also one used by the EJB tier to lookup other EJBs and resources.
    hope that helps,
    Sean

  • OSB1G R3 Security Active Intermediary pattern question

    Hi
    we have a requirement to use Message level security (no ssl) between the client and OSB 10gR3 proxy services . No security is required between proxy and business services
    I wnet through WLS and OSB documentation and found it conflicting/vague for setting up the Active intermediary pattern
    we need to do 4 uses cases, Request encryption, Request signing, Response encryption, Response signing
    I have a few questions
    Do we need to setup PKI credential mapper for this (or is this only for outbound between Proxy and business services)
    How do the scenarios logically work (who uses private key and who uses public key for each of these scenarios)
    Current documentation doesnt match with my understanding of PKI infratsructure
    Thanks for any information

    Hi Udi,
    If I am reading your question correctly, you want to know if XI can take the user context from the sharepoint portal and pass it on to the R/3 backend, i.e. logging on to R/3 using the same user as is logged on to sharepoint. The answer, unfortunately, is no. AFAIK the only current way to accomplish this is to include the username in the actual message content and pass this on to the R/3 system; then on the R/3 system code the necessary authority checks against the provided username. Be aware though, that you cannot use the usual authority-check functionality for this.
    Regards,
    Thorsten

  • XSD:Pattern Question

    SQL*Plus: Release 11.2.0.2.0 Production on Thu Jan 13 15:25:04 2011
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for 64-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    I'm putting together a simpler test case for this, but I figured I'd start by asking the question and seeing if the answer is simple...
    I have an XML document with the date elements:
                    <documentDate>20080808</documentDate>
                    <entryDate>2009-09-22</entryDate>the documentDate is defined as PartialDateType.
         <xsd:simpleType name="PartialDateType">
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="\d{4}|\d{6}|\d{8}"/>
              </xsd:restriction>
         </xsd:simpleType>When I try to validate the document, I get
    “literal "20080808" is not valid with respect to the pattern”.
    If I shorten the date to "2008", the document validates.
    What part of <xsd:pattern value="\d{4}|\d{6}|\d{8}"/> do I not understand?

    Workaround is to reverse the pattern.. See below
    c:\xdb>sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 19 13:55:30 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:01:40.47
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.08
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> var SCHEMAURL VARCHAR2(700)
    SQL> var XMLSCHEMA CLOB
    SQL> var INSTANCE CLOB
    SQL> --
    SQL> begin
      2    :SCHEMAURL:= 'http://xmlns.example.com/testcase.xsd';
      3    :XMLSCHEMA :=
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      6     <xs:element name="T1" type="T1_TYPE"/>
      7     <xs:complexType name="T1_TYPE">
      8             <xs:sequence>
      9                     <xs:element name="TEST" type="PartialDateType"/>
    10             </xs:sequence>
    11     </xs:complexType>
    12     <xs:simpleType name="PartialDateType">
    13             <xs:restriction base="xs:string">
    14                     <xs:pattern value="\d{8}|\d{6}|\d{4}"/>
    15             </xs:restriction>
    16     </xs:simpleType>
    17  </xs:schema>';
    18  end;
    19  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => FALSE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
    13      OPTIONS          => DBMS_XMLSCHEMA.REGISTER_BINARYXML
    14    );
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:04:26.10
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS SECUREFILE BINARY XML
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    Elapsed: 00:00:06.08
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    Elapsed: 00:00:06.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    Elapsed: 00:00:07.67
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:24.30
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    Elapsed: 00:00:08.02
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:11.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:06.18
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.61
    SQL> DROP TABLE TEST_TABLE PURGE
      2  /
    Table dropped.
    Elapsed: 00:00:00.14
    SQL> call dbms_xmlSchema.deleteSchema(:SCHEMAURL)
      2  /
    Call completed.
    Elapsed: 00:00:00.06
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => TRUE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.87
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.07
    SQL> create trigger DO_VALIDATION
      2  before insert
      3  on TEST_TABLE
      4  for each row
      5  begin
      6   :new.object_value.schemavalidate();
      7  end;
      8  /
    Trigger created.
    Elapsed: 00:00:00.06
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.39
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.52
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.50
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.95
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.53
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.40
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.37
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.74
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.49
    SQL>

  • Needed Latest  SCJP 1.4 exam pattern +question papers

    Hi,
    I'm taking up SCJP 1.4 exam on 13th Oct.
    Could you please suggest websites for/ send the Latest SCJP 1.4 exam pattern and question papers for me ?
    Thanks and Regards,
    Sanjeev Kulkarni

    Darryl.Burke wrote:
    From the UK:
    Durham University's page on SLAC-HEPNAMES database of EMAIL-IDs in HEPDATA
    {color:#0000ff}http://durpdg.dur.ac.uk/HEPDATA/ID{color}That line is only in the title. The text says
    worldwide directory of email addresses
    >
    From the US:
    University of California's page on Mail ID Name Changes
    {color:#0000ff}http://email.ucdavis.edu/forms/mailidnamechange.php{color}They use MailID (not email id, is an internal identifier) and the text says
    change in your email address then after your old email address expires
    >
    >
    University of North Carolina's page on UNCW E-mail ID Retrieval
    {color:#0000ff}https://appserv02.uncw.edu/dasapps/sec/getid.aspx{color}Once again, Email-ID is again an internal term refering to the use of an email address as a logon id.
    The text, once again, says
    UNCW e-mail username (your e-mail address without the @uncw.edu)
    >
    From Belgium:
    Username: (Email ID) on
    {color:#0000ff}http://customer.netline.be/{color}
    Once again, I see this more as simply an internal reference to an email used as a logon id (so a composite term).
    Madison Area Technical College's page on Student Network/Email ID Choices
    {color:#0000ff}http://matcmadison.edu/matc/studentresources/studentemail/about.shtm{color}
    From page
    {color:#0000ff}http://www.abitmore.be/ssr2001/w3warecb.htm{color}
    ... ... like: change in eMail ID, ... ...
    These site seems to be using like you feel (although the first does not contain enough context to be sure), but they, and every other site listed here, is hardly definative.
    Edit: This is not to be combative, so please don't take it that way. Just expanding on my viewpoint.
    ;-)

  • Interactive pattern question

    hey all, i need help, i have a school project, which is making website. i need a tutorial on how to make moving interactive pattern like this http://andy.thlndr.com
    i appreciate any advice, please help! thks

    Hello, I have a couple points of advice for you...
    First I think your aiming a little high, that's more then a pattern and the load time on it is long...
    It is very cool, no doubt! If you have your heart set on it I would contact him and ask him for a breakdown if he's willing, because he is a coder and if your in school I'm just going to assume its over your head at the moment..
    If your some kind of a lil genius then more power to you
    If your new in edge id suggest that you follow available tutorials, there are plenty..and some are very well done.

  • DAO pattern question

    According to the DAO pattern, all fields of the table has to be put in the class, e.g. if I have a table called customer, I have to create a Customer class and then I have another class called CustomerDAO class. In CustomerDAO, I should have a method called getCustomer that returns Customer. But if my table is quite large, and I don't need to get all the attributes of the customer every time, what approach should I use, do I define another method to return, e.g. customer name. customer age etc.? Is there any standard convention?
    Thanks

    hi,
    according to my understanding, u should use Value Object pattern.
    for Example:
    In Customer table if u have Id, name.
    then u have CustomerVO in which u have the following code.
    public class CustomerVO
    private Long id;
    private String name;
    public Long getID()
    return this.id;
    public String getName()
    return this.name;
    public void setID(Long id)
    return this.id=id;
    public String setName(String name)
    return this.name=name;
    So now u have craete object of CustomerVO and get ur required fields only and Enjoy!!!!!!!!!

  • Translation pattern question

    Good afternoon - I had an urgent request to forward a number out of our DID pool to a satellite phone, which I was attempting to do with a translation pattern. When that didn't work, I tried setting that DID up as a regular DN, but not assigning it to a phone, and configuring the CFWALL to forward to the international number, making sure the cfw partition is set to all international calls.... Is there an easy way to do this? Other than configuring that number on a phone of course and doing a good old-fashioned CFWall.

    Yes, I ensured that I had the correct CSS and number mask. As a quick fix, I put an extension on the employees phone, and created a temporary cfw CSS with international calling capabilities and forwarded all calls to the satellite phone number.
    Thanks!
    Joel

  • Strategy pattern question.

    Can the following scenario be called strategy pattern?
    public class StrategyExecutor {
         public static void main(String[] args) {
              Strategy[] strategies = {new FirstImpl(), new SecondImpl()};
              for(int i = 0; i < strategies.length; i++){
                   System.out.print("Strategy ["+ i +"] ");
                   strategies.solve();
    public interface Strategy {
         public void solve();
    public abstract class AbstractClass implements Strategy{
         public void solve(){
              int result = getFirstParam()+getSecondParam();
              System.out.println(" Result "+result);
         protected abstract int getSecondParam();
         protected abstract int getFirstParam();
    public class FirstImpl extends AbstractClass {
         protected int getSecondParam() {          
              return 22;
         protected int getFirstParam() {          
              return 11;
    public class SecondImpl extends AbstractClass {
         protected int getSecondParam() {
              return 44;
         protected int getFirstParam() {          
              return 33;

    To be a perfect fit for Strategy pattern, if the abtract class which has the template to solve() is not there and the actual algorithm is down in the FIrstImpl, SecondImpl then its a true strategy?
    Design point of view it can be a strategy pattern..
    but If you see from the the context and the programs
    objective, It is not strategy pattern

  • Repeating pattern question

    I’m trying to make a repeating pattern that includes a teapot image that I filled with a repeating rose pattern background. After everything has been reflected evenly on all axis, I then try to drag into the swatches panel. However, for some reason when I try to drag this pattern into the swatches panel, illustrator won’t do it. It will do it if I remove the tea pots and tea cups that have that repeating background pattern, but not when it’s there. Any idea what’s going on?
    It seems like ai is confused that I’m trying to make a repeating pattern with an image (the teapot)  that has a repeating pattern for the background.

    Select the teapot and cup and go to Object>Expand before you drag back into the swatches panel.

  • Factory pattern question

    Hi, I'm using a factory pattern to return different objects depending on whats needed:
    synchronized Worker getWorker(final byte[] request, String type) {
            int poolIndex = -1;
            for (int i = 0; i < workerCount; i++) {
                if (workerPool[i] == null) {
                    poolIndex = i;
                    if (type.equals("TypeA")) {
                        workerPool[i] = new TypeA(request, poolIndex);
                        workerPool.setType("TypeA");
    } else if (type.equals("TypeB")) {
    workerPool[i] = new TypeB(request, poolIndex);
    workerPool[i].setType("TypeB");
    return workerPool[poolIndex];
    return null;
    My problem is that they return ok, however. If TypeA has a function called Test1. and TypeB has a function Test6. If I try Worker.Test6 it wont recognise it. Is this just my ignorance? Should both just contain the same methods as Worker and override them?

    Hi, I'm using a factory pattern to return different
    objects depending on whats needed:
    synchronized Worker getWorker(final byte[] request,
    String type) {
    int poolIndex = -1;
    for (int i = 0; i < workerCount; i++) {
    if (workerPool[i] == null) {
    poolIndex = i;
    if (type.equals("TypeA")) {
    workerPool[i] = new
    workerPool[i] = new TypeA(request, poolIndex);
    workerPool.setType("TypeA");
    } else if (type.equals("TypeB")) {
    workerPool[i] = new
    workerPool[i] = new TypeB(request, poolIndex);
    workerPool[i].setType("TypeB");
    return workerPool[poolIndex];
    return null;
    My problem is that they return ok, however. If TypeA
    has a function called Test1. and TypeB has a function
    Test6. If I try Worker.Test6 it wont recognise it. Is
    this just my ignorance? Should both just contain the
    same methods as Worker and override them?
    indeed, the factory pattern is intended to shield the user code from implementation details of the returned interface. It (ie. the user code) MUST NOT know about which actual implementations it receives, otherwise, the factory has no use.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Pattern question CS4...

    when using the preset patterns in cs4 how can i change the colors??

    No problem
    When you drag it back... if you hold down Option/Alt and drop it on top of the old pattern, the swatch will update reflecting your changes, and any artwork that has the swatch applied to it, will also update.

Maybe you are looking for

  • How to dynamic set messageInputText item data type?

    Hi, I have a LOV and other messageInputText items on the page. I need to be able to change the messageInputText item data type based on the value selected from LOV. How can I do that? DD

  • LUKS on RAID 5

    Hey guys. I'm trying to encrypt a 2TB RAID 5. I run the command: cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/md0 After I've entered and confirmed my password, it seems to go for a few moments, and then the whole computer locks up. It cannot

  • Business Connector 4.7 and EDI Module

    Hi all, I want to use the EDI Module offered by SAP for the Business Connector. Unfortunately the SAP offered the zip file only for release 4.6 of Business Connector. Does anyone know if it's even so possible to import the EDI module in Business Conn

  • [Solved] Error upon selecting "base" package during install process

    Hey guys, I got stuck in the install process. the following issue never occured to be before. Upon selecting the base package during install and pressing "OK", i recieve the following error: ERROR: check_is_in needs a non-empty needle as $1 and a hay

  • Attachments in Send Mail step.

    Hi all, My WF has 2 User Decisions as its first 2 starting steps where the user attaches word docs. Problem: Now dont know how to arry forward these attachments to the SEND Mail task. Unable to locate any User Dcsn. step container element to be bound