Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9c78af949d73882911f63549933a7cc60a9baee4 (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
56
57
58
59
60
61
/*******************************************************************************
 * Copyright (c) 2007, 2015 Red Hat, Inc.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Red Hat Incorporated - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.autotools.ui.editors;

public class AutoconfMacro implements Comparable<Object> {

	protected String name;
	protected String parms;

	public AutoconfMacro(String name, String parms) {
		this.name = name;
		this.parms = parms;
	}

	public String getName() {
		return name;
	}

	public String getTemplate() {
		return name + (hasParms() ? "()" : ""); //$NON-NLS-1$ //$NON-NLS-2$
	}

	public String getParms() {
		return parms;
	}

	public boolean hasParms() {
		return (parms.length() > 0);
	}

	@Override
	public int compareTo(Object x) {
		AutoconfMacro y = (AutoconfMacro) x;
		return getName().compareTo(y.getName());
	}
	
	@Override
	public boolean equals(Object x) {
		if (x == null)
			return false;
		AutoconfMacro y = (AutoconfMacro)x;
		return getName().equals(y.getName());
	}
	
	@Override
	public int hashCode() {
		return getName().hashCode();
	}
	
}

Back to the top