View Javadoc

1   /*
2    * Copyright 2010 Fraunhofer Gesellschaft, Munich, Germany,
3    * for its Fraunhofer Institute for Computer Architecture and Software
4    * Technology (FIRST), Berlin, Germany. All rights reserved.
5    * http://www.first.fraunhofer.de/
6    */
7   package net.kwfgrid.gworkflowdl.structure;
8   
9   import org.apache.log4j.Logger;
10  
11  /***
12   * @author Andreas Hoheisel
13   *         (<a href="http://www.andreas-hoheisel.de">www.andreas-hoheisel.de</a>)
14   * @version $Id: StdOperationCandidate.java 1344 2010-01-27 15:36:48Z andreas.hoheisel@first.fraunhofer.de $
15   */
16  public class StdOperationCandidate extends ArrayListOwls implements OperationCandidate {
17  
18      private static final Logger logger = Logger.getLogger(StdOperationCandidate.class);
19      boolean selected;
20      String type;
21      String operationName;
22      String resourceName;
23      float quality;
24  
25      public StdOperationCandidate() {
26          super();
27          selected = OperationCandidate.DEFAULT_SELECTED;
28          type = OperationCandidate.DEFAULT_TYPE;
29          operationName = OperationCandidate.DEFAULT_OPERATIONNAME;
30          resourceName = OperationCandidate.DEFAULT_RESOURCENAME;
31          quality = OperationCandidate.DEFAULT_QUALITY;
32      }
33  
34      /***
35       * set selection state of this operation candidate.
36       *
37       * @param selected Set to <code>true</code> if candidate has been selected.
38       */
39      public void setSelected(boolean selected) {
40          this.selected = selected;
41      }
42  
43      /***
44       * set selection state to <code>true</code>
45       */
46      public void setSelected() {
47          this.selected = true;
48      }
49  
50      /***
51       * Test if this candidate has been selected.
52       *
53       * @return <code>true</code> if candidate has been selected, <code>false</code> otherwise.
54       */
55      public boolean isSelected() {
56          return selected;
57      }
58  
59      /***
60       * Set type.
61       */
62      public void setType(String type) {
63          this.type = type;
64      }
65  
66      /***
67       * Get the type.
68       */
69      public String getType() {
70          return type;
71      }
72  
73      /***
74       * Set operation name.
75       */
76      public void setOperationName(String name) {
77          this.operationName = name;
78      }
79  
80      /***
81       * Get the operation name.
82       */
83      public String getOperationName() {
84          return operationName;
85      }
86  
87      /***
88       * Set resource name.
89       */
90      public void setResourceName(String name) {
91          this.resourceName = name;
92      }
93  
94      /***
95       * Get resource name.
96       */
97      public String getResourceName() {
98          return resourceName;
99      }
100 
101     /***
102      * Set quality of this candidate.
103      *
104      * @param quality Quality as float value ranging from 0 to 1.
105      */
106     public void setQuality(float quality) {
107         this.quality = quality;
108     }
109 
110     /***
111      * Get quality of this candidate.
112      *
113      * @return Quality as float value ranging from 0 to 1.
114      */
115     public float getQuality() {
116         return quality;
117     }
118 
119     /***
120      * get abstraction degree of operation
121      *
122      * @return color
123      */
124     public int getAbstractionLevel() {
125         if (selected) return Operation.GREEN;
126         else return Operation.BLUE;
127     }
128 
129 }