View Javadoc
1   package com.simpligility.maven.plugins.android.configuration;
2   
3   /**
4    * Configuration element inside MonkeyRunner configuration. It represents both filename and options for a given
5    * monkeyrunner program execution.
6    * 
7    * @author Stéphane Nicolas - snicolas@octo.com
8    */
9   public class Program
10  {
11      /**
12       * Constructor used for parsing.
13       */
14      public Program()
15      {
16          // do not remove, used by parsing.
17      }
18  
19      /**
20       * Constructor used for testing.
21       * 
22       * @param filename
23       * @param options
24       */
25      public Program( String filename, String options )
26      {
27          this.filename = filename;
28          this.options = options;
29      }
30  
31      /**
32       * Mirror of {@link com.jayway.maven.plugins.android.standalonemojos.MonkeyRunner#filename}
33       */
34      private String filename;
35      /**
36       * Mirror of {@link com.jayway.maven.plugins.android.standalonemojos.MonkeyRunner#options}
37       */
38      private String options;
39  
40      public String getFilename()
41      {
42          return filename;
43      }
44  
45      public String getOptions()
46      {
47          return options;
48      }
49  
50      // ----------------------------------
51      // TESTING METHODS
52      // ----------------------------------
53      @Override
54      public int hashCode()
55      {
56          final int prime = 31;
57          int result = 1;
58          result = prime * result + ( filename == null ? 0 : filename.hashCode() );
59          result = prime * result + ( options == null ? 0 : options.hashCode() );
60          return result;
61      }
62  
63      @Override
64      public boolean equals( Object obj )
65      {
66          if ( this == obj )
67          {
68              return true;
69          }
70          if ( obj == null )
71          {
72              return false;
73          }
74          if ( getClass() != obj.getClass() )
75          {
76              return false;
77          }
78          Program other = (Program) obj;
79          if ( filename == null )
80          {
81              if ( other.filename != null )
82              {
83                  return false;
84              }
85          }
86          else if ( !filename.equals( other.filename ) )
87          {
88              return false;
89          }
90          if ( options == null )
91          {
92              if ( other.options != null )
93              {
94                  return false;
95              }
96          }
97          else if ( !options.equals( other.options ) )
98          {
99              return false;
100         }
101         return true;
102     }
103 
104 }