special domain coloring
[jalview.git] / forester / java / src / org / forester / archaeopteryx / tools / ProcessRunning.java
1 // $Id:\r
2 // FORESTER -- software libraries and applications\r
3 // for evolutionary biology research and applications.\r
4 //\r
5 // Copyright (C) 2008-2012 Christian M. Zmasek\r
6 // Copyright (C) 2008-2012 Sanford Burnham Medical Research Institute\r
7 // All rights reserved\r
8 //\r
9 // This library is free software; you can redistribute it and/or\r
10 // modify it under the terms of the GNU Lesser General Public\r
11 // License as published by the Free Software Foundation; either\r
12 // version 2.1 of the License, or (at your option) any later version.\r
13 //\r
14 // This library is distributed in the hope that it will be useful,\r
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
17 // Lesser General Public License for more details.\r
18 //\r
19 // You should have received a copy of the GNU Lesser General Public\r
20 // License along with this library; if not, write to the Free Software\r
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
22 //\r
23 // Contact: phylosoft @ gmail . com\r
24 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester\r
25 \r
26 package org.forester.archaeopteryx.tools;\r
27 \r
28 import java.text.SimpleDateFormat;\r
29 import java.util.Calendar;\r
30 \r
31 final public class ProcessRunning {\r
32 \r
33     private static long  count = 0;\r
34     final private long   _id;\r
35     final private String _name;\r
36     final private String _start;\r
37 \r
38     public long getId() {\r
39         return _id;\r
40     }\r
41 \r
42     public String getName() {\r
43         return _name;\r
44     }\r
45 \r
46     public String getStart() {\r
47         return _start;\r
48     }\r
49 \r
50     @Override\r
51     public String toString() {\r
52         return getName() + " [id=" + getId() + "] [start=" + getStart() + "]";\r
53     }\r
54 \r
55     synchronized static ProcessRunning createInstance( final String name ) {\r
56         final Calendar cal = Calendar.getInstance();\r
57         final SimpleDateFormat sdf = new SimpleDateFormat( "HH:mm:ss" );\r
58         return new ProcessRunning( count++, name, sdf.format( cal.getTime() ) );\r
59     }\r
60 \r
61     private ProcessRunning( final long id, final String name, final String start ) {\r
62         if ( id < 0 ) {\r
63             throw new IllegalArgumentException( "process id cannot be negative" );\r
64         }\r
65         _id = id;\r
66         _name = name;\r
67         _start = start;\r
68     }\r
69 }\r