Java 类com.amazonaws.mturk.requester.DataPoint 实例源码

项目:java-aws-mturk    文件:RequesterServiceRaw.java   
public DataPoint[] getRequesterWorkerStatistic(
    RequesterStatistic statistic, TimePeriod timePeriod,
    String workerId, Integer count, String[] responseGroup)
throws ServiceException {

  GetRequesterWorkerStatisticRequest request = new GetRequesterWorkerStatisticRequest();
  if (statistic != null) request.setStatistic(statistic);
  if (timePeriod != null) request.setTimePeriod(timePeriod);
  if (workerId != null) request.setWorkerId(workerId);
  if (count != null) request.setCount(count);
  if (responseGroup != null) request.setResponseGroup(responseGroup);

  GetStatisticResult result = null;
  result = (GetStatisticResult) executeRequest(request,
      ResultMatch.GetRequesterWorkerStatistic.name(),
      ResultMatch.GetRequesterWorkerStatistic.getResultTypeName());
  if (result == null) {
    throw new ServiceException("No response");
  }
  return result.getDataPoint();
}
项目:java-aws-mturk    文件:RequesterServiceRaw.java   
/**
 * @see http://docs.amazonwebservices.com/AWSMechanicalTurkRequester/2007-03-12/ApiReference_GetRequesterStatisticOperation.html
 */ 
public DataPoint[] getRequesterStatistic(RequesterStatistic statistic, TimePeriod timePeriod, 
    Integer count) throws ServiceException { 

  GetRequesterStatisticRequest request = new GetRequesterStatisticRequest();
  if (count != null)      request.setCount(count);
  if (statistic != null)  request.setStatistic(statistic);
  if (timePeriod != null) request.setTimePeriod(timePeriod);

  GetStatisticResult result = null;
  result = (GetStatisticResult) executeRequest(request, 
      ResultMatch.GetRequesterStatistic.name(),
      ResultMatch.GetRequesterStatistic.getResultTypeName());

  if (result == null || result.getDataPoint() == null) {
    throw new ServiceException("No response");
  }

  return result.getDataPoint();
}
项目:mturksdk-java-code-maven    文件:RequesterServiceRaw.java   
public DataPoint[] getRequesterWorkerStatistic(
    RequesterStatistic statistic, TimePeriod timePeriod,
    String workerId, Integer count, String[] responseGroup)
throws ServiceException {

  GetRequesterWorkerStatisticRequest request = new GetRequesterWorkerStatisticRequest();
  if (statistic != null) request.setStatistic(statistic);
  if (timePeriod != null) request.setTimePeriod(timePeriod);
  if (workerId != null) request.setWorkerId(workerId);
  if (count != null) request.setCount(count);
  if (responseGroup != null) request.setResponseGroup(responseGroup);

  GetStatisticResult result = null;
  result = (GetStatisticResult) executeRequest(request,
      ResultMatch.GetRequesterWorkerStatistic.name(),
      ResultMatch.GetRequesterWorkerStatistic.getResultTypeName());
  if (result == null) {
    throw new ServiceException("No response");
  }
  return result.getDataPoint();
}
项目:mturksdk-java-code-maven    文件:RequesterServiceRaw.java   
/**
 * @see http://docs.amazonwebservices.com/AWSMechanicalTurkRequester/2007-03-12/ApiReference_GetRequesterStatisticOperation.html
 */ 
