Skip to main content
summaryrefslogtreecommitdiffstats
blob: 55593dceba32cb79f14f8db17c97b85be8a09465 (plain) (blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
/*******************************************************************************
 * Copyright (c) 2008, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;

import org.eclipse.core.runtime.Assert;

/**
 * @since 2.0
 */
public class PropertyOperand extends Operand {
	private final Object first;
	private final Object second;
	private final String key;

	/**
	 * Creates a new operand that represents replacing a property value
	 * with another.  At least one of the provided property values must be
	 * non-null.
	 * 
	 * @param key The key of the property being modified
	 * @param first The property value being removed, or <code>null</code>
	 * @param second The property value being added, or <code>null</code>
	 */
	public PropertyOperand(String key, Object first, Object second) {
		//the operand must specify have a key and have at least one non-null value
		Assert.isTrue(key != null && (first != null || second != null));
		this.first = first;
		this.second = second;
		this.key = key;
	}

	public Object first() {
		return first;
	}

	public Object second() {
		return second;
	}

	public String getKey() {
		return key;
	}

	public String toString() {
		return key + " = " + first + " --> " + second; //$NON-NLS-1$ //$NON-NLS-2$
	}
}

Back to the top