View Javadoc
1   /*
2    * Copyright (C) 2019 Alberto Irurueta Carro (alberto@irurueta.com)
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  package com.irurueta.navigation.frames.converters;
17  
18  import com.irurueta.navigation.frames.Frame;
19  import com.irurueta.navigation.frames.FrameType;
20  
21  /**
22   * Converts between source and destination frames.
23   *
24   * @param <S> source frame type.
25   * @param <D> destination frame type.
26   */
27  public interface FrameConverter<S extends Frame, D extends Frame> {
28      /**
29       * Converts source frame to a new destination frame instance.
30       *
31       * @param source source frame to convert from.
32       * @return a new destination frame instance.
33       */
34      D convertAndReturnNew(final S source);
35  
36      /**
37       * Converts source frame to destination frame.
38       *
39       * @param source      source frame to convert from.
40       * @param destination destination frame instance to convert to.
41       */
42      void convert(final S source, final D destination);
43  
44      /**
45       * Gets source frame type.
46       *
47       * @return source frame type.
48       */
49      FrameType getSourceType();
50  
51      /**
52       * Gets destination frame type.
53       *
54       * @return destination frame type.
55       */
56      FrameType getDestinationType();
57  }