Jmate is now Jcaki
Posted by
afsina
on Saturday, May 02, 2009
/
Comments: (0)
I have changed the name of jmate to jcaki. caki, ( actually "çakı" ) means small knife in Turkish. Now version is V1.0 Alpha
Jmate 0.6 is out. Further simplification and reduction.
Posted by
afsina
on Thursday, April 16, 2009
/
Comments: (0)
Jmate 0.6 is out. this release breaks backwards compatibility (sorry.. still pre-alpha) and trims a lot of code. Here are some changes
- Collections related classes are out. Use Google Collections instead.
- SimpleFileReader and SimpleFileWriter are now SimpleTextReader and SimpleTextWriter. Some convenient factory methods are added to both classes. Classes now accepts input and output streams.
- KeyValueReader class is added.
- Bytes class is added for many byte functions (byte-int-short conversions with endianness support)
- New handy String methods are added related with substring. Please see the wiki page.
- More unit tests
Visual Studio, Flash CS4 code editing support sucks.
Posted by
afsina
on Wednesday, February 04, 2009
/
Comments: (0)
People bash Java.. But there is one thing none of the languages-tools even come close it's IDE and editor support. you understand it once you sit in front of either Adobe CS4 (400-700$) for actual coding or Visual Studio ( Pro version 800$, 2000$ with MSDN) and compare it to Netbeans, Eclipse or my favorite Intellij IDEA. what a joke.
jmate 0.5 simplification, CountingSet
Posted by
afsina
on Saturday, January 17, 2009
/
Comments: (0)
Ok, i have made the Jmate 0.5 release. in this release, i made a decision and simplfy some usages of SimpleFileReader. Actually i still have a feeling that this class may need to be dedicated to the text files only, so i may have a drastic name change later. But here are the changes i made
I eliminated the "Filter" usage for making powerfult text readers. because it was too complex for the beginner's to understand and clumsy for the rest. so i made new methods with reasonable names instead. before reading all lines from a text lines while applying trim, ignoring empty lines and allowing only a matching regular expression was like this:
List list = new SimpleFileReader.Builder("test/multi_line_text_file.txt")
.filters(StringFilters.PASS_ONLY_TEXT, StringFilters.newPrefixFilter("^[^#]")
.trim()
.build()
.asStringList();
Now it is like this:
List list = new SimpleFileReader.Builder("test/multi_line_text_file.txt")
.allowMatchingRegexp("^[^#]")
.ignoreWhiteSpaceLines()
.trim()
.build()
.asStringList();
to me this is cleaner, and user do not need to know yet another class.
Now there is a new concept called Template, which actually contains the properties of a SimplefileReader, so i can use it to generate other SimpleFileReader objcets using it. This is a tiny bit advanced use, i doubt it will be used frequently.
SimpleFileReader.Template template = new SimpleFileReader.Template()
.allowMatchingRegexp("^[^#]")
.ignoreWhiteSpaceLines()
.trim();
List files = Files.crawlDirectory(new File("blah"));
for (File file : files) {
SimpleFileReader sr = template.generateReader(file);
// .... read it , do something..
}
I eliminated a bug in Strings.insertFrom... methods. Now you can add white spaces as well.
There is a new class, called "CountingSet" it is not a real "Set" but what it does is a frequent necessity for me. it basically counts the elements that you add. For example:
CountingSet histogram = new CountingSet();
histogram.add("Apple", "Pear", "Plum", "Apple", "Apple", "Grape", "Pear");
for (String s : histogram)
out.println(s + " count:" + histogram.getCount(s));
will give you
Pear count:2
Apple count:3
Plum count:1
Grape count:1
Also you can sort the items by frequency or with a Comparator.
for(String s : histogram.getSortedList())
out.println(s + " count:" + histogram.getCount(s));
Apple count:3
Pear count:2
Plum count:1
Grape count:1
CountingSet is not remarkably fast or efficent because it uses a Map inside. i may try optimizing it for speed and memory efficiency later. There is a MultiFileReader class, but it is not yet public. i may have second thoughts about it.
You can download the version 0.5 from http://code.google.com/p/jmate/downloads/list
Changes can be seen from here : http://code.google.com/p/jmate/source/list