Adds a gradient endpoint at the specified position.
@param position The endpoint position. May be Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY for endpoints.
@param color
@return
@see java.util.Map#put(java.lang.Object, java.lang.Object)
350219
@Override
	public Color put(Double position, Color color) {
		if( position == null ) {
			throw new NullPointerException("Null endpoint position");
		}
		if( color == null ){
			throw new NullPointerException("Null colors are not allowed.");
		}
		return mapping.put(position, color);
	}
1328470
function(colorStops) {
			var from = 0;
			
			colorStops.forEach(function(cs, i) {
				// make sure that first and last positions are defined
				if (!i) {
					return cs.position = cs.position || 0;
				}
				
				if (i == colorStops.length - 1 && !('position' in cs)) {
					cs.position = 1;
				}
				
				if ('position' in cs) {
					var start = colorStops[from].position || 0;
					var step = (cs.position - start) / (i - from);
					colorStops.slice(from, i).forEach(function(cs2, j) {
						cs2.position = start + step * j;
					});
					
					from = i;
				}
			});
		}
816828
public int getNodeByPosition(int position)
  {
    if (position > 0) {
      final int pos = isReverse() ? getLast() - position + 1
                                   : position;
      int node;
      while ((node = next()) != DTMAxisIterator.END) {
        if (pos == getPosition()) {
          return node;
        }
      }
    }
    return END;
  }
309969
public static void apply(@NonNull ViewPosition pos, @NonNull Point point) {
        pos.view.set(point.x, point.y, point.x + 1, point.y + 1);
        pos.viewport.set(pos.view);
        pos.visible.set(pos.view);
        pos.image.set(pos.view);
    }
864504
@Override
	// @NotThreadSafe
	public void put(long position, byte value) throws IOException {
		int bufferNum = getBufferNum(position);
		mappedBuffers.get(bufferNum).put(getIndex(position), value);
		if(modifiedBuffers!=null) modifiedBuffers.set(bufferNum, true);
	}
493414
public boolean setPosition(float position) {
		if (playing) {
			requiredPosition = -1;
			
			positioning = true;
			playing = false;
			boolean result = sound.setPosition(position);
			playing = true;
			positioning = false;

			return result;
		} else {
			requiredPosition = position;
			return false;
		}
	}
49725
public void add(int position) {
    if (mtasPositionType.equals(POSITION_SINGLE)) {
      if (position != mtasPositionStart) {
        if (position == (mtasPositionStart + 1)) {
          mtasPositionType = POSITION_RANGE;
          mtasPositionEnd = position;
        } else if (position == (mtasPositionStart - 1)) {
          mtasPositionType = POSITION_RANGE;
          mtasPositionEnd = mtasPositionStart;
          mtasPositionStart = position;
        } else {
          mtasPositionType = POSITION_SET;
          SortedSet<Integer> list = new TreeSet<>();
          list.add(position);
          list.add(mtasPositionStart);
          mtasPositionList = ArrayUtils
              .toPrimitive(list.toArray(new Integer[list.size()]));
          mtasPositionStart = list.first();
          mtasPositionEnd = list.last();
        }
      }
    } else {
      SortedSet<Integer> list = new TreeSet<>();
      if (mtasPositionType.equals(POSITION_RANGE)) {
        mtasPositionType = POSITION_SET;
        for (int i = mtasPositionStart; i <= mtasPositionEnd; i++) {
          list.add(i);
        }
        list.add(position);
      } else if (mtasPositionType.equals(POSITION_SET)) {
        for (int p : mtasPositionList) {
          list.add(p);
        }
        list.add(position);
      }
      mtasPositionList = ArrayUtils
          .toPrimitive(list.toArray(new Integer[list.size()]));
      mtasPositionStart = list.first();
      mtasPositionEnd = list.last();
      if (list.size() == (1 + mtasPositionEnd - mtasPositionStart)) {
        mtasPositionType = POSITION_RANGE;
        mtasPositionList = null;
      }
    }
  }
1083153
public void addPoint(float pos, Color col) {
		ControlPoint point = new ControlPoint(col, pos);
		for (int i=0;i<list.size()-1;i++) {
			ControlPoint now = (ControlPoint) list.get(i);
			ControlPoint next = (ControlPoint) list.get(i+1);
			if ((now.pos <= 0.5f) && (next.pos >=0.5f)) {
				list.add(i+1,point);
				break;
			}
		}
		repaint(0);
	}
389180
public void add(int[] positions) {
    SortedSet<Integer> list = new TreeSet<>();
    for (int p : positions) {
      list.add(p);
    }
    if (mtasPositionType.equals(POSITION_SINGLE)) {
      mtasPositionType = POSITION_SET;
      list.add(mtasPositionStart);
    } else if (mtasPositionType.equals(POSITION_RANGE)) {
      mtasPositionType = POSITION_SET;
      for (int i = mtasPositionStart; i <= mtasPositionEnd; i++) {
        list.add(i);
      }
    } else if (mtasPositionType.equals(POSITION_SET)) {
      for (int p : mtasPositionList) {
        list.add(p);
      }
    }
    mtasPositionList = ArrayUtils
        .toPrimitive(list.toArray(new Integer[list.size()]));
    mtasPositionStart = list.first();
    mtasPositionEnd = list.last();
    if (list.size() == 1) {
      mtasPositionType = POSITION_SINGLE;
      mtasPositionList = null;
    } else if (list.size() == (1 + mtasPositionEnd - mtasPositionStart)) {
      mtasPositionType = POSITION_RANGE;
      mtasPositionList = null;
    }
  }
