Returns a limit for a field.
@param field the field, from 0..<code>getFieldCount()-1</code>
@param limitType the type specifier for the limit
@see #MINIMUM
@see #GREATEST_MINIMUM
@see #LEAST_MAXIMUM
@see #MAXIMUM
512868
protected int getLimit(int field, int limitType) {
        switch (field) {
        case DAY_OF_WEEK:
        case AM_PM:
        case HOUR:
        case HOUR_OF_DAY:
        case MINUTE:
        case SECOND:
        case MILLISECOND:
        case ZONE_OFFSET:
        case DST_OFFSET:
        case DOW_LOCAL:
        case JULIAN_DAY:
        case MILLISECONDS_IN_DAY:
        case IS_LEAP_MONTH:
            return LIMITS[field][limitType];

        case WEEK_OF_MONTH:
        {
            int limit;
            if (limitType == MINIMUM) {
                limit = getMinimalDaysInFirstWeek() == 1 ? 1 : 0;
            } else if (limitType == GREATEST_MINIMUM){
                limit = 1;
            } else {
                int minDaysInFirst = getMinimalDaysInFirstWeek();
                int daysInMonth = handleGetLimit(DAY_OF_MONTH, limitType);
                if (limitType == LEAST_MAXIMUM) {
                    limit = (daysInMonth + (7 - minDaysInFirst)) / 7;
                } else { // limitType == MAXIMUM
                    limit = (daysInMonth + 6 + (7 - minDaysInFirst)) / 7;
                }
            }
            return limit;
        }

        }
        return handleGetLimit(field, limitType);
    }
205716
private void parseLimitFieldSize(Map<Object, Object> props) {
        Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_FIELDSIZE);
        if (null != value) {
            try {
                this.limitFieldSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_FIELDSIZE, HttpConfigConstants.MAX_LIMIT_FIELDSIZE);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: field size limit is " + getLimitOfFieldSize());
                }
            } catch (NumberFormatException nfe) {
                FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitFieldSize", "1");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: Invaild max field size setting of " + value);
                }
            }
        }
    }
1235539
public R setLimit(final int limit){
        mQueryMap.put(FIELD_LIMIT, Integer.toString(limit));
        return (R)this;
    }
326429
@NonNull
    @Override
    public Limit limit(@NonNull Expression limit) {
        if (limit == null) {
            throw new IllegalArgumentException("limit cannot be null.");
        }
        return new Limit(this, limit, null);
    }
36158
private boolean incSlotLimit(JobInfo info, TaskType type, LimitType limit) {
    switch (limit) {
      case MIN:
        if (type == TaskType.MAP) {
          if (info.minMaps < runnableTasks(info, type)) {
            info.minMaps += 1;
            return true;
          }
        } else {
          if (info.minReduces < runnableTasks(info, type)) {
            info.minReduces += 1;
            return true;
          }
        }
        return false;
      case MAX:
        if (type == TaskType.MAP) {
          if (info.maxMaps < runnableTasks(info, type)) {
            info.maxMaps += 1;
            return true;
          }
        } else {
          if (info.maxReduces < runnableTasks(info, type)) {
            info.maxReduces += 1;
            return true;
          }
        }
        return false;
    }
    // Never come here
    return false;
  }
510913
public void setToLimit(int iAreaDesc)   // Set this field to the largest or smallest value
    {
        // Override this!!
        String filler = Constants.BLANK;
        if (iAreaDesc == DBConstants.END_SELECT_KEY)
        {   // \376 is consistently the largest in the character set
            filler = StringField.HIGH_STRING; // Change the filler pointer
        }
        this.doSetData(filler, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE);  // will fill with zeros
    }
212041
private String limitString(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
        }

        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String field = currentRecord.getValueByFieldName(params[0]);
        int limit = Integer.parseInt(params[1]);

        if (field.isEmpty() || field.length() < limit){
            return field;
        }

        String result = field.substring(0, limit) + "...";
        return result;
    }
