@@ -26,13 +26,12 @@
Loading
26 26
import java.util.Collection;
27 27
import java.util.List;
28 28
29 -
import com.thoughtworks.xstream.annotations.XStreamAlias;
30 -
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
31 -
import com.thoughtworks.xstream.annotations.XStreamOmitField;
32 -
33 29
import cern.accsoft.steering.jmad.domain.file.ModelFile;
34 30
import cern.accsoft.steering.jmad.domain.machine.filter.NameFilter;
35 31
import cern.accsoft.steering.jmad.domain.twiss.TwissInitialConditionsImpl;
32 +
import com.thoughtworks.xstream.annotations.XStreamAlias;
33 +
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
34 +
import com.thoughtworks.xstream.annotations.XStreamOmitField;
36 35
37 36
/**
38 37
 * this class defines a range in a sequence, by defining the first and the last element.
@@ -59,14 +58,14 @@
Loading
59 58
60 59
    /* filters, which define the monitors which shall be inverted */
61 60
    @XStreamAlias("monitor-invert-filters")
62 -
    private List<NameFilter> monitorInvertFilters = new ArrayList<NameFilter>();
61 +
    private List<NameFilter> monitorInvertFilters = new ArrayList<>();
63 62
64 63
    @XStreamAlias("corrector-invert-filters")
65 -
    private List<NameFilter> correctorInvertFilters = new ArrayList<NameFilter>();
64 +
    private List<NameFilter> correctorInvertFilters = new ArrayList<>();
66 65
67 66
    /** files that shall be executed after the use-command. */
68 67
    @XStreamAlias("post-use-files")
69 -
    private List<ModelFile> postUseFiles = new ArrayList<ModelFile>();
68 +
    private List<ModelFile> postUseFiles = new ArrayList<>();
70 69
71 70
    /**
72 71
     * The name of the start element. If non-null then the sequence is rotatet before use.
@@ -122,11 +121,11 @@
Loading
122 121
        newRangeDefinition.sequenceDefinition = sequenceDefinition;
123 122
        newRangeDefinition.madxRange = madxRange;
124 123
        newRangeDefinition.twiss = twiss;
125 -
        newRangeDefinition.monitorInvertFilters = new ArrayList<NameFilter>(this.monitorInvertFilters);
126 -
        newRangeDefinition.correctorInvertFilters = new ArrayList<NameFilter>(this.correctorInvertFilters);
124 +
        newRangeDefinition.monitorInvertFilters = new ArrayList<>(this.monitorInvertFilters);
125 +
        newRangeDefinition.correctorInvertFilters = new ArrayList<>(this.correctorInvertFilters);
127 126
        newRangeDefinition.apertureDefinition = apertureDefinition;
128 127
        newRangeDefinition.startElementName = startElementName;
129 -
        newRangeDefinition.postUseFiles = new ArrayList<ModelFile>(postUseFiles);
128 +
        newRangeDefinition.postUseFiles = new ArrayList<>(postUseFiles);
130 129
        return newRangeDefinition;
131 130
    }
132 131
@@ -264,13 +263,13 @@
Loading
264 263
     */
265 264
    private Object readResolve() {
266 265
        if (monitorInvertFilters == null) {
267 -
            monitorInvertFilters = new ArrayList<NameFilter>();
266 +
            monitorInvertFilters = new ArrayList<>();
268 267
        }
269 268
        if (correctorInvertFilters == null) {
270 -
            correctorInvertFilters = new ArrayList<NameFilter>();
269 +
            correctorInvertFilters = new ArrayList<>();
271 270
        }
272 271
        if (postUseFiles == null) {
273 -
            postUseFiles = new ArrayList<ModelFile>();
272 +
            postUseFiles = new ArrayList<>();
274 273
        }
275 274
        return this;
276 275
    }

