~ubuntu-branches/ubuntu/raring/apgdiff/raring

« back to all changes in this revision

Viewing changes to src/main/java/cz/startnet/utils/pgdiff/schema/PgFunction.java

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2009-12-02 11:11:33 UTC
  • mfrom: (1.1.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20091202111133-k5wrh3zb2pzmbv8c
Tags: 1.4-1
* New upstream version. (Without changelog, I am afraid.)
* Test suite still not enabled as it needs network access. (The junit
  version in Debian needs upgrading.)
* Optimize rules files a bit so debhelper doesn't clean twice, and quilt's
  patch target doesn't prevent build-stamp from working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: PgFunction.java 90 2008-08-01 17:06:19Z fordfrog $
3
 
 */
4
1
package cz.startnet.utils.pgdiff.schema;
5
2
 
6
3
import java.util.regex.Matcher;
10
7
 * Stores function information.
11
8
 *
12
9
 * @author fordfrog
13
 
 * @version $Id: PgFunction.java 90 2008-08-01 17:06:19Z fordfrog $
14
10
 */
15
11
public class PgFunction {
16
12
 
18
14
     * Pattern for checking whether function definition contains CREATE
19
15
     * OR REPLACE FUNCTION string.
20
16
     */
21
 
    private static final Pattern PATTERN_CREATE_FUNCTION =
22
 
        Pattern.compile(
23
 
        "(?:CREATE[\\s]+FUNCTION)([\\s]+.*)",
24
 
        Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
 
17
    private static final Pattern PATTERN_CREATE_FUNCTION = Pattern.compile(
 
18
            "(?:CREATE[\\s]+FUNCTION)([\\s]+.*)",
 
19
            Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
25
20
    /**
26
21
     * Declaration of the function. Contains function name and
27
22
     * arguments.
141
136
     * @return {@inheritDoc}
142
137
     */
143
138
    public boolean equals(final Object object,
144
 
        final boolean ignoreFunctionWhitespace) {
 
139
            final boolean ignoreFunctionWhitespace) {
145
140
        boolean equals = false;
146
141
 
147
142
        if (this == object) {
154
149
            if (ignoreFunctionWhitespace) {
155
150
                thisDefinition = getDefinition().replaceAll("\\s+", " ");
156
151
                thatDefinition =
157
 
                    function.getDefinition().replaceAll("\\s+", " ");
 
152
                        function.getDefinition().replaceAll("\\s+", " ");
158
153
            } else {
159
154
                thisDefinition = getDefinition();
160
155
                thatDefinition = function.getDefinition();
161
156
            }
162
 
            equals =
163
 
                declaration.equals(function.declaration) && thisDefinition.
164
 
                equals(thatDefinition) && name.equals(function.name);
 
157
            equals = declaration.equals(function.declaration)
 
158
                    && thisDefinition.equals(thatDefinition)
 
159
                    && name.equals(function.name);
165
160
        }
166
161
 
167
162
        return equals;
174
169
     */
175
170
    @Override
176
171
    public int hashCode() {
177
 
        return (getClass().getName() + "|" + declaration + "|" + getDefinition() +
178
 
            "|" + name).hashCode();
 
172
        return (getClass().getName() + "|" + declaration + "|" + getDefinition()
 
173
                + "|" + name).hashCode();
179
174
    }
180
175
}