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

COVERAGE SUMMARY FOR SOURCE FILE [IhtmlL10NContext.java]

nameclass, %method, %block, %line, %
IhtmlL10NContext.java100% (1/1)60%  (3/5)68%  (21/31)75%  (6/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IhtmlL10NContext100% (1/1)60%  (3/5)68%  (21/31)75%  (6/8)
IhtmlL10NContext (Locale, Map): void 100% (1/1)100% (12/12)100% (4/4)
getLocale (): Locale 100% (1/1)100% (3/3)100% (1/1)
getMessageByName (String): LocalizedHtml 100% (1/1)100% (6/6)100% (1/1)
getMessageNames (): Iterable 0%   (0/1)0%   (0/5)0%   (0/1)
isLeftToRight (): boolean 0%   (0/1)0%   (0/5)0%   (0/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.plugin.templates;
16 
17import java.awt.ComponentOrientation;
18 
19import java.util.Collections;
20import java.util.LinkedHashMap;
21import java.util.Locale;
22import java.util.Map;
23 
24/**
25 * The locale context in which a template is compiled.  Encapsulates the
26 * message strings for a locale, and details of the character set, such as
27 * whether it is right-to-left or left-to-right.
28 *
29 * @author mikesamuel@gmail.com
30 */
31public final class IhtmlL10NContext {
32  private final Locale locale;
33  private final Map<String, LocalizedHtml> messages;
34 
35  public IhtmlL10NContext(Locale locale, Map<String, LocalizedHtml> messages) {
36    this.locale = locale;
37    this.messages = new LinkedHashMap<String, LocalizedHtml>(messages);
38  }
39 
40  public LocalizedHtml getMessageByName(String messageName) {
41    return messages.get(messageName);
42  }
43 
44  public boolean isLeftToRight() {
45    return ComponentOrientation.getOrientation(locale).isLeftToRight();
46  }
47 
48  public Iterable<String> getMessageNames() {
49    return Collections.unmodifiableCollection(messages.keySet());
50  }
51 
52  public Locale getLocale() {
53    return locale;
54  }
55}

[all classes][com.google.caja.plugin.templates]
EMMA 2.0.5312 (C) Vladimir Roubtsov