Help with treemap and other stuff

hi guys..
i m new to this forum..
and this is my first post....so if i act a little naive .....please bare with me.
and if this is not the correct place to post ..i m sorry for that.
i have an assignment to submit....i m getting the whole picture ....but not sure how to go about implementing it.
here it is...
Write an Object Oriented solution to the problem in Java. The solution is to consist of:
A TableIndex class
A TableNavigator Interface
A data row class ....class that i have to create.
An application class to use and test your TableIndex class
The following UML class diagrams show the public methods of the classes. Other methods may be specified. Specify data members, inner classes and interfaces as appropriate.
TableIndex Class
The TableIndex class is an index to a collection of objects. The class is to approximate an index to a data table in memory that consists of a number of rows. To control access to the index a current row is defined that specifies the row that can be accessed. To retrieve a row from the index it must be the current row. The get() method is the only method in TableIndex class that retrieves a row from the index. The current row can be changed explicitly using the methods: previous(), next(), first(), last(), gotoBookmark and find(K); and implicitly using insert(K, V), modify(K, V) and remove().
The TableIndex class is to be implemented using the java API's TreeMap class and must use Generics. The data types K and V below are generic types for the Key and Value (row) respectively. An important aspect of the assignment is using the Java API documentation to understand the TreeMap class.
guys ....can u plz help with the starting bit ..
what should be the opening statement of the class...
public class TableIndex<K , V> .....????
and what should be the treemap declaration..??
TreeMap<K , V> indexTable = new TreeMap<K , V>();...???
i m confused....
can u plz explain to me..

hi mate.....didnt quite get you..
can u plz be a bit more simple in explanation..!!!
i will post the whole question ..so that anyone reading will understand better....
Problem Description
You are to develop an index class and associated classes.
Requirements
Write an Object Oriented solution to the problem in Java. The solution is to consist of:
A TableIndex class
A TableNavigator Interface
A data row class
An application class to use and test your TableIndex class
The following UML class diagrams show the public methods of the classes. Other methods may be specified. Specify data members, inner classes and interfaces as appropriate.
TableIndex Class
The TableIndex class is an index to a collection of objects. The class is to approximate an index to a data table in memory that consists of a number of rows. To control access to the index a current row is defined that specifies the row that can be accessed. To retrieve a row from the index it must be the current row. The get() method is the only method in TableIndex class that retrieves a row from the index. The current row can be changed explicitly using the methods: previous(), next(), first(), last(), gotoBookmark and find(K); and implicitly using insert(K, V), modify(K, V) and remove().
The TableIndex class is to be implemented using the java API's TreeMap class and must use Generics. The data types K and V below are generic types for the Key and Value (row) respectively. An important aspect of the assignment is using the Java API documentation to understand the TreeMap class.
TableIndex
+TableIndex()
+TableIndex(name: String, comp: Comparator)
+getName(): String
+isEmpty(): Boolean
+size(): Integer
+hasPrevious(): Boolean
+hasNext(): Boolean
+previous()
+next()
+first()
+last()
+setBookmark(): Boolean
+clearBookmark()
+gotoBookmark(): Boolean
+contains(key: K): Boolean
+find(key: K): Boolean
+get(): V
+insert(key:K, value: V): Boolean
+modify(value: V): Boolean
+modify(key: K, value: V): Boolean
+remove(): V
+iterator(): Iterator
+equals(obj2: Object): Boolean
+toString(): String
Additional Notes:
The table index has an order defined by the compareTo method of the key's class or by the compare method specified in the class that implements the Comparator interface.
getName(): the name of the index, blank by default.
isEmpty(): returns true if there aren't any rows in the table index
size(): returns the number of rows in the table index
hasPrevious(): returns true if there is a row before the current row.
hasNext(): returns true if there is a row after the current row in sequence.
previous(): if there is a row before the current row, move to the row and make it the new current row.
next() if there is a row after the current row, move to the row and make it the new current row.
first(): if the table isn't empty, move to the first row and make it the new current row.
last(): if the table isn't empty, move to the last row and make it the new current row.
setBookmark(): sets a bookmark at the current row. If the bookmark is successfully set the method returns true. The bookmark is cleared if the TableIndex is empty or the row the bookmark was set on is deleted..
clearBookmark(): sets the bookmark to null, indicating there isn't a bookmark.
gotoBookmark(): if a bookmark has been set, go to the bookmarked row. If successful the book marked row becomes the current row and the method returns true.
contains(K): return true if a row with the key specified exists.
find(K): if a row is found with the specified key, the current row is set to the row found.
get(): returns the current row. Null is returned if there isn't a current row.
insert(K, V): inserts a row (value) with the key specified. The key must not be null and must be unique (not already in the TableIndex). The row (value) must not be null. If the row is successfully inserted true is returned, and the row becomes the current row..
modify(V): change the current row's data to the row (value) specified. The key and the current row key are to remain the same. If successful true is returned.
modify(K, V): change the current row's key and data to the key and row (value) specified. If successful the changed row becomes the new current row. If successful true is returned. Note: this is more difficult than modify(V).
remove(): remove the current row. When a row is deleted the next row (if available) becomes the current row, otherwise if there isn't a next row the previous row becomes the current row, otherwise the table is empty therefore the current row is null.
iterator(): returns an iterator to the rows (values) in the index. The rows are to be retrieved in order. The remove method does not need to be implemented (its method body can be empty)..
the equals method uses the name, and the rows (values) in order when testing for equality.
the toString method should return appropriately formatted data members and the rows (values/data) in the index.
TableNavigator Interface
«interface»
TableNavigator
+isEmpty(): Boolean
+hasPrevious(): Boolean
+hasNext(): Boolean
+previous()
+next()
+first()
+last()
+contains(key: K): Boolean
+find(key: K): Boolean
Additional Notes:
The TableIndex class implements the TableNavigator Interface.
The purpose of the above methods is outlined in the TableIndex class.
Your Data Row Class
You are to include a class of your own to represent a row of data in the TableIndex. This is not to be a class that was covered in other programming subjects. It does not need to be complex but must include a range of data types. This class will be used to test your TableIndex class. The class should have an appropriate name and deal with something of interest to you.
Your Application Class
The application class is to make use of the TableIndex class and your data row class. It is to clearly show how the TableIndex class is used, and in doing so, test it. The class should have an appropriate name. The application class should create two indexes of different key data types. One of the indexes must make use of the Comparator interface to have a key that is in descending order.
Output
Output in the test classes/programs is to go to standard out or a text file. There should be no output from the TableIndex class or your data row class. A GUI interface is NOT required. There is no need to input data from the keyboard or file. Use the Unix script command or write output to a text file (etc) to provide example runs of your test programs.

