saeid jamali

Ranch Hand
+ Follow
since Nov 11, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
41
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by saeid jamali

I have that part covered now but the only issue is when these two codes are executed the arrayList  for 6 elements will look like this.
[min=null, max=80]
[min=null, max=70]
[min=null, max=60]
[min=30, max=null]
[min=20, max=null]
[min=15, max=null]

I want it to look like

[min=30, max=80]
[min=20, max=70]
[min=15, max=60]
2 years ago
So The current method I'm using Jfreechart is to have an arraylist with getters and setters in the chart class and in the user interface class I'm doing this

So I create an object and I set Arraylists to whatever lists I want. Now my question is that is there any way that instead of having a separated arraylist in chart class and setting it using setters I can directly use my Arraylist in chart class so I make my list instance in the chart class and use it there. I tried it but the chart came up as empty.
2 years ago
So as you said instead of adding the each sensor reading to a new arralist I'm trying to keep in one arraylist and call them using getter but I have a big problem with nulls. for example insteadof line 3 and 9 I'm trying to add the creat an object and add the data to statics lists

the issue is in the first loop there is no data getTempmin so it will be null in the Arraylist and in the second loop there is no data for getTempmax so it will be null in the ArrayList and when I want to use the list in a chart it won't work because of the huge amount of the null elements.
I tried to remove the null and I tried a few ways which didn't work and still got null in my output and I thought maybe it's a better idea if I prevent the null in the first place.
So is there any efficient wat to avoid null in the list?
I tried to use if the element is not null add it to the chart but what if it is null then there will be no data for that specific time so it wasn't a good way.
2 years ago

Carey Brown wrote:So, do you plan on passing a list that only contains readings for a single hour to your Max() method?


My plan is to parse a list that contains like temperature only based on changes in hour data
2 years ago
I don't need thosevalues per hour. all I need at this point is to calculate the average, min an max value of the temp per hour.
2 years ago

Carey Brown wrote:

saeid jamali wrote:

Carey Brown wrote:

saeid jamali wrote:I wrote my own method to find the hour. I have a variable in Sensor class which gets the hour value from a method


I assume the method is relying on one of: millis, stamp, or dateTime to compute the hour.


datetime


So, do you really need to keep millis and stamp around? If so, what will they be used for?


just printing their values with no calculation.
2 years ago

Carey Brown wrote:

saeid jamali wrote:I wrote my own method to find the hour. I have a variable in Sensor class which gets the hour value from a method


I assume the method is relying on one of: millis, stamp, or dateTime to compute the hour.


datetime
2 years ago
I wrote my own method to find the hour. I have a variable in Sensor class which gets the hour value from a method
2 years ago

Carey Brown wrote:

saeid jamali wrote:


No, what I'm saying is have a LocalDateTime field instead of millis, stamp, and datetime.


They are different data
2 years ago
So are you saying that I can't find the maximum value per hour because of the way I'm parsing datetime? what is the way of having a method that finds max value per hour?
2 years ago
So considering all of these. is there any way I can use that code as a method separate from my user interface?
2 years ago

Carey Brown wrote:Seeing Sensor code helps.

Why are all the data types "String"?
Why isn't "millis" a "long", for instance?
"millis", "stamp", and "dateTime" seems to be different formats of date and time. If this is the case then there should only be one variable to hold date-time.

You should provide a constructor that sets all the fields and do away with the setters.

public static List<Sensor> findMaxPerHour(List<Double> array) {
Should take a List<Sensor> as an argument, not List<Double>. A static utility method should get all of its data from arguments and not rely on static data from other classes.


I'm reading three different file format and some of them like csv needs to read variable as string and then I parse them to another datatype after splitting them. I'm using setters in other classes which are my file readers.
2 years ago
My time format is like 2010/5/4 21:57:34 so I have to read the file as string and split it again and again until I get to ours only as I need only the hour and I added it to an arraylist that holds only hour without date and minutes/seconds
2 years ago

Carey Brown wrote:I think you are headed down the wrong path as others have mentioned. You need a class that holds a time and a temperature. Example:


I have them in my Sensor class

2 years ago