|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TimeRecord.java | 0% | 0% | 0% | 0% |
|
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | * | |
17 | * $Id: TimeRecord.java 541508 2007-05-25 01:54:12Z vgritsenko $ | |
18 | */ | |
19 | ||
20 | package org.apache.xindice.core.meta; | |
21 | ||
22 | import java.util.Date; | |
23 | ||
24 | /** | |
25 | * Encapsulates the modified/create times used in MetaData. | |
26 | * | |
27 | * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $ | |
28 | */ | |
29 | public class TimeRecord { | |
30 | ||
31 | long created = 0; | |
32 | long modified = 0; | |
33 | ||
34 | ||
35 | 0 | public TimeRecord(long created, long modified) { |
36 | 0 | this.created = created; |
37 | 0 | this.modified = modified; |
38 | } | |
39 | ||
40 | /** | |
41 | * Returns the create time stored here. | |
42 | * | |
43 | * @return long | |
44 | */ | |
45 | 0 | public long getCreatedTime() { |
46 | 0 | return created; |
47 | } | |
48 | ||
49 | /** | |
50 | * Returns the modified time stored here. | |
51 | * | |
52 | * @return long | |
53 | */ | |
54 | 0 | public long getModifiedTime() { |
55 | 0 | return modified; |
56 | } | |
57 | ||
58 | /** | |
59 | * Sets the create time stored here. | |
60 | * | |
61 | * @param created The new create time | |
62 | */ | |
63 | 0 | public void setCreatedTime(long created) { |
64 | 0 | this.created = created; |
65 | } | |
66 | ||
67 | /** | |
68 | * Sets the modified time stored here. | |
69 | * | |
70 | * @param mod The new modified time | |
71 | */ | |
72 | 0 | public void setModifiedTime(long mod) { |
73 | 0 | this.modified = mod; |
74 | } | |
75 | ||
76 | /** | |
77 | * Return a string version of the times encapsulated. It should look like | |
78 | * [cr=CREATE mod=MOD] | |
79 | * | |
80 | * @return The string representing the time | |
81 | */ | |
82 | 0 | public String toString() { |
83 | 0 | StringBuffer buffer = new StringBuffer(); |
84 | 0 | buffer.append("["); |
85 | 0 | if (created > 0) { |
86 | 0 | buffer.append("cr=" + (new Date(created)).toString()); |
87 | } | |
88 | 0 | if (modified > 0) { |
89 | 0 | buffer.append("mod=" + (new Date(modified)).toString()); |
90 | } | |
91 | 0 | buffer.append("]"); |
92 | 0 | return buffer.toString(); |
93 | } | |
94 | } |
|