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