@@ -11,11 +11,12 @@
Loading
11 11
12 12
package cern.accsoft.steering.jmad.model;
13 13
14 +
import static java.util.Collections.singletonList;
15 +
14 16
import java.io.File;
15 17
import java.util.ArrayList;
16 18
import java.util.Arrays;
17 19
import java.util.Collection;
18 -
import java.util.Collections;
19 20
import java.util.HashMap;
20 21
import java.util.List;
21 22
import java.util.Map;
@@ -47,7 +48,6 @@
Loading
47 48
import cern.accsoft.steering.jmad.domain.machine.RangeListener;
48 49
import cern.accsoft.steering.jmad.domain.machine.SequenceDefinition;
49 50
import cern.accsoft.steering.jmad.domain.misalign.MisalignmentConfiguration;
50 -
import cern.accsoft.steering.jmad.domain.misalign.MisalignmentConfigurationListener;
51 51
import cern.accsoft.steering.jmad.domain.optics.Optic;
52 52
import cern.accsoft.steering.jmad.domain.optics.OpticImpl;
53 53
import cern.accsoft.steering.jmad.domain.result.Result;
@@ -116,46 +116,74 @@
Loading
116 116
117 117
public class JMadModelImpl implements JMadModel, ElementAttributeReader {
118 118
119 -
    /** The logger for the class */
119 +
    /**
120 +
     * The logger for the class
121 +
     */
120 122
    protected static final Logger LOGGER = LoggerFactory.getLogger(JMadModelImpl.class);
121 123
122 -
    /** The definition of the model */
124 +
    /**
125 +
     * The definition of the model
126 +
     */
123 127
    private JMadModelDefinition modelDefinition = null;
124 128
125 -
    /** The last loaded optics definition */
129 +
    /**
130 +
     * The last loaded optics definition
131 +
     */
126 132
    private OpticsDefinition activeOpticsDefinition = null;
127 133
128 -
    /** The last loaded range definition */
134 +
    /**
135 +
     * The last loaded range definition
136 +
     */
129 137
    private RangeDefinition activeRangeDefinition = null;
130 138
131 -
    /** The active Range */
139 +
    /**
140 +
     * The active Range
141 +
     */
132 142
    private Range activeRange = null;
133 143
134 -
    /** The actually loaded aperture data. Might be null. */
144 +
    /**
145 +
     * The actually loaded aperture data. Might be null.
146 +
     */
135 147
    private Aperture aperture = null;
136 148
137 -
    /** The kernel for this model to be injected by spring */
149 +
    /**
150 +
     * The kernel for this model to be injected by spring
151 +
     */
138 152
    private JMadKernel kernel;
139 153
140 -
    /** The last calculated optics-values */
154 +
    /**
155 +
     * The last calculated optics-values
156 +
     */
141 157
    private Optic optics = new OpticImpl();
142 158
143 -
    /** The startup configuration defines which optics are loaded per default */
159 +
    /**
160 +
     * The startup configuration defines which optics are loaded per default
161 +
     */
144 162
    private JMadModelStartupConfiguration startupConfiguration = new JMadModelStartupConfiguration();
145 163
146 -
    /** The Manager which keeps all model-specific knobs */
164 +
    /**
165 +
     * The Manager which keeps all model-specific knobs
166 +
     */
147 167
    private final KnobManager knobManager;
148 168
149 -
    /** The file finder for model files to be injected by spring */
169 +
    /**
170 +
     * The file finder for model files to be injected by spring
171 +
     */
150 172
    private ModelFileFinderManager modelFileFinderManager;
151 173
152 -
    /** The listeners */
174 +
    /**
175 +
     * The listeners
176 +
     */
153 177
    private final List<JMadModelListener> listeners = new ArrayList<>();
154 178
155 -
    /** Keeps track of all the strengths and variables */
179 +
    /**
180 +
     * Keeps track of all the strengths and variables
181 +
     */
156 182
    private StrengthVarManager strengthVarManager;
157 183
158 -
    /** true, if some strengthes have been set since last recalc of optics */
184 +
    /**
185 +
     * true, if some strengthes have been set since last recalc of optics
186 +
     */
159 187
    protected boolean dirtyModel = false;
160 188
161 189
    /**
@@ -164,7 +192,9 @@
Loading
164 192
     */
165 193
    private TwissInitialConditions twissInitialConditions = new TwissInitialConditionsImpl();
166 194
167 -
    /** The mode defines which kind of twiss is used */
195 +
    /**
196 +
     * The mode defines which kind of twiss is used
197 +
     */
168 198
    private ModelMode modelMode = ModelMode.MADX;
169 199
170 200
    /**
@@ -220,7 +250,7 @@
Loading
220 250
221 251
    /**
222 252
     * ensures, that the model is initialized.
223 -
     * 
253 +
     *
224 254
     * @throws JMadModelException if the initialization fails
225 255
     */
226 256
    private void ensureInit() throws JMadModelException {
@@ -303,8 +333,8 @@
Loading
303 333
    private void processModelFiles(List<ModelFile> modelFiles) {
304 334
        boolean containsStrengthFile = false;
305 335
        for (ModelFile modelFile : modelFiles) {
306 -
            if ((modelFile instanceof CallableModelFile)
307 -
                    && (ParseType.STRENGTHS == ((CallableModelFile) modelFile).getParseType())) {
336 +
            if ((modelFile instanceof CallableModelFile) && (ParseType.STRENGTHS == ((CallableModelFile) modelFile)
337 +
                    .getParseType())) {
308 338
                containsStrengthFile = true;
309 339
                break;
310 340
            }
@@ -341,8 +371,8 @@
Loading
341 371
     * <p>
342 372
     * If a tableName is given, then the {@link ReadMyTableCommand} is used and the table is stored in the given table
343 373
     * name. If the name is <code>null</code>, then the tablename must be given in the file.
344 -
     * 
345 -
     * @param file the file from which to load the table
374 +
     *
375 +
     * @param file      the file from which to load the table
346 376
     * @param tableName the name of the table (lowercase!)
347 377
     */
348 378
    public void readTable(File file, String tableName) {
@@ -433,7 +463,7 @@
Loading
433 463
434 464
    @Override
435 465
    public double getValue(String valueName) throws JMadModelException {
436 -
        List<Double> values = getValues(Collections.singletonList(valueName));
466 +
        List<Double> values = getValues(singletonList(valueName));
437 467
        if (values.size() != 1) {
438 468
            throw new JMadModelException("Result contains " + values.size() + " values, but should contain one.");
439 469
        }
@@ -443,7 +473,7 @@
Loading
443 473
    /**
444 474
     * calculates the actual optics-values and stores them in the internal Optics-object. This can be retrieved by
445 475
     * <code>getOptics()</code>
446 -
     * 
476 +
     *
447 477
     * @return the optics-object
448 478
     * @throws JMadModelException if the calculation of the optics fails
449 479
     */
@@ -461,7 +491,7 @@
Loading
461 491
    /**
462 492
     * creates all the element-objects for the active range by twissing and reading in the names and types of the
463 493
     * elements.
464 -
     * 
494 +
     *
465 495
     * @throws JMadModelException if the reading of the active range fails
466 496
     */
467 497
    private void readActiveRange() throws JMadModelException {
@@ -533,8 +563,9 @@
Loading
533 563
        List<Double> values = getValues(valueNames);
534 564
535 565
        if (values.size() != valueNames.size()) {
536 -
            throw new JMadModelException("Amount of returned Values (" + values.size()
537 -
                    + ") differs from requested ones (" + valueNames.size() + ").");
566 +
            throw new JMadModelException(
567 +
                    "Amount of returned Values (" + values.size() + ") differs from requested ones (" + valueNames
568 +
                            .size() + ").");
538 569
        }
539 570
540 571
        int index = 0;
@@ -554,7 +585,7 @@
Loading
554 585
555 586
    /**
556 587
     * sends the misalignment-commands to madx
557 -
     * 
588 +
     *
558 589
     * @param misalignmentConfigurations the misalignment-configurations from which to create the commands
559 590
     */
560 591
    protected void setMisalignments(List<MisalignmentConfiguration> misalignmentConfigurations) {
@@ -847,15 +878,9 @@
Loading
847 878
        activeRange.addListener(new RangeListener() {
848 879
            @Override
849 880
            public void addedMisalignments(MisalignmentConfiguration misalignmentConfiguration) {
850 -
                misalignmentConfiguration.addListener(new MisalignmentConfigurationListener() {
851 -
852 -
                    @Override
853 -
                    public void changedMisalignmentValues(MisalignmentConfiguration changedMisalignmentConfiguration) {
854 -
                        setMisalignments(Collections.singletonList(changedMisalignmentConfiguration));
855 -
856 -
                    }
857 -
                });
858 -
                setMisalignments(Collections.singletonList(misalignmentConfiguration));
881 +
                misalignmentConfiguration.addListener(changedMisalignmentConfiguration -> //
882 +
                        setMisalignments(singletonList(changedMisalignmentConfiguration)));
883 +
                setMisalignments(singletonList(misalignmentConfiguration));
859 884
            }
860 885
861 886
            @Override
@@ -916,7 +941,7 @@
Loading
916 941
917 942
    /**
918 943
     * notifies all listeners, that a different range is now active
919 -
     * 
944 +
     *
920 945
     * @param range the new active range
921 946
     */
922 947
    private void fireRangeChanged(Range range) {
Files Complexity Coverage
src/java/cern/accsoft/steering/jmad 42.33% 47.41%
Project Totals (293 files) 42.33% 47.41%
205.1
TRAVIS_OS_NAME=linux
openjdk8=
205.2
openjdk11=
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading