Bolt
BoltResult.java
Go to the documentation of this file.
1 
21 package com.huawei.noah;
22 
23 public class BoltResult {
24  public BoltResult(float[][] value, int[][] dimension, String[] name, String[] dataFormat)
25  {
26  this.value = value;
27  this.dimension = dimension;
28  this.name = name;
29  this.dataFormat = dataFormat;
30  }
31 
37  public String[] getResultName()
38  {
39  return this.name;
40  }
41 
47  public String[] getResultDataFormat()
48  {
49  return this.dataFormat;
50  }
51 
57  public int[][] getResultDimension()
58  {
59  return this.dimension;
60  }
61 
67  public float[][] getResultData()
68  {
69  return this.value;
70  }
71 
78  public void print(int num)
79  {
80  for (int i = 0; i < name.length; i++) {
81  System.out.println("[INFO] output name: " + name[i]);
82  System.out.println(" data format: " + dataFormat[i]);
83  int len = calculateLength(this.dimension[i]);
84  System.out.println(" data number: " + len);
85  if (num >= 0) {
86  if (num < len) {
87  len = num;
88  }
89  }
90 
91  for (int j = 0; j < len; j++) {
92  System.out.print(value[i][j] + " ");
93  }
94  System.out.println();
95  }
96  }
97 
99  private float[][] value;
100 
102  private int[][] dimension;
103 
105  private String[] name;
106 
108  private String[] dataFormat;
109 
111  public static int calculateLength(int[] array)
112  {
113  int num = array.length;
114  int length = 0;
115  for (int j = 0; j < num; j++) {
116  if (array[j] == 0) {
117  break;
118  } else {
119  if (length == 0) {
120  length = array[j];
121  } else {
122  length *= array[j];
123  }
124  }
125  }
126  return length;
127  }
128 }
void print(int num)
print BoltResult object info
Definition: BoltResult.java:78
String [] getResultDataFormat()
get result data format from BoltResult object
Definition: BoltResult.java:47
static int calculateLength(int[] array)
float [][] getResultData()
get result data array from BoltResult object
Definition: BoltResult.java:67
String [] getResultName()
get result data name from BoltResult object
Definition: BoltResult.java:37
int [][] getResultDimension()
get result data dimension information from BoltResult object
Definition: BoltResult.java:57