0d6da4183c77e71ba6affb101d52b24f31912bb1
[platform/core/ml/beyond.git] /
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.samsung.android.beyond.inference;
18
19 import android.content.Context;
20
21 public class InferenceModuleFactory {
22
23     public static InferenceHandler createHandler(InferenceMode inferenceMode) {
24         if (inferenceMode == null) {
25             throw new IllegalArgumentException("inferenceMode is null.");
26         }
27
28         return new InferenceHandler(inferenceMode);
29     }
30
31     public static Peer createPeerServer(Context context, String peerType) {
32         if (context == null || peerType == null) {
33             throw new IllegalArgumentException("Arguments are not correct.");
34         }
35
36         return new Peer(context, peerType, NodeType.SERVER);
37     }
38
39     public static Peer createPeerClient(Context context, String peerType) {
40         if (context == null || peerType == null) {
41             throw new IllegalArgumentException("Arguments are not correct.");
42         }
43
44         return new Peer(context, peerType, NodeType.CLIENT);
45     }
46 }