View Javadoc

1   /**
2    * Copyright 2010 The University of Southampton, Yahoo Inc., and the
3    * individual contributors. All rights reserved.
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *    http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.openimaj.web.readability;
18  
19  /**
20   * Class to represent a simple HTML anchor tag.
21   * 
22   * @author Jonathon Hare (jsh2@ecs.soton.ac.uk)
23   *
24   */
25  public class Anchor {
26  	String text;
27  	String href;
28  	
29  	/** 
30  	 * Default constructor with text and a href.
31  	 * @param text
32  	 * @param href
33  	 */
34  	public Anchor(String text, String href) {
35  		this.text = text;
36  		this.href = href;
37  	}
38  	
39  	/**
40  	 * @return The anchor text
41  	 */
42  	public String getText() {
43  		return text;
44  	}
45  	
46  	/**
47  	 * Set the anchor text
48  	 * @param anchorText The text to set 
49  	 */
50  	public void setAnchorText(String anchorText) {
51  		this.text = anchorText;
52  	}
53  	
54  	/**
55  	 * @return The href
56  	 */
57  	public String getHref() {
58  		return href;
59  	}
60  	
61  	/**
62  	 * Set the href
63  	 * @param href the href to set
64  	 */
65  	public void setHref(String href) {
66  		this.href = href;
67  	}
68  	
69  	@Override
70  	public String toString() {
71  		return "(text: \""+ text+"\", url:\""+ href + "\")";
72  	}
73  }