Similar Messages

  • Help with Guilloches and other things?

    Heya, i've used Illustrator before for a few things, but i'm still quite new to it. Hope you can help.
    Ok so what im trying to do is make bank note from scratch. Dont worry, its for a college project and it'll be an entirely new design so theres no chance of anyone mistaking it for real money (althought I do want it to look real)
    I wanted to include Guilloches in the design. These are the lines found on bank notes to make it harder to counterfeit:
    I've experimented using shapes made of lines and using the blend tool to create multiple lines in between them, but it doesnt give the same effect. Is there a better way to achieve these results?
    The other thing is cross-hatch shading. I want to include my own photo into the design (vain, i know ). Ive also found no way of doing this. Can you help me?
    Thanks

    Sorry, but Illustrator is really not ideally suited to banknote design.
    I designed the current series of Icelandic banknotes so I know all about the problems involved.
    You can make something that "looks" more or less like a banknote, but doing the actual artwork for a banknote is a totally different kettle of fish.
    Illustrator (although a vector application) has pixel-based output (rip), whereas real banknote designs never use pixels, only lines.
    In addition, the colour-banding used in real banknote printing (not gradients as such but specially mixed bands of colour inked onto up to 4 offset plates for each side of the note) makes line work extremely difficult to produce.
    You can do guilloches with blends, repeat rotations and all kinds of distortions, but getting them to "ink" properly in 4 separations using gradated bands of colour is extremely complicated. It will cost you much hard work to produce a passable semblance of a banknote if you use only Illy.
    You mention cross-hatching in a portrait. This again is fiendishly tricky to reproduce in Illustrator because engraved lines in intaglio are not of a constant weight. You can get part of the way using various brush strokes, but frankly I would advise you not to attempt it unless you are prepared to spend several weeks doing the job. It takes a skilled engraver up to three months to do a good portrait (with a burin on a steel plate, a few lines per day). I have always sent photographs or detailed pencil drawings to the engravers. Specialized applications are available that can produce a semblance to hand engraving, but they are really not very good and the outcome invariably involves a lot of manual tweaking. If you are good at drawing it might even be better to do the portrait by hand, but copying the style of engraved lines is very tricky unless done in considerable oversize.
    May I suggest that it is considerably easier to produce colour banding effects using gradients in Photoshop. Copy Illy line work into Photoshop, lock layer transparency and colour with gradients. To do things correctly you will need 4 gradients - one for each offset separation plate - for each side of the note. Calculating the colour range for each plate will prove much more work that you suspect. And remember that each gradient should run the whole width of the note and only horizontally.
    Depending on how real you want your "banknote" to look I suspect you need to study security printing carefully before you embark on this job.

  • Artist Names: Help with "The" and other small words.

    I would like to know how to make my iTunes recognize "The Who" as "Who (The)" but I don't want it to say Who, The in my library. How do I do this?

    You will want to refer to this article in the Apple Knowledge Base which explains the new sorting rules that have been introduced in recent versions of iTunes.
    To workaround it, you will have to make use of the also recently introduced Sorting tab that is described at the bottom of the above-referenced article.
    You can get "The Who" sorted as "Who" by entering Who in the Artist Sort field.
    Information you enter in the Sort fields will not change what is displayed for those items, only how it is sorted.

  • TS2446 If i create a new apple id account on my ipod, will i still have all my music, apps, books and other stuff on my ipod that i downloaded and bought with my old account or will i loose everything; will i be able to still do the updates to those apps?

    If I create a new apple id account on my ipod, will I still have all my music, apps, books and other stuff on my ipod that I downloaded and bought with my old account or will I loose everything; will I be able to still do the updates to those apps?
    I really need help!

    I don't think you understood what I wrote. You don't HAVE to pay for everything if you are happy with using the other account for updates, etc. But if you don't want to do that then you will have to buy new copies of everything for the new account. There's only one purchase item per account, but you can redownload an item in the account many times.
    The idea is this:
    One computer, multiple devices, one Apple ID.
    One user, multiple devices, one Apple ID.
    The basic idea is that each user has an Apple ID under which he/she can manage multiple devices on a single computer.
    Once you step outside of that model you create such problems as not being able to use or update apps purchase under one Apple ID when using a different Apple ID. Or not being able to easily sync one device on more than one computer.

  • I have a problem, my wife has an ipad with photos , emails etc etc, she has recently got herself a new iPad Air, has now been using that for two or more months, more photos (new) more emails and other stuff. Will send next query as running out of room to

    I have a problem, my wife has an ipad with photos , emails etc etc, she has recently got herself a new iPad Air, has now been using that for two or more months, more photos (new) more emails and other stuff. What she wants to do is get all she wants from ipad 1 to new ipad without finishing up with 2 of everything which happen on previous occasion. I realise that she needs to tidy up ipad 1 first and get rid of thousands of emails etc. I need help.
    Thanks kiwihdrider

    Hi yes that works well when the new ipad hasn't been used. Trouble new one has been used for two months or more, has lots photos email etc etc. I am worried that these will go. When we did iPhone thru same process finished up with two of most things pics and emails. The emails alone were over 2 thousand and wife reluctant to delete them all. I would and just sort pics. Any other ideas
    Ta

  • I had to replace my i4s with another one from the apple store.shouldn't i be able to go to the cloud to get all my contact info and other stuff that was stored in the cloud from the first phone?

    i had to replace my i4s phone with another one from the apple store. i need to download all my contact info and other stuff from the cloud to my new phone.i see a screen that says  RESTORE I PHONE   and are you sure you want to restore the iphone to its facory settings?  all of your media and other data will be erased. they i tunes will verify restore with apple. After this you will have the option to restore your contacts and other settins.  The question is will it restore my first phones info?  I am hesitant to delete anything  lol.

    No. If you made your backup to iCloud, iTunes will not restore from an iCloud backup. See:
    iOS: Backing Up and Restoring Data to a New Device

  • My friends put cydia on my ipod and other stuff from it like something who slide your apps differently how can i remove the both, plz help ..???

    My friend put cydia on my ipod and other stuff from it like something who slide your apps differently. How can I remove the both, I really want, plz help ...?

    They hacked it and may have caused damage to your device. Jailbreaking also voids your warranty and support from Apple. To restore to a clean state, restore in Recovery Mode: http://support.apple.com/kb/HT1808

  • Problem with youtube and other video websites

    I have a problem with youtube and other video websites:
    Everything is up to date (flash, FF, my plug ins..) but i keep getting freezes when the video loads. I can hear sound but i can only see the first frame of the video.
    I've reinstalled flash/firefox or tried updating them again for about 4 times now and my cookies/cache has also been errased which i usually don't do. If i enter FF's safe mode it also freezes.
    I hope someone could help out, i've searched for answer on google before and tried everything i saw but it didn't helped.
    grts,
    agrash

    Hmm, so that person had a conflicting plug in.
    Problem is that whenever i enter firefoxes safe mode which disables every plug in, i still have the youtube freeze/crash

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • All of a sudden, new tabs have started opening up (in Firefox) advertising games and other stuff. Any idea's of what is going on here?

    All of a sudden, new tabs have started opening up (in Firefox) advertising games and other stuff. Any idea's of what is going on here?

    Try scanning for malware using the removal tools listed near the bottom of the [[Troubleshoot Firefox issues caused by malware]] article.
    It might also help if you could copy and paste troubleshooting information into your reply. See [[Use the Troubleshooting Information page to help fix Firefox issues]] for details.

  • HT1491 My iTunes only show: iTunes U and category , no music and books and other stuffs.

    My iTunes only show: iTunes U and category , no music and books and other stuffs. Is it because of my Chinese ID?

    You can only purchase content from the store where your credit card is registered - and that credit card must be registered to a valid address in that country. I am afraid that you are restricted in what you can legally purchase from Apple.
    Sometimes the restiction of content has to do with licensing rights and sometimes governments will restrict the content that Apple is allowed to sell in their countries.

  • If i upgrade to mountain lion (from lion), will i need to reinstall my windows VM? and what about my apps and other stuff? will those need to be reinstalled too?

    if i upgrade to mountain lion (from lion), will i need to reinstall my windows VM? and what about my apps and other stuff? will those need to be reinstalled too?

    I started off with problems about being in the wrong region and now  have Plug- in Failure
    I am trying to access Setanta Sports Australia which requires
    Microsoft Silverlight and was already pre-installed on a Macbook Pro Retina 2.5 ghz Intel core i5 with Mountain Lion 2.8.3
    I have these different PlugIns active :
    file://localhost/Library/Internet%20Plug-Ins/DivXBrowserPlugin.plugin/
    file://localhost/Library/Internet%20Plug-Ins/Flash%20Player.plugin/
    file://localhost/Library/Internet%20Plug-Ins/JavaAppletPlugin.plugin/
    file://localhost/Library/Internet%20Plug-Ins/QuickTime%20Plugin.plugin/
    file://localhost/Library/Internet%20Plug-Ins/Silverlight.plugin/

  • How to backup all my Firefox "Options", not the bookmarks and other stuff.

    Under Tools, Options there are lot of settings that are lost when I have to reinstall. How to backup all my Firefox "Options", not the bookmarks and other stuff.

    Hi, please see [[Profiles - Where Firefox stores your bookmarks, passwords and other user data]].
    Also - [[Uninstall Firefox from your computer]].
    Hope that helps.

  • Help with count and sum query

    Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
    SELECT 'ST' LEDGER,
    CASE
    WHEN c.Category = 'E' THEN 'Headcount Exempt'
    ELSE 'Headcount Non-Exempt'
    END
    ACCOUNTS,
    CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
    'MARCH_12' AS PERIOD,
    COUNT (a.empl_id) head_count
    FROM essbase.employee_pubinfo a
    LEFT OUTER JOIN MMS_DIST_COPY b
    ON a.cost_ctr = TRIM (b.bu)
    INNER JOIN MMS_GL_PAY_GROUPS c
    ON a.pay_group = c.group_code
    WHERE a.employee_status IN ('A', 'L', 'P', 'S')
    AND FISCAL_YEAR = '2012'
    AND FISCAL_MONTH = 'MARCH'
    GROUP BY a.company,
    b.district,
    a.cost_ctr,
    c.category,
    a.fiscal_month,
    a.fiscal_year;
    which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    user610131 wrote:
    ... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
    I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
    You may want both a sub-query and a different GROUP BY clause. For example:
    WITH    got_group_by_columns     AS
         SELECT  a.empl_id
         ,     CASE
                        WHEN  c.category = 'E'
                  THEN  'Headcount Exempt'
                        ELSE  'Headcount Non-Exempt'
                END          AS accounts
         ,       CASE
                        WHEN a.company = 'ZEE'
                        THEN 'OH'
                        ELSE 'NA'
                END          AS market
         FROM              essbase.employee_pubinfo a
         LEFT OUTER JOIN  mms_dist_copy             b  ON   a.cost_ctr     = TRIM (b.bu)
         INNER JOIN       mms_gl_pay_groups        c  ON   a.pay_group      = c.group_code
         WHERE     a.employee_status     IN ('A', 'L', 'P', 'S')
         AND        fiscal_year           = '2012'
         AND        fiscal_month          = 'MARCH'
    SELECT    'ST'               AS ledger
    ,       accounts
    ,       market
    ,       'MARCH_12'          AS period
    ,       COUNT (empl_id)       AS head_count
    FROM       got_group_by_columns
    GROUP BY  accounts
    ,            market
    ;But that's just a wild guess.
    You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
    Edited by: Frank Kulash on Apr 4, 2012 5:31 PM

  • MOVED: [Athlon64] Need Help with X64 and Promise 20378

    This topic has been moved to Operating Systems.
    [Athlon64] Need Help with X64 and Promise 20378

    I'm moving this the the Administration Forum.  It seems more apporpiate there.

Maybe you are looking for