AI2 Component  (Version nb184)
IterationError.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright © 2017 Massachusetts Institute of Technology, All rights reserved.
3 // Released under the Apache License, Version 2.0
4 // http://www.apache.org/licenses/LICENSE-2.0
5 
6 package com.google.appinventor.components.runtime.errors;
7 
9 
10 public class IterationError extends DispatchableError {
11 
12  public IterationError(int error, Object[] arguments) {
13  super(error, arguments);
14  }
15 
16  public int getIndex() {
17  return (Integer) getArguments()[0];
18  }
19 
20  public String getExpected() {
21  return (String) getArguments()[1];
22  }
23 
24  public String getFound() {
25  return (String) getArguments()[2];
26  }
27 
28  public static DispatchableError fromError(int index, DispatchableError e) {
29  switch (e.getErrorCode()) {
36  default:
37  return e;
38  }
39  }
40 
41  private static Object[] prepend(int index, Object[] arguments) {
42  Object[] newArguments = new Object[arguments.length + 1];
43  newArguments[0] = index;
44  System.arraycopy(arguments, 0, newArguments, 1, arguments.length);
45  return newArguments;
46  }
47 }
com.google.appinventor.components.runtime.errors.DispatchableError
Definition: DispatchableError.java:12
com.google.appinventor.components.runtime.util.ErrorMessages
Definition: ErrorMessages.java:17
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components.runtime.errors.IterationError.getIndex
int getIndex()
Definition: IterationError.java:16
com.google.appinventor.components
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_NUMBER_OF_VALUES_IN_POINT
static final int ERROR_INVALID_NUMBER_OF_VALUES_IN_POINT
Definition: ErrorMessages.java:238
com.google.appinventor.components.runtime.errors.IterationError.IterationError
IterationError(int error, Object[] arguments)
Definition: IterationError.java:12
com.google.appinventor.components.runtime.errors.IterationError
Definition: IterationError.java:10
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_POINT_AT_INDEX
static final int ERROR_INVALID_POINT_AT_INDEX
Definition: ErrorMessages.java:235
com.google.appinventor.components.runtime.errors.IterationError.fromError
static DispatchableError fromError(int index, DispatchableError e)
Definition: IterationError.java:28
com.google.appinventor.components.runtime.errors.DispatchableError.getArguments
Object[] getArguments()
Definition: DispatchableError.java:34
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_TYPE
static final int ERROR_INVALID_TYPE
Definition: ErrorMessages.java:239
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_NUMBER_OF_VALUES_IN_POINT_AT_INDEX
static final int ERROR_INVALID_NUMBER_OF_VALUES_IN_POINT_AT_INDEX
Definition: ErrorMessages.java:237
com.google
com
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_POINT
static final int ERROR_INVALID_POINT
Definition: ErrorMessages.java:234
com.google.appinventor.components.runtime.errors.IterationError.getFound
String getFound()
Definition: IterationError.java:24
com.google.appinventor.components.runtime.errors.IterationError.getExpected
String getExpected()
Definition: IterationError.java:20
com.google.appinventor
com.google.appinventor.components.runtime.errors.DispatchableError.getErrorCode
int getErrorCode()
Definition: DispatchableError.java:30
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_TYPE_AT_INDEX
static final int ERROR_INVALID_TYPE_AT_INDEX
Definition: ErrorMessages.java:236