001    package org.maltparser.core.propagation.spec;
002    
003    /**
004     * @author Johan Hall
005     *
006     */
007    public class PropagationSpec {
008            public static final long serialVersionUID = 1L;
009            private String from;
010            private String to;
011            private String _for; // for
012            private String over;
013            
014            public PropagationSpec(String from, String to, String _for, String over) {
015                    setFrom(from);
016                    setTo(to);
017                    setFor(_for);
018                    setOver(over);
019            }
020            
021            public String getFrom() {
022                    return from;
023            }
024            
025            public void setFrom(String from) {
026                    this.from = from;
027            }
028            
029            public String getTo() {
030                    return to;
031            }
032            
033            public void setTo(String to) {
034                    this.to = to;
035            }
036            
037            public String getFor() {
038                    return _for;
039            }
040            
041            public void setFor(String _for) {
042                    this._for = _for;
043            }
044            
045            public String getOver() {
046                    return over;
047            }
048            
049            public void setOver(String over) {
050                    this.over = over;
051            }
052    
053            @Override
054            public int hashCode() {
055                    final int prime = 31;
056                    int result = 1;
057                    result = prime * result + ((_for == null) ? 0 : _for.hashCode());
058                    result = prime * result + ((from == null) ? 0 : from.hashCode());
059                    result = prime * result + ((over == null) ? 0 : over.hashCode());
060                    result = prime * result + ((to == null) ? 0 : to.hashCode());
061                    return result;
062            }
063    
064            @Override
065            public boolean equals(Object obj) {
066                    if (this == obj)
067                            return true;
068                    if (obj == null)
069                            return false;
070                    if (getClass() != obj.getClass())
071                            return false;
072                    PropagationSpec other = (PropagationSpec) obj;
073                    if (_for == null) {
074                            if (other._for != null)
075                                    return false;
076                    } else if (!_for.equals(other._for))
077                            return false;
078                    if (from == null) {
079                            if (other.from != null)
080                                    return false;
081                    } else if (!from.equals(other.from))
082                            return false;
083                    if (over == null) {
084                            if (other.over != null)
085                                    return false;
086                    } else if (!over.equals(other.over))
087                            return false;
088                    if (to == null) {
089                            if (other.to != null)
090                                    return false;
091                    } else if (!to.equals(other.to))
092                            return false;
093                    return true;
094            }
095    
096            @Override
097            public String toString() {
098                    StringBuilder sb = new StringBuilder();
099                    sb.append("FROM: "); sb.append(from);sb.append("\n");
100                    sb.append("TO  : "); sb.append(to);sb.append("\n");
101                    sb.append("FOR : "); sb.append(_for);sb.append("\n");
102                    sb.append("OVER: "); sb.append(over);sb.append("\n");
103                    return sb.toString();
104            }
105    }