2 * Copyright (C) 2009 - 2012 SC 4ViewSoft SRL
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.achartengine.chart;
18 import java.io.Serializable;
21 * Holds An PieChart Segment
23 public class PieSegment implements Serializable {
24 private float mStartAngle;
26 private float mEndAngle;
28 private int mDataIndex;
32 public PieSegment(int dataIndex, float value, float startAngle, float angle) {
33 mStartAngle = startAngle;
34 mEndAngle = angle + startAngle;
35 mDataIndex = dataIndex;
40 * Checks if angle falls in segment.
43 * @return true if in segment, false otherwise.
45 public boolean isInSegment(double angle) {
46 return angle >= mStartAngle && angle <= mEndAngle;
49 protected float getStartAngle() {
53 protected float getEndAngle() {
57 protected int getDataIndex() {
61 protected float getValue() {
65 public String toString() {
66 return "mDataIndex=" + mDataIndex + ",mValue=" + mValue + ",mStartAngle=" + mStartAngle
67 + ",mEndAngle=" + mEndAngle;