-
Notifications
You must be signed in to change notification settings - Fork 0
Ticket3396 show global macros #1829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Chsudeepta
wants to merge
7
commits into
master
Choose a base branch
from
Ticket3396_ShowGlobalMacros
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+547
−93
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0a1c4b
Ticket3396: Initial commit
4e3f053
Global macros related changes
87f8eda
Minor changes
ad8a245
Removed unintended changes
b772626
Removed unintended changes
a56ca36
Removed unintended changes
0c0bc81
Changed the subtitle
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
...is.ibex.configserver/src/uk/ac/stfc/isis/ibex/configserver/configuration/GlobalMacro.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /* | ||
| * This file is part of the ISIS IBEX application. | ||
| * Copyright (C) 2012-2025 Science & Technology Facilities Council. | ||
| * All rights reserved. | ||
| * | ||
| * This program is distributed in the hope that it will be useful. | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v1.0 which accompanies this distribution. | ||
| * EXCEPT AS EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM | ||
| * AND ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES | ||
| * OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more details. | ||
| * | ||
| * You should have received a copy of the Eclipse Public License v1.0 | ||
| * along with this program; if not, you can obtain a copy from | ||
| * https://www.eclipse.org/org/documents/epl-v10.php or | ||
| * http://opensource.org/licenses/eclipse-1.0.php | ||
| */ | ||
|
|
||
| package uk.ac.stfc.isis.ibex.configserver.configuration; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
| import uk.ac.stfc.isis.ibex.model.ModelObject; | ||
|
|
||
| /** | ||
| * Represents a global macro. | ||
| * | ||
| * Contains the IOC name, or none, and a list of associated macros | ||
| * | ||
| */ | ||
| public class GlobalMacro extends ModelObject implements Comparable<GlobalMacro> { | ||
|
|
||
| private final String name; | ||
|
|
||
| private Map<String, String> macros; | ||
|
|
||
| /** | ||
| * Create a Global Macro with a given name. | ||
| * | ||
| * @param name The IOC name (or global) | ||
| */ | ||
| public GlobalMacro(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| /** | ||
| * Create a copy of a Global Macro list for an IOC (or global). | ||
| * | ||
| * @param globalMacro The Global Macro to copy | ||
| */ | ||
| public GlobalMacro(GlobalMacro globalMacro) { | ||
| this.name = globalMacro.getName(); | ||
| //this.macros = new ArrayList<>(globalMacro.getMacros()); | ||
| this.macros = new HashMap<String, String>(globalMacro.getMacros()); | ||
| } | ||
|
|
||
| /** | ||
| * @return The IOC name | ||
| */ | ||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| /** | ||
| * @return A collection of macros | ||
| */ | ||
| public Map<String, String> getMacros() { | ||
| return Optional.ofNullable(macros).orElseGet(HashMap::new); | ||
| } | ||
|
|
||
| /** | ||
| * Compares this GlobalMacro to another based on name. Used for sorting. | ||
| */ | ||
| @Override | ||
| public int compareTo(GlobalMacro other) { | ||
| if (this.name != null && other.name != null) { | ||
| return this.name.compareTo(other.name); | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| GlobalMacro other = (GlobalMacro) obj; | ||
| if (this.name == null && other.name == null) { | ||
| return true; | ||
| } | ||
| if (this.name == null || other.name == null) { | ||
| return false; | ||
| } | ||
| return this.name.equals(other.name); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return name == null ? 0 : name.hashCode(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "GlobalMacro [name=" + name + ", macros=" + macros + "]"; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.