org.apache.commons.lang3.ArrayUtils#INDEX_NOT_FOUND源码实例Demo

下面列出了org.apache.commons.lang3.ArrayUtils#INDEX_NOT_FOUND 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: notreal2d   文件: CellSpaceBodyList.java
@Nonnull
private static Body[] addBodyToCell(@Nullable Body[] cellBodies, @Nonnull Body body) {
    if (cellBodies == null) {
        return new Body[] {body};
    }

    int bodyIndex = ArrayUtils.indexOf(cellBodies, body);
    if (bodyIndex != ArrayUtils.INDEX_NOT_FOUND) {
        throw new IllegalStateException("Can't add Body {id=" + body.getId() + "} to index.");
    }

    int bodyCount = cellBodies.length;
    Body[] newCellBodies = new Body[bodyCount + 1];
    System.arraycopy(cellBodies, 0, newCellBodies, 0, bodyCount);
    newCellBodies[bodyCount] = body;
    return newCellBodies;
}
 
源代码2 项目: notreal2d   文件: CellSpaceBodyList.java
@Nullable
private static Body[] removeBodyFromCell(@Nonnull Body[] cellBodies, @Nonnull Body body) {
    int bodyIndex = ArrayUtils.indexOf(cellBodies, body);
    if (bodyIndex == ArrayUtils.INDEX_NOT_FOUND) {
        throw new IllegalStateException("Can't remove Body {id=" + body.getId() + "} from index.");
    }

    int bodyCount = cellBodies.length;
    if (bodyCount == 1) {
        return null;
    }

    Body[] newCellBodies = new Body[bodyCount - 1];
    System.arraycopy(cellBodies, 0, newCellBodies, 0, bodyIndex);
    System.arraycopy(cellBodies, bodyIndex + 1, newCellBodies, bodyIndex, bodyCount - bodyIndex - 1);
    return newCellBodies;
}
 
源代码3 项目: sailfish-core   文件: CSVMatrixReader.java
@Override
public String[] read() throws IOException, NoSuchElementException {

    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    
    String[] values = reader.getValues();
    readRecord();

    lineNumber++;

    // drop all values after last non-empty cell
    // otherwise a lot of empty (but styled) cells will be returned
    int lastNonEmptyCellIdx = ArrayUtils.INDEX_NOT_FOUND;

    for (int i = values.length - 1; i >= 0; i--) {
        if (StringUtils.isNotBlank(values[i])) {
            lastNonEmptyCellIdx = i;
            break;
        }
    }

    if(lastNonEmptyCellIdx == ArrayUtils.INDEX_NOT_FOUND) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }

    if(values.length != lastNonEmptyCellIdx + 1) {
        values = Arrays.copyOf(values, lastNonEmptyCellIdx + 1);
    }

    for (int i=0; i<values.length; i++) {
        values[i] = values[i].trim();
    }

    return values;
}
 
源代码4 项目: o2oa   文件: BaseWorkTime.java
private boolean inDefinedHoliday(Calendar c) {
	if (ArrayUtils.isNotEmpty(this.definedHolidays)) {
		if (ArrayUtils.indexOf(this.definedHolidays,
				DateFormatUtils.format(c, DATEPARTFORMATPATTERN[0])) > ArrayUtils.INDEX_NOT_FOUND) {
			return true;
		}
	}
	return false;
}
 
源代码5 项目: o2oa   文件: BaseWorkTime.java
private boolean inDefinedWorkday(Calendar c) {
	if (ArrayUtils.isNotEmpty(this.definedWorkdays)) {
		if (ArrayUtils.indexOf(this.definedWorkdays,
				DateFormatUtils.format(c, DATEPARTFORMATPATTERN[0])) > ArrayUtils.INDEX_NOT_FOUND) {
			return true;
		}
	}
	return false;
}
 
源代码6 项目: o2oa   文件: BaseWorkTime.java
private boolean inDefinedWeekends(Calendar c) {
	if (ArrayUtils.indexOf(this.definedWeekends, c.get(Calendar.DAY_OF_WEEK)) > ArrayUtils.INDEX_NOT_FOUND) {
		return true;
	}
	return false;
}
 
源代码7 项目: riiablo   文件: Direction.java
public static float direction8ToRadians(int direction) {
  int i = ArrayUtils.indexOf(DIRS_8M, direction);
  if (i == ArrayUtils.INDEX_NOT_FOUND) return 0;
  return RADIANS_8[i];
}