charts: Make the custom chart formatters immutable
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / backend / historytree / HTConfig.java
CommitLineData
a52fde77 1/*******************************************************************************
60ae41e1 2 * Copyright (c) 2012, 2014 Ericsson
a52fde77
AM
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
a96cc6be 5 *
a52fde77
AM
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
a96cc6be 10 *
a52fde77
AM
11 *******************************************************************************/
12
e894a508 13package org.eclipse.tracecompass.internal.statesystem.core.backend.historytree;
a52fde77
AM
14
15import java.io.File;
16
17/**
3a081e85 18 * Configuration object for the {@link IHistoryTree}.
a96cc6be 19 *
8d47cc34 20 * @author Alexandre Montplaisir
a52fde77 21 */
8d47cc34 22public final class HTConfig {
a52fde77 23
cb42195c
AM
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;
a52fde77 32
8d47cc34
AM
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,
a96cc6be 52 int providerVersion, long startTime) {
a52fde77
AM
53 this.stateFile = newStateFile;
54 this.blockSize = blockSize;
55 this.maxChildren = maxChildren;
a96cc6be 56 this.providerVersion = providerVersion;
a52fde77
AM
57 this.treeStart = startTime;
58 }
59
60 /**
8d47cc34
AM
61 * Version of the constructor using default values for 'blockSize' and
62 * 'maxChildren'.
a96cc6be 63 *
8d47cc34
AM
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.
a52fde77 70 * @param startTime
8d47cc34 71 * The start time of the history
a52fde77 72 */
8d47cc34 73 public HTConfig(File newStateFile, int providerVersion, long startTime) {
cb42195c
AM
74 this(newStateFile, DEFAULT_BLOCKSIZE, DEFAULT_MAXCHILDREN, providerVersion, startTime);
75 }
76
77 // ------------------------------------------------------------------------
78 // Getters
79 // ------------------------------------------------------------------------
80
8d47cc34
AM
81 /**
82 * Get the history file.
83 *
84 * @return The history file
85 */
cb42195c
AM
86 public File getStateFile() {
87 return stateFile;
88 }
89
8d47cc34
AM
90 /**
91 * Get the configure block size.
92 *
93 * @return The block size
94 */
cb42195c
AM
95 public int getBlockSize() {
96 return blockSize;
97 }
98
8d47cc34
AM
99 /**
100 * Get the maximum amount of children allowed.
101 *
102 * @return The maximum amount of children
103 */
cb42195c
AM
104 public int getMaxChildren() {
105 return maxChildren;
106 }
107
8d47cc34
AM
108 /**
109 * Get the state provider's version.
110 *
111 * @return The state provider's version
112 */
cb42195c
AM
113 public int getProviderVersion() {
114 return providerVersion;
115 }
116
8d47cc34
AM
117 /**
118 * Get the start time of the history
119 *
120 * @return The start time
121 */
cb42195c
AM
122 public long getTreeStart() {
123 return treeStart;
a52fde77
AM
124 }
125}
This page took 0.126667 seconds and 5 git commands to generate.