Android Open Source - HzGrapher Error Detector






From Project

Back to project page HzGrapher.

License

The source code is released under:

Apache License

If you think the Android project HzGrapher listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.handstudio.android.hzgrapherlib.error;
/*from www .  j  a va  2 s . co  m*/
import com.handstudio.android.hzgrapherlib.vo.bargraph.BarGraphVO;
import com.handstudio.android.hzgrapherlib.vo.bubblegraph.BubbleGraphVO;
import com.handstudio.android.hzgrapherlib.vo.circlegraph.CircleGraphVO;
import com.handstudio.android.hzgrapherlib.vo.curvegraph.CurveGraphVO;
import com.handstudio.android.hzgrapherlib.vo.linegraph.LineGraphVO;
import com.handstudio.android.hzgrapherlib.vo.radargraph.RadarGraphVO;

public class ErrorDetector {
  public static ErrorCode checkGraphObject(LineGraphVO lineGraphVO){
    //1. vo check
    if(lineGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //2. legend and graph size check
    int legendSize = lineGraphVO.getLegendArr().length;
    for (int i = 0; i < lineGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=lineGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkLineCompareGraphObject(LineGraphVO lineGraphVO){
    //1. vo check
    if(lineGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }

    
    //2 graph size must be 2
    if(lineGraphVO.getArrGraph().size() != 2){
      return ErrorCode.LINE_COMPARE_GRAPH_SIZE_MUST_BE_2;
    }
        
    //3. legend and graph size check
    int legendSize = lineGraphVO.getLegendArr().length;
    for (int i = 0; i < lineGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=lineGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkGraphObject(RadarGraphVO radarGraphVO){
    //1. vo check
    if(radarGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //2. legend and graph size check
    int legendSize = radarGraphVO.getLegendArr().length;
    for (int i = 0; i < radarGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=radarGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkGraphObject(CurveGraphVO curveGraphVO){
    //1. vo check
    if(curveGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //2. legend and graph size check
    int legendSize = curveGraphVO.getLegendArr().length;
    for (int i = 0; i < curveGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=curveGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkLineCompareGraphObject(CurveGraphVO curveGraphVO){
    //1. vo check
    if(curveGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }

    
    //2 graph size must be 2
    if(curveGraphVO.getArrGraph().size() != 2){
      return ErrorCode.LINE_COMPARE_GRAPH_SIZE_MUST_BE_2;
    }
        
    //3. legend and graph size check
    int legendSize = curveGraphVO.getLegendArr().length;
    for (int i = 0; i < curveGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=curveGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkGraphObject(CircleGraphVO circleGraphVO){
    //1. vo check
    if(circleGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //2. legend and graph size check
    int arrSize = circleGraphVO.getArrGraph().size();
    if(arrSize == 0){
      return ErrorCode.GRAPH_VO_SIZE_ZERO;
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkGraphObject(BubbleGraphVO bubbleGraphVO){
    //1. vo check
    if(bubbleGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //3. legend and graph size check
    int legendSize = bubbleGraphVO.getLegendArr().length;
    for (int i = 0; i < bubbleGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=bubbleGraphVO.getArrGraph().get(i).getCoordinateArr().length
          || legendSize !=bubbleGraphVO.getArrGraph().get(i).getSizeArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
  
  public static ErrorCode checkGraphObject(BarGraphVO barGraphVO){
    //1. vo check
    if(barGraphVO == null){
      return ErrorCode.GRAPH_VO_IS_EMPTY;
    }
    
    //2. legend and graph size check
    int legendSize = barGraphVO.getLegendArr().length;
    for (int i = 0; i < barGraphVO.getArrGraph().size(); i++) {
      if(legendSize !=barGraphVO.getArrGraph().get(i).getCoordinateArr().length){
        return ErrorCode.INVALIDATE_GRAPH_AND_LEGEND_SIZE;
      }
    }
    
    return ErrorCode.NOT_ERROR;
  }
}




Java Source Code List

com.handstudio.android.hzgrapher.BarGraphActivity.java
com.handstudio.android.hzgrapher.BubbleGraphActivity.java
com.handstudio.android.hzgrapher.BubbleGraphActivity.java
com.handstudio.android.hzgrapher.CircleGraphActivity.java
com.handstudio.android.hzgrapher.CircleGraphActivity.java
com.handstudio.android.hzgrapher.CurveCompareGraphActivity.java
com.handstudio.android.hzgrapher.CurveCompareGraphActivity.java
com.handstudio.android.hzgrapher.CurveGraphActivity.java
com.handstudio.android.hzgrapher.CurveGraphActivity.java
com.handstudio.android.hzgrapher.CurveGraphWithRegionActivity.java
com.handstudio.android.hzgrapher.CurveGraphWithRegionActivity.java
com.handstudio.android.hzgrapher.LineCompareGraphActivity.java
com.handstudio.android.hzgrapher.LineCompareGraphActivity.java
com.handstudio.android.hzgrapher.LineGraphActivity.java
com.handstudio.android.hzgrapher.LineGraphActivity.java
com.handstudio.android.hzgrapher.LineGraphWithRegionActivity.java
com.handstudio.android.hzgrapher.LineGraphWithRegionActivity.java
com.handstudio.android.hzgrapher.MainActivity.java
com.handstudio.android.hzgrapher.MainActivity.java
com.handstudio.android.hzgrapher.PieGraphActivity.java
com.handstudio.android.hzgrapher.PieGraphActivity.java
com.handstudio.android.hzgrapher.RadarGraphActivity.java
com.handstudio.android.hzgrapher.RadarGraphActivity.java
com.handstudio.android.hzgrapher.ScatterGraphActivity.java
com.handstudio.android.hzgrapher.ScatterGraphActivity.java
com.handstudio.android.hzgrapherlib.animation.GraphAnimation.java
com.handstudio.android.hzgrapherlib.canvas.GraphCanvasWrapper.java
com.handstudio.android.hzgrapherlib.error.ErrorCode.java
com.handstudio.android.hzgrapherlib.error.ErrorDetector.java
com.handstudio.android.hzgrapherlib.graphview.BarGraphView.java
com.handstudio.android.hzgrapherlib.graphview.BubbleGraphView.java
com.handstudio.android.hzgrapherlib.graphview.CircleGraphView.java
com.handstudio.android.hzgrapherlib.graphview.CurveCompareGraphView.java
com.handstudio.android.hzgrapherlib.graphview.CurveGraphView.java
com.handstudio.android.hzgrapherlib.graphview.LineCompareGraphView.java
com.handstudio.android.hzgrapherlib.graphview.LineGraphView.java
com.handstudio.android.hzgrapherlib.graphview.RadarGraphView.java
com.handstudio.android.hzgrapherlib.graphview.ScatterGraphView.java
com.handstudio.android.hzgrapherlib.path.GraphPath.java
com.handstudio.android.hzgrapherlib.util.Converter.java
com.handstudio.android.hzgrapherlib.util.EuclidLine.java
com.handstudio.android.hzgrapherlib.util.EuclidPoint.java
com.handstudio.android.hzgrapherlib.util.IntersectFinder.java
com.handstudio.android.hzgrapherlib.util.MatrixTranslator.java
com.handstudio.android.hzgrapherlib.util.Spline.java
com.handstudio.android.hzgrapherlib.vo.GraphNameBox.java
com.handstudio.android.hzgrapherlib.vo.Graph.java
com.handstudio.android.hzgrapherlib.vo.bargraph.BarGraphVO.java
com.handstudio.android.hzgrapherlib.vo.bargraph.BarGraph.java
com.handstudio.android.hzgrapherlib.vo.bubblegraph.BubbleGraphVO.java
com.handstudio.android.hzgrapherlib.vo.bubblegraph.BubbleGraph.java
com.handstudio.android.hzgrapherlib.vo.circlegraph.CircleGraphVO.java
com.handstudio.android.hzgrapherlib.vo.circlegraph.CircleGraph.java
com.handstudio.android.hzgrapherlib.vo.curvegraph.CurveGraphVO.java
com.handstudio.android.hzgrapherlib.vo.curvegraph.CurveGraph.java
com.handstudio.android.hzgrapherlib.vo.linegraph.LineGraphVO.java
com.handstudio.android.hzgrapherlib.vo.linegraph.LineGraph.java
com.handstudio.android.hzgrapherlib.vo.radargraph.RadarGraphVO.java
com.handstudio.android.hzgrapherlib.vo.radargraph.RadarGraph.java
com.handstudio.android.hzgraphlib.vo.scattergraph.ScatterGraphVO.java
com.handstudio.android.hzgraphlib.vo.scattergraph.ScatterGraph.java