EMMA Coverage Report (generated Mon Nov 01 16:48:29 PDT 2010)
[all classes][com.google.caja.ancillary.servlet]

COVERAGE SUMMARY FOR SOURCE FILE [Job.java]

nameclass, %method, %block, %line, %
Job.java100% (1/1)88%  (7/8)84%  (63/75)92%  (12/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Job100% (1/1)88%  (7/8)84%  (63/75)92%  (12/13)
Job (ContentType, Object, Node, URI): void 100% (1/1)100% (15/15)100% (6/6)
css (CssTree$DeclarationGroup, Attr, URI): Job 100% (1/1)100% (8/8)100% (1/1)
css (CssTree$StyleSheet, Element, URI): Job 100% (1/1)100% (8/8)100% (1/1)
html (DocumentFragment, URI): Job 100% (1/1)100% (8/8)100% (1/1)
js (Block, Node, URI): Job 100% (1/1)100% (8/8)100% (1/1)
json (ObjectConstructor, URI): Job 100% (1/1)100% (8/8)100% (1/1)
toString (): String 0%   (0/1)0%   (0/12)0%   (0/1)
zip (byte []): Job 100% (1/1)100% (8/8)100% (1/1)

1// Copyright (C) 2009 Google Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package com.google.caja.ancillary.servlet;
16 
17import com.google.caja.parser.css.CssTree;
18import com.google.caja.parser.js.Block;
19import com.google.caja.parser.js.ObjectConstructor;
20import com.google.caja.util.ContentType;
21 
22import java.net.URI;
23 
24import org.w3c.dom.Attr;
25import org.w3c.dom.DocumentFragment;
26import org.w3c.dom.Element;
27import org.w3c.dom.Node;
28 
29/**
30 * A parse tree with meta information.
31 *
32 * @author mikesamuel@gmail.com
33 */
34final class Job {
35  /** The type of the root. */
36  final ContentType t;
37  /** A parse tree node or other content. */
38  final Object root;
39  /**
40   * The place in the input HTML from where the job was extracted.
41   * For JS this might be a {@code script} element or {@code onclick} attribute.
42   */
43  final Node origin;
44  /** Base URI for the job */
45  final URI baseUri;
46 
47  private Job(ContentType t, Object root, Node origin, URI baseUri) {
48    this.t = t;
49    this.root = root;
50    this.origin = origin;
51    this.baseUri = baseUri;
52  }
53 
54  static Job js(Block root, Node origin, URI baseUri) {
55    return new Job(ContentType.JS, root, origin, baseUri);
56  }
57 
58  static Job json(ObjectConstructor root, URI baseUri) {
59    return new Job(ContentType.JSON, root, null, baseUri);
60  }
61 
62  static Job css(CssTree.StyleSheet css, Element origin, URI baseUri) {
63    return new Job(ContentType.CSS, css, origin, baseUri);
64  }
65 
66  static Job css(CssTree.DeclarationGroup css, Attr origin, URI baseUri) {
67    return new Job(ContentType.CSS, css, origin, baseUri);
68  }
69 
70  static Job html(DocumentFragment fragment, URI baseUri) {
71    return new Job(ContentType.HTML, fragment, null, baseUri);
72  }
73 
74  static Job zip(byte[] zipBody) {
75    return new Job(ContentType.ZIP, zipBody, null, null);
76  }
77 
78  @Override
79  public String toString() { return "[Job " + t + "]"; }
80}

[all classes][com.google.caja.ancillary.servlet]
EMMA 2.0.5312 (C) Vladimir Roubtsov