D
Deniz Dogan
Hello.
I am currently working on a small project (as a hobby) and part of it is
having a JTable with five columns (no need to know more about the actual
columns than the fact that there are five of them). What it's supposed
to show is information from two different text files, let's call them
original.txt and translation.txt on separate columns. Both text files
are formatted as such:
//----------------------------
The text files are separated into paragraphs,
such as this one.
There may or may not be multiple rows right next to each other,
and there is no way of knowing how many rows there are before
a new empty line (the end of a paragraph).
Both of the files have this format.
Both the files have the same amount of paragraphs.
//----------------------------
What I need to do is capture each so called paragraph of each file into
separate Strings, where I replace '\n' with '|' and that I add into the
table data, on two separate columns.
Now to my question:
Is it better to create two threads which read information from each file
and use Semaphore based barrier synchronization to change values of a
row of the table only once (with both the information from original.txt
and translation.txt at once) ...OR... is it better to first sequentially
read original.txt and then use table.setValueAt(Object, int, int) to set
the correct values from translated.txt?
Phew, I hope you understand what I'm trying to say.
/Deniz Dogan
I am currently working on a small project (as a hobby) and part of it is
having a JTable with five columns (no need to know more about the actual
columns than the fact that there are five of them). What it's supposed
to show is information from two different text files, let's call them
original.txt and translation.txt on separate columns. Both text files
are formatted as such:
//----------------------------
The text files are separated into paragraphs,
such as this one.
There may or may not be multiple rows right next to each other,
and there is no way of knowing how many rows there are before
a new empty line (the end of a paragraph).
Both of the files have this format.
Both the files have the same amount of paragraphs.
//----------------------------
What I need to do is capture each so called paragraph of each file into
separate Strings, where I replace '\n' with '|' and that I add into the
table data, on two separate columns.
Now to my question:
Is it better to create two threads which read information from each file
and use Semaphore based barrier synchronization to change values of a
row of the table only once (with both the information from original.txt
and translation.txt at once) ...OR... is it better to first sequentially
read original.txt and then use table.setValueAt(Object, int, int) to set
the correct values from translated.txt?
Phew, I hope you understand what I'm trying to say.
/Deniz Dogan