1278705
function fixOldGradient (args, gradient) {
	const type = args[0][0];
	let colorStops = [];
	let from;
	let to;

	// 将参数中的`color-stop`,`from`,`to`三种信息剔除出args并单独存放，剩下的存起来
	args = args.slice(1).filter((arg) => {
		const fnName = arg.value;
		if (fnName === "from") {
			from = arg;
		} else if (fnName === "to") {
			to = arg;
		} else if (fnName === "color-stop") {
			colorStops.push(arg);
		} else {
			return true;
		}
		return false;
	});

	if (from) {
		// 将from信息放入colorStops头部
		colorStops.unshift(from);
	}
	if (to) {
		// 将from信息放入colorStops尾部
		colorStops.push(to);
	}

	// 将数组colorStops中的元素都转换为标准形式
	colorStops = colorStops.map((colorStop, i) => {
		// 获取colorStop的参数
		colorStop = colorStop.nodes;
		// 如果不知一个参数
		if (colorStop.length > 1) {
			// 计算位置信息的浏览器默认值
			const posVal = i * 100 / (colorStops.length - 1);
			colorStop = colorStop.filter((val) => {
				// 如果位置信息与浏览器默认值相同，去除它
				return parseFloat(val) !== posVal;
			});

			if (colorStop.length > 1) {
				// 参数重新排列，位置信息放在后面，以便符合新语法
				colorStop.sort((word) => {
					return isNaN(parseFloat(word)) ? -1 : 1;
				});
			}
		}
		return colorStop;
	});

	if (type === "radial") {
		// 按照圆形渐变语法处理剩下的参数
		args = fixOldRadialGradient(args);
	} else {
		// 按照线性渐变语法处理剩下的参数
		args = fixOldLinearGradient(args);
	}

	if (args && args.length) {
		// 将`fixOldRadialGradient`或`fixOldLinearGradient`的返回结果插入colorStops
		colorStops.unshift(args);
	}
	// 将css属性名名称转换为标准的
	gradient.value = type + "-gradient";
	return colorStops;
}
460392
void setPosition(Point2D<?, ?> position) {
		this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
	}
459125
public void setEndCornerColor(Color color) {
        if (endColor == null) {
            endColor = new RGBColor(0.0, 0.0, 0.0);
        }
        setGradation(true);
        this.endColor = color;
    }
947823
public void setCurrentPosition(int position, boolean smooth) {
        if (getRealAdapter() == null)
            throw new IllegalStateException("You did not set a slider adapter");
        if(position >= getRealAdapter().getCount()){
            throw new IllegalStateException("Item position is not exist");
        }
        int p = mViewPager.getCurrentItem() % getRealAdapter().getCount();
        int n = (position - p) + mViewPager.getCurrentItem();
        mViewPager.setCurrentItem(n, smooth);
    }
788616
protected Paint createVerticalGradient(Shape s, TwoColors colors) {
        Rectangle2D bounds  = s.getBounds2D();
        float       xCenter = (float) bounds.getCenterX();
        float       yMin    = (float) bounds.getMinY();
        float       yMax    = (float) bounds.getMaxY();

        return createGradient(xCenter, yMin, xCenter, yMax, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom });
    }
1027688
public String put(String endpoint, String params) throws IOException {
        return this.put(endpoint, params, "");
    }
169364
public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) {
        if (colorHolder != null && gradientDrawable != null) {
            colorHolder.applyTo(ctx, gradientDrawable);
        } else if (gradientDrawable != null) {
            gradientDrawable.setColor(Color.TRANSPARENT);
        }
    }
1191753
function (value, point) {
		var pos,
			stops = this.stops,
			from,
			to,
			color,
			dataClasses = this.dataClasses,
			dataClass,
			i;

		if (dataClasses) {
			i = dataClasses.length;
			while (i--) {
				dataClass = dataClasses[i];
				from = dataClass.from;
				to = dataClass.to;
				if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
					color = dataClass.color;
					if (point) {
						point.dataClass = i;
					}
					break;
				}	
			}

		} else {

			if (this.isLog) {
				value = this.val2lin(value);
			}
			pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
			i = stops.length;
			while (i--) {
				if (pos > stops[i][0]) {
					break;
				}
			}
			from = stops[i] || stops[i + 1];
			to = stops[i + 1] || from;

			// The position within the gradient
			pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);

			color = this.tweenColors(
				from.color, 
				to.color,
				pos
			);
		}
		return color;
	}