public DataPoint[] getRequesterStatistic(RequesterStatistic statistic, TimePeriod timePeriod, 
    Integer count) throws ServiceException { 

  GetRequesterStatisticRequest request = new GetRequesterStatisticRequest();
  if (count != null)      request.setCount(count);
  if (statistic != null)  request.setStatistic(statistic);
  if (timePeriod != null) request.setTimePeriod(timePeriod);

  GetStatisticResult result = null;
  result = (GetStatisticResult) executeRequest(request, 
      ResultMatch.GetRequesterStatistic.name(),
      ResultMatch.GetRequesterStatistic.getResultTypeName());

  if (result == null || result.getDataPoint() == null) {
    throw new ServiceException("No response");
  }

  return result.getDataPoint();
}
项目:java-aws-mturk    文件:TestRequesterServiceRaw.java   
public void testGetRequesterStatistic() throws ServiceException {
  DataPoint[] result = service.getRequesterStatistic(
      RequesterStatistic.AverageRewardAmount,
      TimePeriod.OneDay, 1 // count
  );

  assertNotNull(result);
}
项目:java-aws-mturk    文件:TestRequesterServiceRaw.java   
public void testGetRequesterWorkerStatistic() throws ServiceException {
  DataPoint[] datum = service.getRequesterWorkerStatistic(
      RequesterStatistic.NumberAssignmentsApproved,
      TimePeriod.LifeToDate,
      luckyWorker,
      null, // count
      null); // responseGroup
  assertEquals("Unexpected number of DataPoints returned", datum.length, 1);
  assertNotNull("Returned DataPoint was null", datum[0]);
}
项目:java-aws-mturk    文件:ReviewPolicyExample.java   
/**
 * Helper function: returns a life-to-date statistic for the specified worker
 * @param workerId
 * @param statistic
 * @return
 */
private String getStatistic(String workerId, RequesterStatistic statistic) {
  DataPoint[] stat =
    service.getRequesterWorkerStatistic(
        statistic,
        TimePeriod.LifeToDate,
        workerId,
        null, // count
        new String[] {"Minimal"}); // responseGroup
  if (stat[0].getLongValue() != null) {
      return stat[0].getLongValue().toString();
  } else {
      return stat[0].getDoubleValue().toString();
  }
}
项目:mturksdk-java-code-maven    文件:TestRequesterServiceRaw.java   
public void testGetRequesterStatistic() throws ServiceException {
  DataPoint[] result = service.getRequesterStatistic(
      RequesterStatistic.AverageRewardAmount,
      TimePeriod.OneDay, 1 // count
  );

  assertNotNull(result);
}
项目:mturksdk-java-code-maven    文件:TestRequesterServiceRaw.java   
public void testGetRequesterWorkerStatistic() throws ServiceException {
  DataPoint[] datum = service.getRequesterWorkerStatistic(
      RequesterStatistic.NumberAssignmentsApproved,
      TimePeriod.LifeToDate,
      luckyWorker,
      null, // count
      null); // responseGroup
  assertEquals("Unexpected number of DataPoints returned", datum.length, 1);
  assertNotNull("Returned DataPoint was null", datum[0]);
}
项目:mturksdk-java-code-maven    文件:ReviewPolicyExample.java   
/**
 * Helper function: returns a life-to-date statistic for the specified worker
 * @param workerId
 * @param statistic
 * @return
 */
private String getStatistic(String workerId, RequesterStatistic statistic) {
  DataPoint[] stat =
    service.getRequesterWorkerStatistic(
        statistic,
        TimePeriod.LifeToDate,
        workerId,
        null, // count
        new String[] {"Minimal"}); // responseGroup
  if (stat[0].getLongValue() != null) {
      return stat[0].getLongValue().toString();
  } else {
      return stat[0].getDoubleValue().toString();
  }
}
项目:gort-public    文件:ReviewPolicyExample.java   
/**
 * Helper function: returns a life-to-date statistic for the specified worker
 * @param workerId
 * @param statistic
 * @return
 */
private String getStatistic(String workerId, RequesterStatistic statistic) {
  DataPoint[] stat =
    service.getRequesterWorkerStatistic(
        statistic,
        TimePeriod.LifeToDate,
        workerId,
        null, // count
        new String[] {"Minimal"}); // responseGroup
  if (stat[0].getLongValue() != null) {
      return stat[0].getLongValue().toString();
  } else {
      return stat[0].getDoubleValue().toString();
  }
}