/** * Adapts a raw-document substrate as an indexed document (factory method). * * @param substrate raw document to adapt */ private IndexedDocument<N, E, T> adapt(D substrate, DocumentSchema schema) { AnnotationTree<Object> annotations = new AnnotationTree<Object>(ONE_OBJECT, ANOTHER_OBJECT, null); IndexedDocumentImpl<N, E, T, ?> doc = new IndexedDocumentImpl<N, E, T, Void>(substrate, annotations, schema); return doc; }
private static IndexedDocumentImpl<Node, Element, Text, ?> doParseDocument(String documentString) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<blah>" + documentString + "</blah>"), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); return doc; }
private static IndexedDocumentImpl<Node, Element, Text, ?> doParseDocument(String documentString) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<blah>" + documentString + "</blah>"), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); return doc; }
@Override public IndexedDocument<N, E, T> build(DocInitialization operation, DocumentSchema schema) { AnnotationTree<Object> annotations = new AnnotationTree<Object>(ONE_OBJECT, ANOTHER_OBJECT, null); IndexedDocumentImpl<N, E, T, ?> doc = new IndexedDocumentImpl<N, E, T, Void>( substrateProvider.create("doc", Attributes.EMPTY_MAP), annotations, schema); try { doc.consume(operation); } catch (OperationException e) { throw new OperationRuntimeException("Invalid initialization", e); } return doc; }
private static IndexedDocumentImpl<Node, Element, Text, ?> doCopyDocument( IndexedDocumentImpl<Node, Element, Text, ?> other) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.create("doc", Attributes.EMPTY_MAP), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); try { doc.consume(other.asOperation()); } catch (OperationException e) { throw new OperationRuntimeException("Copy should not fail", e); } return doc; }
private static IndexedDocumentImpl<Node, Element, Text, ?> doCopyDocument( IndexedDocumentImpl<Node, Element, Text, ?> other) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.create("doc", Attributes.EMPTY_MAP), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); try { doc.consume(other.asOperation()); } catch (OperationException e) { throw new OperationRuntimeException("Copy should not fail", e); } return doc; }
DocumentSchema constraints = DocumentSchema.NO_SCHEMA_CONSTRAINTS; IndexedDocument<Node, Element, Text> doc = new IndexedDocumentImpl<Node, Element, Text, Void>(RawDocumentImpl.PROVIDER.parse("<a></a>"), new AnnotationTree<Object>("a", "b", null), constraints); AutomatonDocument autoDoc = Automatons.fromReadable(doc); doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<a></a>"), new AnnotationTree<Object>("a", "b", null), constraints);
DocumentSchema constraints = DocumentSchema.NO_SCHEMA_CONSTRAINTS; IndexedDocument<Node, Element, Text> doc = new IndexedDocumentImpl<Node, Element, Text, Void>(RawDocumentImpl.PROVIDER.parse("<a></a>"), new AnnotationTree<Object>("a", "b", null), constraints); AutomatonDocument autoDoc = Automatons.fromReadable(doc); doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<a></a>"), new AnnotationTree<Object>("a", "b", null), constraints);
"a", "b", null); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>"), annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
"a", "b", null); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>"), annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
RawDocumentImpl rawDoc = RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>"); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>(rawDoc, annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
RawDocumentImpl rawDoc = RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>"); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>(rawDoc, annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
"a", "b", null); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
"a", "b", null); IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), annotations, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
public void testRangedAnnotationIterator() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), new AnnotationTree<Object>("a", "b", null), DocumentSchema.NO_SCHEMA_CONSTRAINTS);
public void testRangedAnnotationIterator() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), new AnnotationTree<Object>("a", "b", null), DocumentSchema.NO_SCHEMA_CONSTRAINTS);
public void testAnnotationIntervalIterator() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), new AnnotationTree<Object>("a", "b", null), DocumentSchema.NO_SCHEMA_CONSTRAINTS);
public void testAnnotationIntervalIterator() throws OperationException { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.parse("<doc><x><p>abcdefgh</p></x></doc>"), new AnnotationTree<Object>("a", "b", null), DocumentSchema.NO_SCHEMA_CONSTRAINTS);
new IndexedDocumentImpl<Node, Element, Text, Void>(persistentDoc, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS);
new IndexedDocumentImpl<Node, Element, Text, Void>(persistentDoc, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS);