File Source: ActionGroupComponent.java
/*
P/P * Method: com.dmdirc.updater.components.ActionGroupComponent__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.dmdirc.updater.components;
24
25 import com.dmdirc.actions.ActionGroup;
26 import com.dmdirc.actions.ActionManager;
27 import com.dmdirc.updater.UpdateChecker;
28 import com.dmdirc.updater.UpdateComponent;
29 import com.dmdirc.updater.Version;
30
31 /**
32 * Update component for action groups.
33 *
34 * @author chris
35 */
36 public class ActionGroupComponent implements UpdateComponent {
37
38 /** The group that this component represents. */
39 private ActionGroup group;
40
41 /**
42 * Creates a new ActionGroupComponent for the specified action group.
43 *
44 * @param group The action group this component is for
45 */
/*
P/P * Method: void com.dmdirc.updater.components.ActionGroupComponent(ActionGroup)
*
* Preconditions:
* group != null
*
* Postconditions:
* this.group == group
* this.group != null
*
* Test Vectors:
* com.dmdirc.actions.ActionGroup:getComponent(...)@49: {-1}, {-231..-2, 0..232-1}
* com.dmdirc.actions.ActionGroup:getVersion(...)@49: {-1}, {-231..-2, 0..232-1}
*/
46 public ActionGroupComponent(final ActionGroup group) {
47 this.group = group;
48
49 if (group.getComponent() != -1 && group.getVersion() != -1) {
50 UpdateChecker.removeComponent(getName());
51 UpdateChecker.registerComponent(this);
52 }
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public String getName() {
/*
P/P * Method: String getName()
*
* Preconditions:
* this.group != null
*
* Postconditions:
* java.lang.StringBuilder:toString(...)._tainted == 0
* return_value == &java.lang.StringBuilder:toString(...)
*/
58 return "addon-" + group.getComponent();
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public String getFriendlyName() {
/*
P/P * Method: String getFriendlyName()
*
* Preconditions:
* this.group != null
*
* Postconditions:
* java.lang.StringBuilder:toString(...)._tainted == 0
* return_value == &java.lang.StringBuilder:toString(...)
*/
64 return "Action pack: " + group.getName();
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 public Version getVersion() {
/*
P/P * Method: Version getVersion()
*
* Preconditions:
* this.group != null
*
* Postconditions:
* return_value == &new Version(getVersion#1)
* new Version(getVersion#1) num objects == 1
* init'ed(return_value.intVersion)
* return_value.strVersion == null
*/
70 return new Version(group.getVersion());
71 }
72
73 /** {@inheritDoc} */
74 @Override
75 public String getFriendlyVersion() {
/*
P/P * Method: String getFriendlyVersion()
*
* Preconditions:
* this.group != null
*
* Postconditions:
* java.lang.String:valueOf(...)._tainted == 0
* return_value == &java.lang.String:valueOf(...)
*/
76 return String.valueOf(getVersion());
77 }
78
79 /** {@inheritDoc} */
80 @Override
81 public boolean doInstall(final String path) throws Throwable {
/*
P/P * Method: bool doInstall(String)
*
* Postconditions:
* return_value == 0
*/
82 ActionManager.installActionPack(path);
83 return false;
84 }
85
86 }
SofCheck Inspector Build Version : 2.17854
| ActionGroupComponent.java |
2009-Jun-25 01:54:24 |
| ActionGroupComponent.class |
2009-Sep-02 17:04:17 |