EMMA Coverage Report (generated Tue Oct 27 11:32:50 PDT 2009)
[all classes][net.spy.memcached.protocol.binary]

COVERAGE SUMMARY FOR SOURCE FILE [BinaryOperationFactory.java]

nameclass, %method, %block, %line, %
BinaryOperationFactory.java100% (1/1)100% (14/14)100% (149/149)100% (22/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BinaryOperationFactory100% (1/1)100% (14/14)100% (149/149)100% (22/22)
BinaryOperationFactory (): void 100% (1/1)100% (3/3)100% (1/1)
cas (StoreType, String, long, int, int, byte [], OperationCallback): CASOpera... 100% (1/1)100% (11/11)100% (1/1)
cat (ConcatenationType, long, String, byte [], OperationCallback): Concatenat... 100% (1/1)100% (9/9)100% (1/1)
cloneGet (KeyedOperation): Collection 100% (1/1)100% (59/59)100% (9/9)
delete (String, OperationCallback): DeleteOperation 100% (1/1)100% (6/6)100% (1/1)
flush (int, OperationCallback): FlushOperation 100% (1/1)100% (5/5)100% (1/1)
get (Collection, GetOperation$Callback): GetOperation 100% (1/1)100% (6/6)100% (1/1)
get (String, GetOperation$Callback): GetOperation 100% (1/1)100% (6/6)100% (1/1)
gets (String, GetsOperation$Callback): GetsOperation 100% (1/1)100% (6/6)100% (1/1)
mutate (Mutator, String, int, long, int, OperationCallback): MutatorOperation 100% (1/1)100% (11/11)100% (1/1)
noop (OperationCallback): NoopOperation 100% (1/1)100% (5/5)100% (1/1)
stats (String, StatsOperation$Callback): StatsOperation 100% (1/1)100% (6/6)100% (1/1)
store (StoreType, String, int, int, byte [], OperationCallback): StoreOperation 100% (1/1)100% (11/11)100% (1/1)
version (OperationCallback): VersionOperation 100% (1/1)100% (5/5)100% (1/1)

1package net.spy.memcached.protocol.binary;
2 
3import java.util.ArrayList;
4import java.util.Collection;
5 
6import net.spy.memcached.ops.BaseOperationFactory;
7import net.spy.memcached.ops.CASOperation;
8import net.spy.memcached.ops.ConcatenationOperation;
9import net.spy.memcached.ops.ConcatenationType;
10import net.spy.memcached.ops.DeleteOperation;
11import net.spy.memcached.ops.FlushOperation;
12import net.spy.memcached.ops.GetOperation;
13import net.spy.memcached.ops.GetsOperation;
14import net.spy.memcached.ops.KeyedOperation;
15import net.spy.memcached.ops.MultiGetOperationCallback;
16import net.spy.memcached.ops.MultiGetsOperationCallback;
17import net.spy.memcached.ops.Mutator;
18import net.spy.memcached.ops.MutatorOperation;
19import net.spy.memcached.ops.NoopOperation;
20import net.spy.memcached.ops.Operation;
21import net.spy.memcached.ops.OperationCallback;
22import net.spy.memcached.ops.StatsOperation;
23import net.spy.memcached.ops.StoreOperation;
24import net.spy.memcached.ops.StoreType;
25import net.spy.memcached.ops.VersionOperation;
26import net.spy.memcached.ops.GetOperation.Callback;
27 
28/**
29 * Factory for binary operations.
30 */
31public class BinaryOperationFactory extends BaseOperationFactory {
32 
33        public DeleteOperation delete(String key,
34                OperationCallback operationCallback) {
35                return new DeleteOperationImpl(key, operationCallback);
36        }
37 
38        public FlushOperation flush(int delay, OperationCallback cb) {
39                return new FlushOperationImpl(cb);
40        }
41 
42        public GetOperation get(String key, Callback callback) {
43                return new GetOperationImpl(key, callback);
44        }
45 
46        public GetOperation get(Collection<String> value, Callback cb) {
47                return new MultiGetOperationImpl(value, cb);
48        }
49 
50        public GetsOperation gets(String key, GetsOperation.Callback cb) {
51                return new GetOperationImpl(key, cb);
52        }
53 
54        public MutatorOperation mutate(Mutator m, String key, int by,
55                        long def, int exp, OperationCallback cb) {
56                return new MutatorOperationImpl(m, key, by, def, exp, cb);
57        }
58 
59        public StatsOperation stats(String arg,
60                        net.spy.memcached.ops.StatsOperation.Callback cb) {
61                return new StatsOperationImpl(arg, cb);
62        }
63 
64        public StoreOperation store(StoreType storeType, String key, int flags,
65                        int exp, byte[] data, OperationCallback cb) {
66                return new StoreOperationImpl(storeType, key, flags, exp, data, 0, cb);
67        }
68 
69        public VersionOperation version(OperationCallback cb) {
70                return new VersionOperationImpl(cb);
71        }
72 
73        public NoopOperation noop(OperationCallback cb) {
74                return new NoopOperationImpl(cb);
75        }
76 
77        public CASOperation cas(StoreType type, String key, long casId, int flags,
78                        int exp, byte[] data, OperationCallback cb) {
79                return new StoreOperationImpl(type, key, flags, exp, data,
80                                casId, cb);
81        }
82 
83        public ConcatenationOperation cat(ConcatenationType catType, long casId,
84                        String key, byte[] data, OperationCallback cb) {
85                return new ConcatenationOperationImpl(catType, key, data, casId, cb);
86        }
87 
88        @Override
89        protected Collection<? extends Operation> cloneGet(KeyedOperation op) {
90                Collection<Operation> rv=new ArrayList<Operation>();
91                GetOperation.Callback getCb = null;
92                GetsOperation.Callback getsCb = null;
93                if(op.getCallback() instanceof GetOperation.Callback) {
94                        getCb=new MultiGetOperationCallback(
95                                        op.getCallback(), op.getKeys().size());
96                } else {
97                        getsCb=new MultiGetsOperationCallback(
98                                        op.getCallback(), op.getKeys().size());
99                }
100                for(String k : op.getKeys()) {
101                        rv.add(getCb == null ? gets(k, getsCb) : get(k, getCb));
102                }
103                return rv;
104        }
105 
106}

[all classes][net.spy.memcached.protocol.binary]
EMMA 2.0.5312 (C) Vladimir Roubtsov