How can i convert the object to class~~~????

recently i develop UML drawing tool for drawing UML diagram, i now design a program structure. now i have already defined many classes that represent each shape in UML. each class stores data of the related shape. then i use a vector to store all shape as follow;
Vector shape = new Vector();
shape.addElement(useCase); \\useCase is a Class i defined
shape.addElement(actor);\\actor is a Class i defined
now i want to use all shape's methods stored in the vector before how can i do that in general ways?
i don't want to code like this;
Object o = shape.elementAt(a);
if (o instanceof UseCase)
if (o instanceof Actor)
because i have many classed!! can u all professional help me? i am just a beginer of java programming student

Sounds like you need to use an inheritance structure...
Setup a generic class that contains methods (probably blank) which each class (such as actor, useCase) will inherit from. Then make actor/useCase inherit from this base class and provide specific code in each of the general methods.
Then when you retrieve your object from the class, you can cast it as your generic class and access the general methods without caring what the actual class is.
Eg. Basic class "shape". has empty methods "draw" and "setPosition". Class "circle" and "square" both extend "shape" and provide specific implementations of setPosition and draw methods. You can then cast them as class type shape and do draw() and setPosition methods without caring about what type the object actually is.

Similar Messages

  • How can i convert an object to stream of chars or bytes?

    how can i convert an object to stream of chars or bytes?

    One way is the serialization mechanism. There are examples and explanations of it in the Java tutorial: http://java.sun.com/docs/books/tutorial/essential/io/serialization.html

  • How can I convert the variable expression stored as string back to variable expression

    How can I convert the variable expression stored as string back to variable expression?
    I am storing the expression enterd in the TSExpresssionEditControl as simple string and want to convert back to expression since I want to get the data type of that expression.

    pritam,
    I'm not sure what you're trying to do exactly. If you are trying to get the value of a variable and you only have the name of value in a string, then you can use Evaluate() to get its value. If you want the data type, my advise is to use the GetPropertyObject() API method and just pass in the loop up string. Then you'll have a handle to the data object and then proceed from there.
    Regards,
    Song D
    Application Engineer
    National Instrument
    Regards,
    Song Du
    Systems Software
    National Instruments R&D

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • How can I convert the ringtone (m4r file) I made into an mp3 file on itunes?

    How can I convert the ringtone (m4r file) that I made into an mp3 file on iTunes? I want to put it on a CD, but I can't figure out how to convert it. I didn't buy it, I made it by converting a YouTube video into an mp3 (I wanted to get the little song in the video for a ringtone.) I'm not sure what to do. 

    Hello ed2345,
    Thanks for the help, but this is not the problem.
    It's hard to describe the problem, but I'll try it again, this time with pictures.
    I was left with the following folders in the iTunes Downloads folder.
    http://www.picfront.org/d/7yb3
    These TMP Folders have a download.m4a and a Info.plist file.
    After moving the audio files in iTunes a bit I get this.
    http://www.picfront.org/d/7yb2
    As you can see no other Information for the download.m4a than the length.
    That's how the .m4p file looks like
    http://www.picfront.org/d/7yb1
    And this is how the same .m4a file currently looks
    http://www.picfront.org/d/7yb0
    Like I said, I could edit all these download.m4a files by myself but that would leave some information out.
    Note: Sorry, I hope the links do not spam you with annoying ads. I don't get any but I was told that there can be some annoying one.

  • How can i convert the HTML information in XML form to a PDF?

    Hi does any body know how can i convert the content of an HTML field in a XML Form in a regular text to include in a PDF in a Java program?

    Hi ,
    On the tool bar you have an option "Browser" which is next to "HTML Editor" .
    You know that for using these elements wo have to map them with Data Schema.
    Step by step
    1. In data Model Under Data Schema Add a child and name it Read_More.
    2. In the left hand corner ,click on tab Type and from the drop down select "rid"
    3.Click on the "Browser" from the toolbar (as told earlier) and drag and drop it on the form.
    4. Drag the Data schema which u have made(Read_more) and drop it on the browser on form. On right hand side u will se the mapping done.
    5.Click on the "Browser" which is there in the form and on the right hand side of the form u will see the property window.
    6.In property window change the value of action property to "Item Entry point"
    7. Repeat step 3 and 4 in Render and show form but using "label" nad not browser.
    Do not forget to add Save button in Edit Form.
    This will solve your problem.
    PS:Rewards Point Please.
    Regards,
    Naveen Gupta

  • I have a 2 page PDF (portrait format), how can I convert the format to landscape?

    I have a 2 page (portaait format) PDF file how can I convert the PDF file into landscape format before I change it to XL?

    Hi jsremick,
    To change the page orientation of a PDF, you need to use Acrobat. (Reader allows you to rotate the page view, but not the pages  themselves).
    If you don't have Acrobat, feel free to give it a try. You can download the free 30-day trial from http://www.adobe.com/products/acrobat.html.
    Best,
    Sara

  • How can I convert the volume directory into a single file installer?

    How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.

    On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
    Are you choosing the second option (self-extracting Zip file for software installation)?
    I have a word file that I created to help me remember - is there anyway to email it to you?

  • How can i convert the firefox-history-timestamp in places.sqlite into a normal date format? The firefox-timestamp is not equivalent to the unix-timestamp, that's why I ask. I could not find a conversion function. Does anyone know something about this?

    As I opened the places.sqlite with an sqlite-editor I found out that firefox saves the last_visit_date via a timestamp which is 16 digits long. I realized that the first 10 digits are similar to the corresponding unix-timestamp but not equal. So.. how can i convert the firefox-timestamp into a normal date? Or into the corresponding unix-timestamp?

    Write a bash script or 'C' program to change the date format and then use the sql update function to receive the stdio output 'where date_field='embeded date value'.

  • How can I convert the ITHMB photo files to PC readable format like JPEG?

    How can I convert the ITHMB photo files on my new Iphone 4s to a PC readable format like JPEG

    Look at the link and follow instructions to convert the file taken from a different thread in this forum:
    https://discussions.apple.com/thread/2640386?start=0&tstart=0

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • How can i convert the quantity of one unit to other unit in BI 7?

    Hi ,
    I have developed an RFC function module in SAP BW (BI 7.0).
    For this function module I have to populate material  number and  Quantity required and UNIT.Every thing working good. If the user forgets to enter unit  or enters other unit  where Quantity in ODS is not mentioned in terms of that unit.WE have to Convert the Quantity requested into the Qunantity that exist in ODS or DATA BASE  based on the unit of measure .
    Please suggest me how can I convert the UNIT of measure of quantity?
    Thanks,
    Suresh.

    I have to do this with conversion table /BIO/PMAT_UNIT.
    IN THIS TABLE I DON'T KNOW HOW CAN I CONVERT?
    REGARDS,
    SURESH.

  • How can I convert the rulers on the page layout from picas to inches?

    How can I convert the rulers on the page layout from picas to inches?
    I am creating a print document - the page setup seems to automatically convert from inches back to picas. When I go to the tutorial on creating a document, however, the tutorial shows dimensions in inches. I assume there is some kind of preferences setting but I have not been able to find it.

    In the Online Help:
    InDesign Help | Rulers and measurement units
    From this forum:
    CS6 New Document - Units and Increments - Ruler Units Defaulting Back to Picas
    InDesign CS5.5 won't respect Units Preference
    InDesign Page Margins measured in "P"??? What?
    starting a new doc in InDesign
    Elsewhere:
    http://indesignsecrets.com/change-measurement-systems-on-the-fly.php

  • How can I Serialize the Object of org.apache.xalan.transformer.TransformerI

    Teachers:
    How can I Serialize the Object of org.apache.xalan.transformer.TransformerImpl.

    org.apache.xalan.transformer.TransformerImpl doesn't appear to be serializable... what do you try to achieve?

  • How can I convert the attribut lastLogon ...

    Hi,
    How can I convert the attribut lastLogon on an Active
    Directory Microsoft?
    Attributes ar = ctx.getAttributes(dn, attrs);
    if (ar != null) {
    for (int i=0; i<attrs.length; i++) {
    Attribute attr = ar.get(attrs);
    if (attr != null) {
    String values="";
    for ( Enumeration vals=attr.getAll();
    vals.hasMoreElements(); ) {
    values += vals.nextElement();
    if ( vals.hasMoreElements() )
    values += "\t";
    entry += SRV.SEPARATOR + values;
    When I take the value of the restrained attribut of the
    enumeration how I make convert it for example in a date ?
    I am using Windows2000 Advanced server.
    An example of lastLogon attribue is "126949578544450976".
    Any help is greatly appreciated.
    R.F.

    It looks to be the same format at accountExpires.
    If so, your in luck, I worked that one out back in January:
    http://forum.java.sun.com/thread.jsp?forum=51&thread=346718

Maybe you are looking for

  • The latest Divx 7 + Mac OS 10.5.8 ? DOESN'T WORK! At least for me...

    I already posted this on DIVX LABS, without getting ANY help, also on Macrumors, without getting ANY help.... no I hope you guys here can help me Hello, I hope somebody can help me here since I didn't find help on that topic somewhere.... I downloade

  • Raw files not reading

    i was downloading my raw files from canon mark II and importing into Lightroom 4, i got half of them loaded but the rest didn't load bc it said it couldn't read the files.  and they say zero bytes and i can't open them or see them in my external hard

  • Cover Flow displays generic icon only for small JPEG files

    I recently used the excellent CocoThumbX to strip off all the Adobe preview icons from my Photoshop-created images (a mixture of JPEG, TIFF, and PSD files). That neatly solved the low-res "fuzzy" Cover Flow thumbnail problem lots of users have compla

  • Printing Regular Envelope

    I am used to Publisher, and pages is difficult for me to make an envelope. I created the custom setting for a regular envelope 3 5/8 X 6.5 inches. But I cannot get it to orient right when I am typing. I tried the landscape route on the hp6122 deskjet

  • Need Help Regarding Deletion(Text area)

    Hi everyone, Can anyone tell me how to use delete() method to delete a text written in the text area? I have it as a menu item, i have added an action listener for that and a shortcut key for the same on backspace. But i am not able to get it worked.