Package org.encog.bot.browse.range

Examples of org.encog.bot.browse.range.Link


   * @param tag
   *            The beginning tag.
   */

  protected final void loadLink(final int index, final Tag tag) {
    final Link link = new Link(this.page);
    final String href = tag.getAttributeValue("href");

    if (href != null) {
      link.setTarget(new Address(this.base, href));
      link.setBegin(index);
      link.setEnd(findEndTag(index + 1, tag));
      this.page.addContent(link);
    }
  }
View Full Code Here


   * @return The link that contains the specified string.
   */
  public final Link findLink(final String str) {
    for (final DocumentRange span : getContents()) {
      if (span instanceof Link) {
        final Link link = (Link) span;
        if (link.getTextOnly().equals(str)) {
          return link;
        }
      }
    }
    return null;
View Full Code Here

   
    DocumentRange span = page.getContents().get(0);
    Assert.assertEquals(0, span.getBegin());
    Assert.assertEquals(5, span.getEnd());
    Assert.assertTrue(span instanceof Link);
    Link link = (Link)span;
    Assert.assertEquals("index.html",link.getTarget().getOriginal().toString());
    Address address = link.getTarget();
    Assert.assertNotNull(address.toString());
   
  }
View Full Code Here

   * @return The link that contains the specified string.
   */
  public final Link findLink(final String str) {
    for (final DocumentRange span : getContents()) {
      if (span instanceof Link) {
        final Link link = (Link) span;
        if (link.getTextOnly().equals(str)) {
          return link;
        }
      }
    }
    return null;
View Full Code Here

   * @param tag
   *            The beginning tag.
   */

  protected final void loadLink(final int index, final Tag tag) {
    final Link link = new Link(this.page);
    final String href = tag.getAttributeValue("href");

    if (href != null) {
      link.setTarget(new Address(this.base, href));
      link.setBegin(index);
      link.setEnd(findEndTag(index + 1, tag));
      this.page.addContent(link);
    }
  }
View Full Code Here

   
    DocumentRange span = page.getContents().get(0);
    Assert.assertEquals(0, span.getBegin());
    Assert.assertEquals(5, span.getEnd());
    Assert.assertTrue(span instanceof Link);
    Link link = (Link)span;
    Assert.assertEquals("index.html",link.getTarget().getOriginal().toString());
    Address address = link.getTarget();
    Assert.assertNotNull(address.toString());
   
  }
View Full Code Here

TOP

Related Classes of org.encog.bot.browse.range.Link

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.