create the map with variants of the names...
( String packageName,
String resourceName,
String className,
String stringPackages,
String interfacesAndClass)
| 381 | |
| 382 | /** create the map with variants of the names... */ |
| 383 | public Map<String,String> createNames ( String packageName, |
| 384 | String resourceName, |
| 385 | String className, |
| 386 | String stringPackages, |
| 387 | String interfacesAndClass) { |
| 388 | |
| 389 | // all the packages from the class, which creates the resource |
| 390 | String packages = namesPackages(allPackages); |
| 391 | |
| 392 | // determine the name of the current user and the current day |
| 393 | Calendar calendar = Calendar.getInstance(); |
| 394 | int month = calendar.get(Calendar.MONTH)+1; |
| 395 | int year = calendar.get(Calendar.YEAR); |
| 396 | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| 397 | String date = day+"/"+month+"/"+year; |
| 398 | String user = System.getProperty("user.name"); |
| 399 | |
| 400 | // the a map with the variants of names and the current date |
| 401 | // and the current user |
| 402 | names.put(nameProject,resourceName); |
| 403 | names.put(nameProject.toUpperCase(),resourceName.toUpperCase()); |
| 404 | names.put(nameProject.toLowerCase(),resourceName.toLowerCase()); |
| 405 | names.put("___CLASSNAME___",className); |
| 406 | names.put("___INTERFACES___",interfacesAndClass); |
| 407 | names.put("___CONTENT___", |
| 408 | displayMethodsAndFields(listMethodsResource,fields)); |
| 409 | names.put("___DATE___",date); |
| 410 | names.put("___AUTHOR___",user); |
| 411 | // "___ALLPACKAGE___" is the packages separated by "/" |
| 412 | // e.g. "sheffied/creole/tokeniser" |
| 413 | names.put("___ALLPACKAGES___",stringPackages); |
| 414 | // "___PACKAGE___" is the packages separated by "." |
| 415 | // e.g. "sheffied.creole.tokeniser" |
| 416 | names.put("___PACKAGE___",packageName); |
| 417 | names.put("___PACKAGETOP___",listPackages.get(0)); |
| 418 | names.put("___RESOURCE___",resourceName);; |
| 419 | names.put( |
| 420 | "___GATECLASSPATH___", |
| 421 | System.getProperty("path.separator") + |
| 422 | System.getProperty("java.class.path") |
| 423 | ); |
| 424 | // ___GATEHOME___ is the GATE home dir, in the form suitable for an Ant |
| 425 | // property |
| 426 | File gateHome = gate.Gate.getGateHome(); |
| 427 | if(gateHome == null) { |
| 428 | // put a fake gate home location in here if we can't get the real one |
| 429 | names.put("___GATEHOME___", |
| 430 | gate.Gate.runningOnUnix() ? "/path/to/gate" |
| 431 | : "C:/Program Files/GATE"); |
| 432 | } |
| 433 | else { |
| 434 | names.put("___GATEHOME___", |
| 435 | gateHome.getPath().replace('\\', '/')); |
| 436 | } |
| 437 | |
| 438 | if (packages.length() == 0){ |
| 439 | names.put("import ___packages___.*;", ""); |
| 440 | } else { |
no test coverage detected