442653
public String placeBatchLimitOrder(LimitOrder... limitOrders) throws IOException {
    if (limitOrders == null || limitOrders.length < 1) {
      throw new RuntimeException("this limitOrders not be null or length min 1");
    }
    if (limitOrders.length > 5) {
      throw new RuntimeException("this limitOrders length max 5");
    }
    List<Map<String, Object>> list = new ArrayList<>();
    Arrays.stream(limitOrders)
        .forEach(
            limitOrder -> {
              Map<String, Object> map = new HashMap<>();
              map.put("price", limitOrder.getLimitPrice().toPlainString());
              map.put("amount", limitOrder.getOriginalAmount().toPlainString());
              map.put("type", limitOrder.getType() == OrderType.BID ? "buy" : "sell");
              list.add(map);
            });

    ObjectMapper mapper = new ObjectMapper();
    String ordersData = mapper.writeValueAsString(list);

    OkCoinMoreTradeResult result =
        batchTrade(
            OkCoinAdapters.adaptSymbol(limitOrders[0].getCurrencyPair()),
            limitOrders[0].getType() == OrderType.BID ? "buy" : "sell",
            ordersData);
    StringBuilder builder = new StringBuilder();
    if (result.isStatus()) {
      result.getOrderInfo().stream()
          .forEach(
              p -> {
                if (-1L != Long.valueOf((long) p.get("order_id"))) {
                  builder.append(",").append((String) p.get("order_id"));
                }
              });
    }
    if (builder.length() > 1) {
      return builder.substring(1);
    } else {
      return "no one order success";
    }
  }
1185375
@SuppressWarnings("fallthrough")
    protected int handleGetLimit(int field, int limitType) {
        switch (field) {
        case ERA:
            if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
                return 0;
            }
            return CURRENT_ERA;
        case YEAR:
        {
            switch (limitType) {
            case MINIMUM:
            case GREATEST_MINIMUM:
                return 1;
            case LEAST_MAXIMUM:
                return 1;
            case MAXIMUM:
                return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
            }
            //Fall through to the default if not handled above
        }
        default:
            return super.handleGetLimit(field, limitType);
        }
    }
1258360
public static <T> FieldLiteral<T> get(Field field, TypeLiteral<T> declaringType) {
    Preconditions.checkArgument(
        field.getDeclaringClass().equals(declaringType.getRawType()),
        "declaringType (%s) must be the type literal where field was declared (%s)!",
        declaringType, field.getDeclaringClass());
    return new FieldLiteral<T>(field, declaringType);
  }
333508
public Class<?> getActualFieldType(final String field) {
        
        final Object fieldValue = getFieldValue(field);
        return fieldValue == null ? null : fieldValue.getClass();
        
    }
426303
public <T> FieldFormatter<T> findFieldFormatter(final String field, final Class<T> fieldType) {
        String fieldPath = buildFieldPath(field);
        return fieldFormatterRegistry.findFormatter(fieldPath, fieldType);
    }
339865
public SemanticType extractFieldType(SemanticType.Record type, Identifier field) {
		if (type == null) {
			return null;
		} else {
			SemanticType fieldType = type.getField(field);
			if (fieldType == null) {
				// Indicates an invalid field selection
				syntaxError(field, INVALID_FIELD);
			}
			return fieldType;
		}
	}
392462
public void encodeType(byte[] frame, int[] limits) {
    JSType.setByte(frame, limits, (byte)JSType.TUPLE);
    JSType.setCount(frame, limits, getFieldCount());
    if (fields != null)
      for (int i = 0; i < fields.length; i++)
        fields[i].encodeType(frame, limits);
  }
756702
@Override
    public Object getField(FieldDescriptor field) {
        checkFieldDescriptor(field);
        Object result = field.getNumber() == 1 ? getKey() : getValue();
        // Convert enums to EnumValueDescriptor.
        if (field.getType() == FieldDescriptor.Type.ENUM) {
            result = field.getEnumType().findValueByNumberCreatingIfUnknown((java.lang.Integer) result);
        }
        return result;
    }
832282
public static Type getPropertyType(Class<?> beanClass, String field) {
		return INSTANCE.findPropertyType(beanClass, field);
	}
992810
public static boolean isScalarNullableType(Field field) {
        FieldType type = field.getType();
        return STRING.equals(type) || BYTES.equals(type) || type instanceof io.protostuff.compiler.model.Enum;
    }