summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/property/PropertyArrayList.java
blob: 5401f224ee565779d0a42975c2cb0c8baa4b366b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**************************************************************************
 *
 * $Revision: 1.2 $
 * $Date: 2003/06/20 11:44:30 $
 *
 * Copyright (C) 2001 CERN - European Organization for Nuclear Research
 * All rights reserved.
 **************************************************************************/

package com.c2kernel.property;

import java.util.ArrayList;

import com.c2kernel.utils.CastorArrayList;

public class PropertyArrayList extends CastorArrayList<Property>
{
    public PropertyArrayList()
    {
        super();
    }

    public PropertyArrayList(ArrayList<Property> aList)
    {
        super();
        // put all properties in order, so later ones with the same name overwrite earlier ones
        for (Property property : aList) {
			put(property);
		}
    }

    /** Overwrite */
    public void put(Property p) {
    	for (Property thisProp : list) {
			if (thisProp.getName().equals(p.getName())) {
				list.remove(thisProp);
				break;
			}
		}
		list.add(p);
    }
}