PPL Configured Java Language Interface  1.2
Generator.java
Go to the documentation of this file.
1 /* Generator Java class declaration and implementation.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 package parma_polyhedra_library;
25 
26 import javax.management.RuntimeErrorException;
27 
29 
36 public class Generator {
38  private Generator_Type gt;
39 
42 
44  private Coefficient div;
45 
51  le = e.clone();
52  gt = g_type;
53  }
54 
56 
61  if (d.getBigInteger().equals(java.math.BigInteger.ZERO)) {
62  Error cause = new Error("parma_polyhedra_library.Generator::"
63  + "Generator(e, d):\n"
64  + "the divisor can not be zero.");
65  throw new RuntimeErrorException(cause);
66  }
68  g.div = new Coefficient(d);
69  return g;
70  }
71 
73 
78  public static Generator line(Linear_Expression e) {
79  return new Generator(e, Generator_Type.LINE);
80  }
81 
83 
88  if (d.getBigInteger().equals(java.math.BigInteger.ZERO)) {
89  Error cause = new Error("parma_polyhedra_library.Generator::"
90  + "Generator(e, d):\n"
91  + "the divisor can not be zero.");
92  throw new RuntimeErrorException(cause);
93  }
94 
96  g.div = new Coefficient(d);
97  return g;
98  }
99 
101 
106  public static Generator ray(Linear_Expression e) {
107  return new Generator(e, Generator_Type.RAY);
108  }
109 
111  public Generator_Type type() {
112  return gt;
113  }
114 
117  return le;
118  }
119 
121 
125  public Coefficient divisor() {
126  if (this.gt == Generator_Type.POINT
127  || this.gt == Generator_Type.CLOSURE_POINT)
128  return div;
129  Error cause = new Error("parma_polyhedra_library.Generator::divisor:\n"
130  + "this is neither a point"
131  + " nor a closure point.");
132  throw new RuntimeErrorException(cause);
133  }
134 
136  public native String ascii_dump();
137 
139  public native String toString();
140 
141  private static native void initIDs();
142  static {
143  initIDs();
144  }
145 }
abstract Linear_Expression clone()
Returns a copy of the linear expression.
static native void initIDs()
native String ascii_dump()
Returns an ascii formatted internal representation of this.
static Generator ray(Linear_Expression e)
Returns the ray of direction e.
Definition: Generator.java:106
Generator_Type type()
Returns the generator type.
Definition: Generator.java:111
Coefficient div
The divisor (valid if the generator is a point or a closure point).
Definition: Generator.java:44
Linear_Expression linear_expression()
Returns the linear expression in this.
Definition: Generator.java:116
A line, ray, point or closure point.
Definition: Generator.java:36
Generator(Linear_Expression e, Generator_Type g_type)
Builds a generator of type g_type, stealing the coefficients from e.
Definition: Generator.java:50
Generator_Type gt
The generator type.
Definition: Generator.java:38
static Generator closure_point(Linear_Expression e, Coefficient d)
Returns the closure point at e / d.
Definition: Generator.java:60
PPL_COEFFICIENT_TYPE Coefficient
BigInteger getBigInteger()
Returns the value held by this.
static Generator line(Linear_Expression e)
Returns the line of direction e.
Definition: Generator.java:78
native String toString()
Returns a string representation of this.
Coefficient divisor()
If this is either a point or a closure point, returns its divisor.
Definition: Generator.java:125
static Generator point(Linear_Expression e, Coefficient d)
Returns the point at e / d.
Definition: Generator.java:87
Linear_Expression le
The linear expression.
Definition: Generator.java:41