2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.samsung.android.beyond.inference;
19 import android.content.Context;
21 public class InferenceModuleFactory {
23 public static InferenceHandler createHandler(InferenceMode inferenceMode) {
24 if (inferenceMode == null) {
25 throw new IllegalArgumentException("inferenceMode is null.");
28 return new InferenceHandler(inferenceMode);
31 public static Peer createPeerServer(Context context, String peerType) {
32 if (context == null || peerType == null) {
33 throw new IllegalArgumentException("Arguments are not correct.");
36 return new Peer(context, peerType, NodeType.SERVER);
39 public static Peer createPeerClient(Context context, String peerType) {
40 if (context == null || peerType == null) {
41 throw new IllegalArgumentException("Arguments are not correct.");
44 return new Peer(context, peerType, NodeType.CLIENT);