EMMA Coverage Report (generated Tue Apr 17 08:51:20 BST 2007)
[all classes][org.jtoolkit.essence.data.impl]

COVERAGE SUMMARY FOR SOURCE FILE [NetStore.java]

nameclass, %method, %block, %line, %
NetStore.java100% (1/1)23%  (5/22)28%  (79/285)30%  (11.5/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NetStore100% (1/1)23%  (5/22)28%  (79/285)30%  (11.5/38)
add (Object): boolean 0%   (0/1)0%   (0/13)0%   (0/1)
asMap (): Map 0%   (0/1)0%   (0/18)0%   (0/3)
clear (): void 0%   (0/1)0%   (0/8)0%   (0/2)
containsKey (Object): boolean 0%   (0/1)0%   (0/13)0%   (0/1)
containsValue (Object): boolean 0%   (0/1)0%   (0/13)0%   (0/1)
doRemove (Object, boolean, Object): Object 0%   (0/1)0%   (0/20)0%   (0/1)
first (): Object 0%   (0/1)0%   (0/7)0%   (0/1)
firstKey (): Object 0%   (0/1)0%   (0/7)0%   (0/1)
get (Object): Object 0%   (0/1)0%   (0/11)0%   (0/1)
getSize (): int 0%   (0/1)0%   (0/9)0%   (0/1)
keySet (): Set 0%   (0/1)0%   (0/18)0%   (0/3)
orderedValues (): Collection 0%   (0/1)0%   (0/18)0%   (0/3)
put0 (Object, Object): void 0%   (0/1)0%   (0/4)0%   (0/1)
remove (Object): Object 0%   (0/1)0%   (0/11)0%   (0/1)
removeFirst (): Object 0%   (0/1)0%   (0/7)0%   (0/1)
values (): Collection 0%   (0/1)0%   (0/18)0%   (0/3)
visit (Visitor): Object 0%   (0/1)0%   (0/5)0%   (0/1)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
newNetStore (Store$CollectionType, NetObject): NetStore 100% (1/1)88%  (29/33)95%  (4.7/5)
NetStore (Store$CollectionType, DataValueClass, DataValueClass, NetObject): void 100% (1/1)100% (15/15)100% (3/3)
close (): void 100% (1/1)100% (4/4)100% (2/2)
doPut (Object, Object, boolean, boolean): Object 100% (1/1)100% (25/25)100% (1/1)

1package org.jtoolkit.essence.data.impl;
2 
3import org.jetbrains.annotations.NotNull;
4import org.jetbrains.annotations.Nullable;
5import org.jtoolkit.essence.app.net.NetObject;
6import org.jtoolkit.essence.app.pojo.impl.DataValueClass;
7import org.jtoolkit.essence.concurrency.ThreadSafe;
8import org.jtoolkit.essence.concurrency.Concurrency;
9import org.jtoolkit.essence.data.Store;
10import org.jtoolkit.essence.data.Visitor;
11import org.jtoolkit.essence.data.VisitorException;
12import org.jtoolkit.essence.utils.IOUtils;
13import org.jtoolkit.essence.utils.Pair;
14 
15import java.util.Map;
16import java.util.Set;
17import java.util.Collection;
18/*
19   Copyright 2006 Peter Lawrey
20 
21   Licensed under the Apache License, Version 2.0 (the "License");
22   you may not use this file except in compliance with the License.
23   You may obtain a copy of the License at
24 
25       http://www.apache.org/licenses/LICENSE-2.0
26 
27   Unless required by applicable law or agreed to in writing, software
28   distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
29   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30   See the License for the specific language governing permissions and
31   limitations under the License.
32*/
33 
34/**
35 * @author Peter Lawrey
36 * @noinspection RedundantTypeArguments
37 */
38@ThreadSafe(Concurrency.CONCURRENT_READ_WRITE)
39public class NetStore<K, V> extends AbstractStore<K, V> {
40    private final NetObject<Store<K, V>> netObject;
41 
42    public static <K, V> NetStore<K, V> newNetStore(@NotNull CollectionType collectionType, @NotNull NetObject<Store<K, V>> netObject) {
43        Pair<Class<K>, Class<V>> classes = netObject.call("getClasses");
44        assert classes != null;
45        DataValueClass<K> keyClass = DataValueClass.acquire(classes.first);
46        DataValueClass<V> valueClass = DataValueClass.acquire(classes.second);
47        return new NetStore<K, V>(collectionType, keyClass, valueClass, netObject);
48    }
49 
50    private NetStore(@NotNull CollectionType collectionType, @NotNull DataValueClass<K> keyClass, @NotNull DataValueClass<V> valueClass, @NotNull NetObject<Store<K, V>> netObject) {
51        super(netObject.getName(), collectionType, keyClass, valueClass, netObject.getListenerSet(), ReadMode.MINIMAL, PersistMode.SYNC);
52        this.netObject = netObject;
53    }
54 
55    protected boolean add(@NotNull V value) {
56        return netObject.<Boolean>call("add", value);
57    }
58 
59    protected boolean containsKey(@NotNull Object key) {
60        return netObject.<Boolean>call("containsKey", key);
61    }
62 
63    protected boolean containsValue(@NotNull Object value) {
64        return netObject.<Boolean>call("containsValue", value);
65    }
66 
67    protected void clear() {
68        netObject.call("clear");
69    }
70 
71    @NotNull public Map<K, V> asMap() {
72        Map<K, V> map = netObject.call("asMap");
73        assert map != null;
74        return map;
75    }
76 
77    @Nullable protected V first() {
78        return netObject.<V>call("first");
79    }
80 
81    @Nullable protected K firstKey() {
82        return netObject.<K>call("firstKey");
83    }
84 
85    @Nullable protected V get(@NotNull Object key) {
86        return netObject.<V>call("get", key);
87    }
88 
89    @NotNull protected Set<K> keySet() {
90        Set<K> keySet = netObject.call("keySet");
91        assert keySet != null;
92        return keySet;
93    }
94 
95    @Nullable protected V doPut(@NotNull K key, @NotNull V value, boolean ifAbsent, boolean ifPresent) {
96        return netObject.<V>call("doPut", key, value, ifAbsent, ifPresent);
97    }
98 
99    protected V doRemove(@NotNull K key, boolean byValue, V value) {
100        return netObject.<V>call("doRemove", key, byValue, value);
101    }
102 
103    protected void put0(K key, V value) {
104        throw new UnsupportedOperationException();
105    }
106 
107    @Nullable protected V remove(@NotNull Object key) {
108        return netObject.<V>call("remove", key);
109    }
110 
111    @Nullable protected V removeFirst() {
112        return netObject.<V>call("removeFirst");
113    }
114 
115    protected int getSize() {
116        return netObject.<Integer>call("getSize");
117    }
118 
119    @NotNull protected Collection<V> values() {
120        Collection<V> vs = netObject.call("values");
121        assert vs != null;
122        return vs;
123    }
124 
125    protected Collection<V> orderedValues() {
126        Collection<V> vs = netObject.call("orderedValues");
127        assert vs != null;
128        return vs;
129    }
130 
131    public void close() {
132        IOUtils.close(netObject);
133    }
134 
135    public <R> R visit(@NotNull Visitor<Store<K, V>, R> visitor) throws VisitorException {
136        return netObject.visit(visitor);
137    }
138}

[all classes][org.jtoolkit.essence.data.impl]
EMMA 2.0.5312 (C) Vladimir Roubtsov