pcap: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.statesystem.core / src / org / eclipse / linuxtools / internal / statesystem / core / backend / historytree / HTConfig.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
5 *
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.statesystem.core.backend.historytree;
14
15 import java.io.File;
16
17 /**
18 * Configuration object for the {@link HistoryTree}.
19 *
20 * @author Alexandre Montplaisir
21 */
22 public final class HTConfig {
23
24 private static final int DEFAULT_BLOCKSIZE = 64 * 1024;
25 private static final int DEFAULT_MAXCHILDREN = 50;
26
27 private final File stateFile;
28 private final int blockSize;
29 private final int maxChildren;
30 private final int providerVersion;
31 private final long treeStart;
32
33 /**
34 * Full constructor.
35 *
36 * @param newStateFile
37 * The name of the history file
38 * @param blockSize
39 * The size of each "block" on disk. One node will always fit in
40 * one block.
41 * @param maxChildren
42 * The maximum number of children allowed per core (non-leaf)
43 * node.
44 * @param providerVersion
45 * The version of the state provider. If a file already exists,
46 * and their versions match, the history file will not be rebuilt
47 * uselessly.
48 * @param startTime
49 * The start time of the history
50 */
51 public HTConfig(File newStateFile, int blockSize, int maxChildren,
52 int providerVersion, long startTime) {
53 this.stateFile = newStateFile;
54 this.blockSize = blockSize;
55 this.maxChildren = maxChildren;
56 this.providerVersion = providerVersion;
57 this.treeStart = startTime;
58 }
59
60 /**
61 * Version of the constructor using default values for 'blockSize' and
62 * 'maxChildren'.
63 *
64 * @param newStateFile
65 * The name of the history file
66 * @param providerVersion
67 * The version of the state provider. If a file already exists,
68 * and their versions match, the history file will not be rebuilt
69 * uselessly.
70 * @param startTime
71 * The start time of the history
72 */
73 public HTConfig(File newStateFile, int providerVersion, long startTime) {
74 this(newStateFile, DEFAULT_BLOCKSIZE, DEFAULT_MAXCHILDREN, providerVersion, startTime);
75 }
76
77 // ------------------------------------------------------------------------
78 // Getters
79 // ------------------------------------------------------------------------
80
81 /**
82 * Get the history file.
83 *
84 * @return The history file
85 */
86 public File getStateFile() {
87 return stateFile;
88 }
89
90 /**
91 * Get the configure block size.
92 *
93 * @return The block size
94 */
95 public int getBlockSize() {
96 return blockSize;
97 }
98
99 /**
100 * Get the maximum amount of children allowed.
101 *
102 * @return The maximum amount of children
103 */
104 public int getMaxChildren() {
105 return maxChildren;
106 }
107
108 /**
109 * Get the state provider's version.
110 *
111 * @return The state provider's version
112 */
113 public int getProviderVersion() {
114 return providerVersion;
115 }
116
117 /**
118 * Get the start time of the history
119 *
120 * @return The start time
121 */
122 public long getTreeStart() {
123 return treeStart;
124 }
125 }
This page took 0.035182 seconds and 5 git commands to generate.