1- /*
2- * Copyright © 2017-2019 Cask Data, Inc.
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5- * use this file except in compliance with the License. You may obtain a copy of
6- * 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, WITHOUT
12- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13- * License for the specific language governing permissions and limitations under
14- * the License.
15- */
16-
17- package io .cdap .wrangler .api ;
18-
19- import io .cdap .wrangler .api .parser .SyntaxError ;
20-
21- import java .util .Collections ;
22- import java .util .Iterator ;
23-
24- /**
25- * This class <code>CompileStatus</code> contains the status of compilation.
26- * If there are errors - syntax or semnatic it records the details of the errors
27- * as iterator over <code>SyntaxError</code>. If the compilation is successfull,
28- * it contains the <code>ExecutableObject</code>.
29- */
30- public final class CompileStatus {
31- private RecipeSymbol symbols = null ;
32- private boolean hasError = false ;
33- private Iterator <SyntaxError > errors = null ;
34-
35- public CompileStatus (RecipeSymbol symbols ) {
36- this .symbols = symbols ;
37- }
38-
39- public CompileStatus (boolean hasError , Iterator <SyntaxError > errors ) {
40- this .hasError = hasError ;
41- this .errors = errors ;
42- }
43-
44- public boolean isSuccess () {
45- return !hasError ;
46- }
47-
48- public Iterator <SyntaxError > getErrors () {
49- if (!hasError ) {
50- return Collections .emptyIterator ();
51- }
52- return errors ;
53- }
54-
55- public RecipeSymbol getSymbols () {
56- return symbols ;
57- }
58- }
1+ a
0 commit comments