Package org.openxri.xri3.impl.parser

Examples of org.openxri.xri3.impl.parser.Rule$IPv4address


    // The library can also construct new XRIs or XRI components.
    // For example, if we have an XRI +name, and a relative XRI reference +first,
    // we can construct a new XRI +name+first

    XRI xri = new XRI3("+name");
    XRIReference xriReference = new XRI3Reference("+first");

    System.out.println("Got XRI " + xri.toString());
    System.out.println("Got XRI reference " + xriReference.toString());

    XRI xriNew = new XRI3(xri, xriReference);
   
    System.out.println("Constructed new XRI " + xriNew.toString());
  }
View Full Code Here


    long time = System.currentTimeMillis();

    XRISubSegment subSegment;

    subSegment = new XRI3SubSegment("*earth");
    assertFalse(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertFalse(subSegment.isGlobal());
    assertTrue(subSegment.isLocal());
    assertTrue(subSegment.isReassignable());
    assertFalse(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "earth");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("@free");
    assertTrue(subSegment.hasGCS());
    assertFalse(subSegment.hasLCS());
    assertTrue(subSegment.isGlobal());
    assertFalse(subSegment.isLocal());
    assertTrue(subSegment.isReassignable());
    assertFalse(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "free");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+!16");
    assertTrue(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertTrue(subSegment.isGlobal());
    assertFalse(subSegment.isLocal());
    assertFalse(subSegment.isReassignable());
    assertTrue(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "16");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("!canonical");
    assertFalse(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertFalse(subSegment.isGlobal());
    assertTrue(subSegment.isLocal());
    assertFalse(subSegment.isReassignable());
    assertTrue(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "canonical");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+(@free*earth*moon)");
    assertEquals(subSegment.getGCS(), XRI3Constants.GCS_PLUS);
    assertEquals(subSegment.getLCS(), null);
    assertFalse(subSegment.hasLiteral());
    assertTrue(subSegment.hasXRef());
    assertEquals(subSegment.getXRef(), "(@free*earth*moon)");
    assertTrue(subSegment.getXRef().hasXRIReference());
    assertFalse(subSegment.getXRef().hasIRI());
    assertEquals(subSegment.getXRef().getXRIReference(), "@free*earth*moon");
    assertEquals(subSegment.getXRef().getXRIReference().getAuthority().getNumSubSegments(), 3);
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+(http://schemas.xmlsoap.org)");
    assertEquals(subSegment.getGCS(), XRI3Constants.GCS_PLUS);
    assertEquals(subSegment.getLCS(), null);
    assertFalse(subSegment.hasLiteral());
    assertTrue(subSegment.hasXRef());
    assertEquals(subSegment.getXRef(), "(http://schemas.xmlsoap.org)");
View Full Code Here

    assertEquals(xri1.getAuthority().getSubSegment(0).getXRef().getXRIReference(), null);
    assertEquals(xri1.getAuthority().getSubSegment(0).getXRef().getIRI(), "http://markus.openid.net");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    xriAuthority1 = new XRI3Authority("=!B7BD.2A1D.1040.58CD");
    xriSubSegment1 = new XRI3SubSegment("!2000");
    xriAuthority2 = new XRI3Authority(xriAuthority1, xriSubSegment1);
    assertEquals(xriAuthority2, "=!B7BD.2A1D.1040.58CD!2000");
    assertEquals(xriAuthority2.getNumSubSegments(), 2);
    assertEquals(xriAuthority2.getSubSegment(0), "=!B7BD.2A1D.1040.58CD");
    assertEquals(xriAuthority2.getSubSegment(0).getGCS(), XRI3Constants.GCS_EQUALS);
    assertEquals(xriAuthority2.getSubSegment(0).getLCS(), XRI3Constants.LCS_BANG);
    assertEquals(xriAuthority2.getSubSegment(0).getLiteral(), "B7BD.2A1D.1040.58CD");
    assertEquals(xriAuthority2.getSubSegment(1), "!2000");
    assertEquals(xriAuthority2.getSubSegment(1).getGCS(), null);
    assertEquals(xriAuthority2.getSubSegment(1).getLCS(), XRI3Constants.LCS_BANG);
    assertEquals(xriAuthority2.getSubSegment(1).getLiteral(), "2000");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    character = new Character('=');
    xriSubSegment1 = new XRI3SubSegment("!B7BD.2A1D.1040.58CD");
    xriSubSegment2 = new XRI3SubSegment(character, xriSubSegment1);
    assertEquals(xriSubSegment2, "=!B7BD.2A1D.1040.58CD");
    assertEquals(xriSubSegment2, "=!B7BD.2A1D.1040.58CD");
    assertEquals(xriSubSegment2.getGCS(), XRI3Constants.GCS_EQUALS);
    assertEquals(xriSubSegment2.getLCS(), XRI3Constants.LCS_BANG);
    assertEquals(xriSubSegment2.getLiteral(), "B7BD.2A1D.1040.58CD");
View Full Code Here

    long time = System.currentTimeMillis();

    XRISubSegment subSegment;

    subSegment = new XRI3SubSegment("*earth");
    assertFalse(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertFalse(subSegment.isGlobal());
    assertTrue(subSegment.isLocal());
    assertTrue(subSegment.isReassignable());
    assertFalse(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "earth");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("@free");
    assertTrue(subSegment.hasGCS());
    assertFalse(subSegment.hasLCS());
    assertTrue(subSegment.isGlobal());
    assertFalse(subSegment.isLocal());
    assertTrue(subSegment.isReassignable());
    assertFalse(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "free");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+!16");
    assertTrue(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertTrue(subSegment.isGlobal());
    assertFalse(subSegment.isLocal());
    assertFalse(subSegment.isReassignable());
    assertTrue(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "16");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("!canonical");
    assertFalse(subSegment.hasGCS());
    assertTrue(subSegment.hasLCS());
    assertFalse(subSegment.isGlobal());
    assertTrue(subSegment.isLocal());
    assertFalse(subSegment.isReassignable());
    assertTrue(subSegment.isPersistent());
    assertEquals(subSegment.getLiteral(), "canonical");
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+(@free*earth*moon)");
    assertEquals(subSegment.getGCS(), XRI3Constants.GCS_PLUS);
    assertEquals(subSegment.getLCS(), null);
    assertFalse(subSegment.hasLiteral());
    assertTrue(subSegment.hasXRef());
    assertEquals(subSegment.getXRef(), "(@free*earth*moon)");
    assertTrue(subSegment.getXRef().hasXRIReference());
    assertFalse(subSegment.getXRef().hasIRI());
    assertEquals(subSegment.getXRef().getXRIReference(), "@free*earth*moon");
    assertEquals(subSegment.getXRef().getXRIReference().getAuthority().getNumSubSegments(), 3);
    System.out.println(Long.toString(System.currentTimeMillis() - time) + " ms");

    subSegment = new XRI3SubSegment("+(http://schemas.xmlsoap.org)");
    assertEquals(subSegment.getGCS(), XRI3Constants.GCS_PLUS);
    assertEquals(subSegment.getLCS(), null);
    assertFalse(subSegment.hasLiteral());
    assertTrue(subSegment.hasXRef());
    assertEquals(subSegment.getXRef(), "(http://schemas.xmlsoap.org)");
View Full Code Here

public class PrintTest {

  public static void main(String[] args) {
   
    Parser parser = new Parser();
    Rule rule = parser.parse("xri", "@cordance/documentation/xri?page=overview#introduction");
    new TreeDisplayer(System.out).visit(rule);
  }
View Full Code Here

public class XRI3Util {
 
  public static Parser getParser() {
   
    return(new Parser());
  }
View Full Code Here

public class PrintTest {

  public static void main(String[] args) {
   
    Parser parser = new Parser();
    Rule rule = parser.parse("xri", "@cordance/documentation/xri?page=overview#introduction");
    new TreeDisplayer(System.out).visit(rule);
  }
View Full Code Here

public class PrintTest {

  public static void main(String[] args) throws IllegalArgumentException, ParserException {

    Rule$xri rule = (Rule$xri) Parser.parse("xri", "@cordance/documentation/xri?page=overview#introduction");
    new XmlDisplayer().visit(rule);
  }
View Full Code Here

  public static void main(String[] args) {
   
    Parser parser = new Parser();
    Rule rule = parser.parse("xri", "@cordance/documentation/xri?page=overview#introduction");
    new TreeDisplayer(System.out).visit(rule);
  }
View Full Code Here

public class PrintTest {

  public static void main(String[] args) throws IllegalArgumentException, ParserException {

    Rule$xri rule = (Rule$xri) Parser.parse("xri", "@cordance/documentation/xri?page=overview#introduction");
    new XmlDisplayer().visit(rule);
  }
View Full Code Here

TOP

Related Classes of org.openxri.xri3.impl.parser.Rule$IPv4address

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.