View Javadoc

1   /*
2    * #%L
3    * prolobjectlink-jpi
4    * %%
5    * Copyright (C) 2019 Prolobjectlink Project
6    * %%
7    * Permission is hereby granted, free of charge, to any person obtaining a copy
8    * of this software and associated documentation files (the "Software"), to deal
9    * in the Software without restriction, including without limitation the rights
10   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11   * copies of the Software, and to permit persons to whom the Software is
12   * furnished to do so, subject to the following conditions:
13   * 
14   * The above copyright notice and this permission notice shall be included in
15   * all copies or substantial portions of the Software.
16   * 
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23   * THE SOFTWARE.
24   * #L%
25   */
26  package io.github.prolobjectlink.prolog;
27  
28  /**
29   * <p>
30   * Represent all Prolog number data type. Is an abstract class that contains all
31   * commons method related to number data types. In Prolog the number data types
32   * are Integer and Float. Some Prolog implementations have and extension for
33   * this legacy data types. They are Long (Large Integer Number) and Double
34   * (Double precision Floating Point Number). For Prolog implementations that no
35   * have support for Long and Double data types, they are implement this classes
36   * holding a Prolog integer for Long case and Prolog float for Double case.
37   * </p>
38   * <p>
39   * Two Prolog integers numbers are equals if and only if they are integers
40   * number and have the same value.Two Prolog integers numbers unify if are
41   * equals or at least one PrologTerm is a free variable Two Prolog floats
42   * numbers are equals if and only if they are floats number and have the same
43   * value.Two Prolog floats numbers unify if are equals or at least one
44   * PrologTerm is a free variable Two Prolog longs numbers are equals if and only
45   * if they are longs number and have the same value.Two Prolog longs numbers
46   * unify if are equals or at least one PrologTerm is a free variable Two Prolog
47   * doubles numbers are equals if and only if they are doubles number and have
48   * the same value.Two Prolog doubles numbers unify if are equals or at least one
49   * PrologTerm is a free variable
50   * </p>
51   * <p>
52   * Some Prolog implementations consider that integers and longs are equals if
53   * they have the same value and unify if have the same value or at least one
54   * PrologTerm is a free variable. Some Prolog implementations consider that
55   * floats and double are equals if they have the same value and unify if have
56   * the same value or at least one PrologTerm is a free variable.
57   * </p>
58   * 
59   * @author Jose Zalacain
60   * @since 1.0
61   */
62  public interface PrologNumber extends PrologTerm {
63  
64  	/**
65  	 * Cast and return the equivalent Java Integer Number value from current Prolog
66  	 * Number.
67  	 * 
68  	 * @since 1.0
69  	 * @return the equivalent Java Integer Number value from current Prolog Number.
70  	 */
71  	public int getIntegerValue();
72  
73  	/**
74  	 * Cast and return the equivalent Java Long Number value from current Prolog
75  	 * Number.
76  	 * 
77  	 * @since 1.0
78  	 * @return the equivalent Java Long Number value from current Prolog Number.
79  	 */
80  	public long getLongValue();
81  
82  	/**
83  	 * Cast and return the equivalent Java Float Number value from current Prolog
84  	 * Number.
85  	 * 
86  	 * @since 1.0
87  	 * @return the equivalent Java Float Number value from current Prolog Number.
88  	 */
89  	public float getFloatValue();
90  
91  	/**
92  	 * Cast and return the equivalent Java Double Number value from current Prolog
93  	 * Number.
94  	 * 
95  	 * @since 1.0
96  	 * @return the equivalent Java Double Number value from current Prolog Number.
97  	 */
98  	public double getDoubleValue();
99  
100 	/**
101 	 * Cast and return the equivalent Prolog Float Number from current Prolog
102 	 * Number.
103 	 * 
104 	 * @since 1.0
105 	 * @return the equivalent Prolog Float Number from current Prolog Number.
106 	 */
107 	public PrologFloat getPrologFloat();
108 
109 	/**
110 	 * Cast and return the equivalent Prolog Integer Number from current Prolog
111 	 * Number.
112 	 * 
113 	 * @since 1.0
114 	 * @return the equivalent Prolog Integer Number from current Prolog Number.
115 	 */
116 	public PrologInteger getPrologInteger();
117 
118 	/**
119 	 * Cast and return the equivalent Prolog Double Number from current Prolog
120 	 * Number.
121 	 * 
122 	 * @since 1.0
123 	 * @return the equivalent Prolog Double Number from current Prolog Number.
124 	 */
125 	public PrologDouble getPrologDouble();
126 
127 	/**
128 	 * Cast and return the equivalent Prolog Long Number from current Prolog Number.
129 	 * 
130 	 * @since 1.0
131 	 * @return the equivalent Prolog Long Number from current Prolog Number.
132 	 */
133 	public PrologLong getPrologLong();
134 
135 }