4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
MatcherWrapper.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Subproject: Position of fragment of text in XML document
4  * Authors: Peter Bartoš, Michael Angelov
5  * File: MatcherWrapper.java
6  * Description: Wrapper class for matcher
7  */
8 
9 /**
10  * @file MatcherWrapper.java
11  *
12  * @brief Wrapper class for matcher
13  */
14 
15 package cz.vutbr.fit.knot.annotations.fragmentUpdater;
16 
17 /**
18  * Wrapper class for matcher
19  *
20  * @brief Wrapper class for matcher
21  * @author Peter Bartoš, Michael Angelov
22  */
23 public class MatcherWrapper implements Comparable {
24 
25  public Matcher matcher;
26  private int priority;
27 
28  /**
29  * Constructor
30  *
31  * @param matcher matcher
32  * @param priority priority of matcher
33  */
35  this.matcher = matcher;
36  this.priority = priority;
37  }
38 
39  /**
40  * Setter for priority
41  *
42  * @param priority priority of matcher
43  */
44  public void setPriority(int priority) {
45  this.priority = priority;
46  }
47 
48 
49  /**
50  * Getter for priority
51  *
52  * @return priority of matcher
53  */
54  public int getPriority() {
55  return priority;
56  }
57 
58 
59  /**
60  * Implemented comparedTo() method
61  *
62  * @param o distant object
63  * @return {0, 1, -1} according to matchers priority
64  */
65  public int compareTo(Object o) {
67  if (mw.priority > priority) {
68  return -1;
69  } else if (mw.priority < priority) {
70  return 1;
71  } else {
72  return 0;
73  }
74  }
75 
76  /**
77  * Overriden toString() method
78  *
79  * @return string representation of class
80  */
81  @Override
82  public String toString() {
83  return priority + "-" + matcher;
84  }
85 } // class MatcherWrapper
Class for matcher consisting of comparator and node iterator.
Definition: Matcher.java:32