Help in defining the datastructures for a problem
Hi there,
I am a newbie to Java programming and would like to get some feedback on how I can proceed with a problem I have at hand. I have to maintain the objects information in the memory for a SITE. SITE has side id, site name, and a site will be related to devices (one or more devices). Devices will have information such as is it alive what is the frequency of its alive signal coming to the server. These information have to be in-memory all the time so that at any point of time I would have to pick the device alive signal and process the neccesary tasks such as send an email to user whose device is not working. (email information for each device as well will be maintained in the memory). What kind of data structure can I use to acheive this scanerio. I was thinking of HASHTABLE but I am unable to get any samples that can explain the HASHTABLE usage. If anyone could help me in getting the right information it will be really helpful.
Thanking you in advance
regards
John
Hi,
This solution is based on few assumptions.
Hope u know abt a value object.
If u dont know, Value object is just a java class which contains few properties and getter and setter methods for getting and setting the values of properties. In ur case the value object may look like this.
public class Device {
private boolean alive;
public void setAlive(boolean alive) {
this.alive = alive;
public boolean getAlive() {
return alive;
and so on for all the properties u need to check for devices.
--> I think there will be only 1 device of a particular type. i.e., we will not be using 2 instances of the same device. Then for each device use a value object and set it properties and save it in HashMap with a name.
For example:
Let the device be Mortor(Just an example)
Device d = new Device();
d.setAlive(true);
and set all other properties.
Then put the object into HashMap as follows.
HashMap map = new HashMap();
map.put("Motor", d);
in the same way u can keep all ur devices with a name and value pair.
When ever u want to get that device, u can use as follows
Device d = (Device)map.get("Motor");
and u can work on the device "d" using getters.
in case if we want to use 2 instances of the same device then add the 2 instances to ArrayList and u can retrieve from arraylist when ever u want.
Hope I am clear
Regards
Karthik
Similar Messages
-
Help define the requirements for an Oracle Spatial management tool
Hi,
We are developing a tool that, we hope, will be indispensable for all Oracle Spatial and Locator dbas/users. We've released version 1.0, but we need your help to define the requirements for the next version.
What features would you like to have in a management tool for your spatial databases?
The features we've got so far:
1. Viewing of vector data in a map + attributes
2. Loading from shapefiles
3. Exporting to shapefiles
4. Validating metadata, indexes and spatial data.
We are adding editing of vectors in the next version - basic stuff for add, update and delete.
But there must be a lot more. What do you find difficult to do in Oracle Spatial/Locator? What would you like in a tool such as this?
Any feedback either to myself or the forum is much appreciated.
cheers,
Andrew
[email protected]
PS If you like to have a look at what we have done so far, go to http://www.geometryit.com/products/spatialConsole.phpAndrew knows what I have asked for but for others to think about and to start
the ball rolling, here's what they are:
1. Ability to enter own SQL commands but with PARAMETERS for attributes
and shapes as in the following examples:
SELECT ...
FROM my_spatial_table a
WHERE a.ATTRIBUTE = :attr
AND MDSYS.SDO_RELATE(a.shape,:polygon,'mask=anyinteract') = 'TRUE'
When executed the attribute value is asked for via a input box (data type?)
and the user is asked to define the SDO_GEOMETRY for the :polgygon parameter via mouse clicks on the screen.
Similarly, this would work for INSERT, UPDATE and DELETE...
INSERT INTO my_spatial_table (shape) values(:polygon)
The data type of an attribute parameter could be determined in two ways:
a) By querying the Oracle catalog;
b) By using a "PARAMETERS" command before the query as follows
PARAMETERS name type [(size)] [, name type [(size)] ...]
The PARAMETERS declaration has these parts:
name The name of the parameter.
type The type of the parameter.
size The size of the parameter in characters or bytes.
2. When executing an SQL SELECT statement I would like the tool
to suggest the HINTS that are needed to improve performance.
3. Following on from 2, I would like to Tick an option that would return the
EXPLAIN PLAN that the query optimizer used when executing my query.
4. The tool has to support ALL Oracle's spatial vector data types.
5. It would be nice to be able to work with GeoRasters. Since Spatial Console
imports/exports shapefiles why not the same for rasters. However, the problem
with supporting foreign data formats is WHERE DO YOU STOP!!!!!
6. You could allow for the styling of the Spatial Console to be stored in the MapViewer catalogs or use the MapViewer catalogs when styling an Sdo_Geometry if it exists (I note that your tool extracts the SDO_METADATA
why not the MapViewer metadata as well)?
regards
S. -
How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?
How to let the user define the colors for each plots in the graph (I
use LabVIEW 7)?Hi,
Take a look at this example, it uses property nodes to select tha
active plot and then changes the color of that plot.
If you want to make the number of plots dynamic you could use a for
loop and an array of color boxes.
I hope this helps.
Regards,
Juan Carlos
N.I.
Attachments:
Changing_plot_color.vi 38 KB -
How to define the texts for UI element Dropdownlistbykey?
Hi everyone,
I don't know how to define the texts for Dropdownlistbykey. It seems that Dropdownlistbykey has an attribute "selected key", but where can I bind the texts I want to display when user clicks the downwards
arrow?
Thanks in advance.hi,
you can use this code :
method WDDOINIT .
DATA : node_info TYPE REF TO if_wd_context_node_info,
value1 TYPE wdy_key_value,
set TYPE wdy_key_value_table,
k1 type string value 'M',
v1 type string value 'MAGO',
k2 type string value 'S',
v2 type string value 'Saurav'.
value1-key = k1.
value1-value = v1.
APPEND value1 to set.
value1-key = k2.
value1-value = v2.
APPEND value1 to set.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node('FOR_DROP').
node_info->set_attribute_value_set( name = 'DROP_KEY' value_set = set ).
I hope it helps.
Thanx. -
Please help me with the digital signature validation problem?
Please help me with the digital signature validation problem?
Hi
Execute the program in the Debuggin mode.
In the Debugger Window
Select Breakpoint -> Break point at -> Breakpoint at source code Menu Item and enter the details of the program/include/line no..
Activate the System Debugger On from the Settings Menu.
Hope this would help you.
Murthy
Edited by: Kalyanam Seetha Rama Murthy on Jul 18, 2008 7:20 AM -
Why doesn't my iPhone 4 have an 'Internet tethering' options? Is it carrier related or iOs related? Please help me find the solution for this. thanx
Personal Hot spot
http://support.apple.com/kb/HT3574
Understanding
http://support.apple.com/kb/HT4517
Trouble Shooting
http://support.apple.com/kb/TS2756 -
if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??
actually i found out how to fix it
1 sign out of apple account
2 close down passbook app
3 change year to 2013
4 reopen passbook and sign in at the button with your apple ID
5 change the time to auto update and it should work from now on.
this worked for me let me know if it work for you:) -
I RECIVED AN EMAIL FROM ADOBE AS : As good will gesture, we can help you with the upgrade for PSE 13. We would request you to place the order for Adobe Photoshop Elements 13 as an upgrade and then we will provide you the full version serial number for the same product against the new upgrade order" IS THIS UPGRADE FREE AND WHAT SHOULD I DO, HOW CAN I HAVE THIS UPGRADE?
Compare with on-line stores. The full version is often cheaper than Adobe's upgrade price.
See this example from Amazon, but check pricing in your own region.
http://www.amazon.com/gp/product/B00N4OLCRO/ref=s9_simh_gw_p65_d4_i2?pf_rd_m=ATVPDKIKX0DER &pf_rd_s=desktop-1&pf_rd_r=0F1GED9546928YP3PHC0&pf_rd_t=36701&pf_rd_p=1970559082&pf_rd_i=d esktop -
Deactivation of Photoshop CS3 leads to an error 1914:1 what ist the solution for this problem
hello
I try to deactivate photoshop CS3 on my win XP system. When I try this I get the error code 1914:1 . This says there are no activations. But when I try to activate it on the new WIN 7 system
I get the message to many activations. What is the soltion for this problem?Contact support by web chat.
Mylenium -
@I have my Adobe ID and the Adobe Digital Editions. But when I download an EPUB-ebook, I don´t see the ebook or "My Digital Editions-Bibliothek".What is the solution for this problem?
how can we solve the problem?
I have my adob.e ID, downloaded Adobe Digital Editions.
Whren I download EPUB-ebooks and want to use
Digital Editions, nothing happens and appears!??
Please give me a short feedback and help -
Help to find the driver for Satellite 1800-412
Kind time of day dear administrators of a forum and participants, help to find the driver for toshiba satellte s1800-412, beforehand thanks.
If there is an opportunity send on a mail [email protected]Hi
This is a user to user forum dude ;)
If you want accept an advice from a simply common Toshiba notebook user then got to this site:
http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp?service=EU#
Choose Archive Satellite Archive Satellite 18** - Satellite 1800-412
Enjoy ;) -
Basic parameters to define the grouping for the Items and the BPs in SAPB1
Dear Friends,
What should be the basic parameters to define the grouping for the Items and the Business partners in SAP B1?
What will be the case when the client wants to classify the sales revenues various categories?Hi
What should be the basic parameters to define the grouping for the Items and the Business partners in SAP B1?
For items:
Raw Material.
Capital Goods
Finished Item
Semi Finished Item.
Conusmables
Stationary .........etc
or .
Metal.
Rubber
Wooden.....etc
Bsuiness Partner
Foreign or domestic.
Region wise e.g South,North,East,West.
State wise e.g MH,KT,DELHI,GOA....ETC
What will be the case when the client wants to classify the sales revenues various categories?
SIMILARLY
Foreign Revenue, Doomestic Revenue, Region Wise Revenue, State wise, Or Territory wise.......etc
I hope this clarifies you
Ashish Gupte -
How to define the format for numeric field ?
Hello
I have Amount field and I would to define the format to be ( XX.XXX,000 )
How can I do this ??
I'm new in ADF and need your help ..
rgrds
Edited by: moh3li_pal on Mar 1, 2010 8:05 AMi have the same problem i try with pattern "###,###.##" but the application adf is the inverse "###.###,##" , this a bug or the pattern errornious.??Hi Joaquin. This is not a bug, although this is a little difficult to explain without face-to-face communication :D The confusing thing here is the difference between the 'special pattern characters' and actual output characters (which are chosen based on your locale).
If you check the Java DecimalFormat class (which provides the rules for formatting) you'll see the following:
Using , in the pattern = Grouping separator
Using . in the pattern = Decimal separator or monetary decimal separator
According to your locale, the grouping separator is '.' and the decimal separator is ','. So the pattern you have specified does dictate that you should get the result you have found.
You either need to change your locale settings (best option) or cheat by switching the , and . in your pattern. -
Hi, I'm hoping someone can help me find a solution to my problem.
When a backup is attempted, it starts off as if it's working, then stops and the following error message appears: "iTunes could not backup iPhone because the iPhone disconnected". But, the iPhone doesn't really disconnect! It must be some type of internal glitch.
The iPhone is a 3GS and I have mostly pictures and contacts, two songs, a total of 33 apps. The iOS is updated (6.1.6). I do not know if this phone was ever jailbroke. I have been able to backup this phone before, but cannot now. The last backup was 9/21/13, it is now 3/2/14.
Sorry if there is too much info, or not the correct info to find a solution!
Also, I must say that although I am not a tekkie, I've seen many different types of various programs and I find that iTunes is not very intuitive...don't mean to hurt anyone's feelings, just my humble opinion.
Thank You,
Camp917Hey Lawrence,
A big THANK YOU!! to you! Your suggestions worked!
Before I changed USB ports (more on that in a sec...), I employed one of your suggestions that you gave to someone else with the same problem...and that was to clean the connector on the bottom of the phone with a soft dry tooth brush. I couldn't believe the amount of lint that came out! Especially what was found in either end...had to do some very careful picking. (Almost enough lint to knit a small sweater!!)
Changing the USB port was the second and final step required for a successful backup. My computer is a laptop, and I did have a USB Bluetooth adapter (for another device) installed. I removed the adapter, plugged the iPhone into that USB port, crossed my fingers...and it worked!!!
Now if I can figure out the rest of this darn program, I might upgrade to a new iPhone!
Again, thank you very much Lawrence!
Rich -
Need help in defining the Transaction Variant using MM02
Hi Experts,
I had a requirement that I need to disable the <b>Purchase order Text</b> tab in MM02 T-code,I tried using Transaction Variant(SHDO) ,but I unable to disable the PO text Custom Control.Iff you have any info Please share it with me on [email protected]
Apriciated your contributions by Assinging the points.
Thanks,
Sridhar.Hi Nani,
The transaction used to create transaction variant is SHD0.
Using this you can change the screens, for example is you want certain fields to get a default value in XD03 / MM03 etc you can do so with the help of transaction variants.
Also you can go thru this links for more help .... please go thru and I believe that you problem will be solved....
Check the following threads:
Re: How to create a transaction variant
Transaction variant
Regards,
Jayant
Please award if helpful
Message was edited by:
JAYANT KUMAR
Maybe you are looking for
-
Key property on base class without hosting relationship which is defined on an inherited class
Hello, I have a BaseClass which is marked Abstract=true and Hosted=false. Then I have an InheritedClass which has the BaseClass as its Base. This InheritedClass is Hosted=true while being Abstract=false. You know, the BaseClass has some common attrib
-
HT201401 My phone won't lock or go into sleep mode when answering calls
My phone won't lock or go into sleep mode when making or receiving calls. Consequently I keep activating the mute or loud speaker buttons with my cheek. Can anyone help please??
-
Business Partner (0BPARTNER) Relationships missing in Hierachy !!
Hi, I am working on 0BPARTNER infoobject. I loaded data into 0BP_REL ODS which gets relationship data from CRM. 0BPARTNER gets this relationship data thru 0BP_REL. But am nt seeing the relationship data when i load the hierarchy (0bpartner_hier). Und
-
Aperture: from trial to full
Hi all i got a free trial version of Aperture and now would like to migrate to a full version via Mac AppStore. What should be my list of actions? Delete trial or leave it and install over it? How should i manage a library in a trial in case i want t
-
Does anyone have trouble with the iPad booting you off of the internet? I will be in the middle of something (i.e. Facebook), and it boots me out and I have to sign in again.