Piet Souris wrote:Of course that will work, but what troubles me is that from the code you supplied I'm afraid there is something wrong with the order in which you let things happen.
You are creating subtitle as an instance of Subtitle, as I said in my previous reply, that is oke. But on the next line, you create an ArrayList that is supposed to hold all these Subtitle instances! Normally, this list should be there before creating any sublist at all.
Piet Souris wrote:What is 'saveSubs'? I assume it is the list of inputlines-to-be-split, but the code we supplied was meant to send each inputline directly to the parse-method of the Subtitle class. And next: the parse method is a static method of the Subtitle class. What you are now doing is invoke the parse method via the subtitle instance. Although that should also work, it requires that you have this instance in the first place.
Piet Souris wrote:You see, your code should work in principle, but it is presented in snippets and so it is hard for us to judge if the order of things are correct. Now, we know you don't want to publish your full code, for good reasons, but it means that you yourself must look very carefull if your code indeed does what it should do. So, to sum up:
1) read an inputline
2) if that line is after the line containing 'Duration'(see topic 1) send that line to the parse method of the Subtitle class, using your working regexes there to get the reuired fields
3) save the returned Subtitle instance to you Subtitle-list
4) and, what has not yet come up, use your list to get the subtitles to show up in time!
Liutauras Vilda wrote:These were just dummy ideas to visualise concept.
It can be confusing, and probably it is, but that is because we talk about the things we don't see. I'm talking about the things what's in my head only, you are talking about the things which are in your head only, and we don't share any indirectly tangible asset (code).
So yeah, you are talking about the shoes, I'm about the barrels That's the joke, to give visual imagination how difficult sometimes can be to discuss about the things on forums.
Trent, buddy, we are not going to get anywhere with this. Your concern is Turnitin, that's understandable, but then you need to work out yourself somehow.
If I were you, and would know that I need to catch up with my course material, I'd just share my code, I'd do my best to take advices in order to finish project, UNDERSTAND IT, and wouldn't worry about the submission - that's because you have a backlog of understanding (reasons are known for you probably).
Point is to LEARN and UNDERSTAND. Not to get the MARK. Mark is the result of the mentioned first two. If you look for a job, much more important is UNDERSTAND. So is your call what you want to achieve here.
Piet Souris wrote:Don't worry. Norm is busy interrogating your regexes, maybe these are not as working as you thought they would be. So, after all the wise words from Liutauras and me, help Norm answering his questions. But to help him with that, and to fullfill our last 200 replies requests: show us some real input lines, with faked input fields if you like, together with the regexes you use now? It would help us enormously.
Liutauras Vilda wrote:Wait.
You said lines differ in terms of structure/layout. You weren't precise when you said that back then, or you didn't reflect these in the examples you showed us now?
Piet Souris wrote:Hmm... the three regexes worked for me as they should. In the Subtitle class, I used
and in the parse method
Note that for the duration to work, I had to remove the square brackets.
Piet Souris wrote:Yes, but it is not so that we don't believe you, it is just that we believe ourselves more...
So, two possible culprits left: somewhere in the parse method, or somewhere else in the Subtitle class, there is something wrong, or there where you send the input line to the parse method, something goes wrong, perhaps in the part where you receive the new Subtitle Instance. Put as many println's in your code, so that can follow everything that the code is doing, and if you have a debugger with a single stepper (most IDE's have one) that would also be ideal.
Piet Souris wrote:No, never seen that message. Can you post the relevant lines of code where that message is generated?