madkite's blog

By madkite, 13 years ago, translation, In English

As you know, codeforces requires solution in the one file. This involves some difficulties of using own utility classes. Also solution class in java language must be in the default package (in additional, several other sites expect class called Main and don't accept solution with different name of class).

CHelper by Egor — wonderful plugin that can make life more easy at this site for java-programmers. But some people don't like to use some specific style during writing of contest, testing, storing archive, etc., especially when this style was specified not by themselves. Another people don't like complicated GUI. There are also people, who prefer UNIX-way in everything — when every program or plugin solves the only one little task, but does it best.

In short, I see CHelper is too complicated, but inspiring by it I decided to make a small plugin, it does the only one simple thing — generates Main.java integrating dependencies and removing some unused code. There is no GUI — only one button on the right of panel. When you press this magic button, class Main will be generated from opened file, it will be placed in the default package of the current module. Dependent classes, which sources can be found in the project, will be recursively added, some unused inner classes, methods and filds will be removed with care. Entry point is method "public static void main(String[] args)". It is obvious there is no sense of this plugin for topcoder's SRMs.

Plugin uses the only IDEA's internal lexical analyzer called PSI and doesn't require some specific code conversation. The only problem you can encounters with — class name conflict, because package info will be lost during preparing of Main class. This isn't bug. Be careful and don't use classes with the same short name, but different fully qualified name. It's also recommended to look over result Main.java before uploading to server.

There are no other features in the plugin. I think generator of solution templates is the thing that contestant can make by himself and in the way as he want.

Plugin download page: http://plugins.intellij.net/plugin/?idea&id=6870. In additional, plugin can be installed directly from IDEA (Settings -> Plugins -> Browse repositories). Screenshot is useless, but some one you can find here.

P.S. If you prefer a feature-rich plugin with GUI — I advice you to look at CHelper.

  • Vote: I like it
  • +32
  • Vote: I do not like it