text:
/**
 *
 */
package com.netflix.conductor.core.execution;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.netflix.conductor.common.metadata.tasks.Task;
import com.netflix.conductor.common.metadata.tasks.Task.Status;
import com.netflix.conductor.common.metadata.tasks.TaskDef;
import com.netflix.conductor.common.metadata.workflow.*;
import com.netflix.conductor.common.metadata.workflow.WorkflowTask.Type;
import com.netflix.conductor.common.run.Workflow;
import com.netflix.conductor.common.run.Workflow.WorkflowStatus;
import com.netflix.conductor.core.config.Configuration;
import com.netflix.conductor.core.events.ScriptEvaluator;
import com.netflix.conductor.core.utils.IDGenerator;
import com.netflix.conductor.dao.MetadataDAO;
import com.netflix.conductor.service.MetricService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.script.ScriptException;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author Viren
 * @author Vikram
 * Decider evaluates the state of the workflow by inspecting the current state along with the blueprint.
 * The result of the evaluation is either to schedule further tasks, complete/fail the workflow or do nothing.
 */
public class DeciderService {

	private static Logger logger = LoggerFactory.getLogger(DeciderService.class);

	private static final TypeReference<List<WorkflowTask>> ListOfWorkflowTasks = new TypeReference<List<WorkflowTask>>() {};

	private MetadataDAO metadata;

	private ObjectMapper om;

	private ParametersUtils pu = new ParametersUtils();

	private boolean tasksAutoCleanup;

	@Inject
	public DeciderService(MetadataDAO metadata, ObjectMapper om, Configuration config) {
		this.metadata = metadata;
		this.om = om;
		tasksAutoCleanup = Boolean.parseBoolean(config.getProperty("workflow.system.task.auto.cleanup", "true"));
	}

	public DeciderOutcome decide(Workflow workflow, WorkflowDef def) throws TerminateWorkflow {

		workflow.setSchemaVersion(def.getSchemaVersion());

		final List<Task> tasks = workflow.getTasks();
		List<Task> executedTasks = tasks.stream().filter(t -> !t.getStatus().equals(Status.SKIPPED) && !t.getStatus().equals(Status.READY_FOR_RERUN)).collect(Collectors.toList());
		List<Task> tasksToBeScheduled = new LinkedList<>();
		if (executedTasks.isEmpty()) {
			tasksToBeScheduled = startWorkflow(workflow, def);
			if(tasksToBeScheduled == null) tasksToBeScheduled = new LinkedList<>();
		}
		return decide(def, workflow, tasksToBeScheduled);
	}

	private DeciderOutcome decide(final WorkflowDef def, final Workflow workflow, List<Task> preScheduledTasks) throws TerminateWorkflow {

		DeciderOutcome outcome = new DeciderOutcome();

		if (workflow.getStatus().equals(WorkflowStatus.PAUSED)) {
			logger.debug("Workflow " + workflow.getWorkflowId() + ",correlationId=" + workflow.getCorrelationId() + ",traceId=" + workflow.getTraceId() + " is paused");
			return outcome;
		}

		if (workflow.getStatus().isTerminal()) {
			//you cannot evaluate a terminal workflow
			logger.debug("Workflow " + workflow.getWorkflowId() + ",correlationId=" + workflow.getCorrelationId() + ",traceId=" + workflow.getTraceId() + " is already finished. status=" + workflow.getStatus() + ",reason=" + workflow.getReasonForIncompletion() + ",contextUser=" + workflow.getContextUser());
			return outcome;
		}

		List<Task> pendingTasks = workflow.getTasks().stream().filter(t -> (!t.isRetried() && !t.getStatus().equals(Status.SKIPPED)) || SystemTaskType.isBuiltIn(t.getTaskType())).collect(Collectors.toList());

		Set<String> executedTaskRefNames = workflow.getTasks().stream()
				.filter(t -> !t.getStatus().equals(Status.SKIPPED) && !t.getStatus().equals(Status.READY_FOR_RERUN))
				.map(t -> t.getReferenceTaskName()).collect(Collectors.toSet());

		Map<String, Task> tasksToBeScheduled = new LinkedHashMap<>();

		preScheduledTasks.forEach(pst -> {
			executedTaskRefNames.remove(pst.getReferenceTaskName());
			tasksToBeScheduled.put(pst.getReferenceTaskName(), pst);
		});

		for (Task task : pendingTasks) {

			if (SystemTaskType.is(task.getTaskType()) && !task.getStatus().isTerminal()) {
				tasksToBeScheduled.put(task.getReferenceTaskName(), task);
				executedTaskRefNames.remove(task.getReferenceTaskName());
			}

			TaskDef taskDef = metadata.getTaskDef(task.getTaskDefName());
			if(taskDef != null) {
				checkForTimeout(taskDef, task);
			}

			if (!task.getStatus().isSuccessful()) {
				WorkflowTask workflowTask = task.getWorkflowTask();
				if(workflowTask == null) {
					workflowTask = def.getTaskByRefName(task.getReferenceTaskName());
				}
				if (workflowTask != null && workflowTask.isOptional()) {
					task.setStatus(Status.COMPLETED_WITH_ERRORS);
				} else {
					Task rt = retry(taskDef, workflowTask, task, workflow);
					tasksToBeScheduled.put(rt.getReferenceTaskName(), rt);
					executedTaskRefNames.remove(rt.getReferenceTaskName());
					outcome.tasksToBeUpdated.add(task);
					if (tasksAutoCleanup) {
						List<Task> tasksToBeDeleted = workflow.getTasks().stream()
							.filter(t -> t.getReferenceTaskName().equalsIgnoreCase(task.getReferenceTaskName())
								&& t.getRetryCount() != 0 // Keep original
								&& t.getRetryCount() < task.getRetryCount()) // Keep last failed
							.collect(Collectors.toList());
						if (!tasksToBeDeleted.isEmpty()) {
							outcome.tasksToBeDeleted.addAll(tasksToBeDeleted);
							logger.debug("Tasks to be deleted " + tasksToBeDeleted);
						}
					}
				}
			}

			if (!task.isRetried() && task.getStatus().isTerminal()) {
				task.setRetried(true);
				List<Task> nextTasks = getNextTask(def, workflow, task);
				nextTasks.forEach(rt -> tasksToBeScheduled.put(rt.getReferenceTaskName(), rt));
				outcome.tasksToBeUpdated.add(task);
				logger.debug("Scheduling Tasks from " + task.getReferenceTaskName() + ", next = " + nextTasks.stream().map(Task::getReferenceTaskName).collect(Collectors.toList())+",workflowId="+workflow.getWorkflowId()+",correlationId="+workflow.getCorrelationId()+ ",contextUser=" + workflow.getContextUser());
			}
		}

		List<Task> unScheduledTasks = tasksToBeScheduled.values().stream().filter(tt -> !executedTaskRefNames.contains(tt.getReferenceTaskName())).collect(Collectors.toList());
		if (!unScheduledTasks.isEmpty()) {
			logger.debug("Scheduling Tasks " + unScheduledTasks.stream().map(Task::getReferenceTaskName).collect(Collectors.toList()) + ",workflowId=" + workflow.getWorkflowId() + ",correlationId=" + workflow.getCorrelationId() + ",contextUser=" + workflow.getContextUser());
			outcome.tasksToBeScheduled.addAll(unScheduledTasks);
		}
		updateOutput(def, workflow);
		if (outcome.tasksToBeScheduled.isEmpty() && checkForWorkflowCompletion(def, workflow)) {
			logger.debug("Marking workflow as complete. workflow=" + workflow.getWorkflowId() + ",correlationId=" + workflow.getCorrelationId() + ",tasks=" + workflow.getTasks() + ",contextUser=" + workflow.getContextUser());
			outcome.isComplete = true;
		}

		logger.debug("tasksToBeScheduled =" + tasksToBeScheduled.toString() + ",workflowId=" + workflow.getWorkflowId() + ",correlationId=" + workflow.getCorrelationId() + ",contextUser=" + workflow.getContextUser());

		return outcome;

	}

	private List<Task> startWorkflow(Workflow workflow, WorkflowDef def) throws TerminateWorkflow {

		logger.debug("Starting workflow " + def.getName() + "/" + workflow.getWorkflowId()
			+ ",correlationId=" + workflow.getCorrelationId()
			+ ",traceId=" + workflow.getTraceId()
			+ ",contextUser=" + workflow.getContextUser());

		List<Task> tasks = workflow.getTasks();
		// Check if the workflow is a re-run case
		if (workflow.getReRunFromWorkflowId() == null || tasks.isEmpty()) {
			if(def.getTasks().isEmpty()) {
				throw new TerminateWorkflow("No tasks found to be executed", WorkflowStatus.COMPLETED);
			}
			WorkflowTask taskToSchedule = def.getTasks().getFirst();		//Nothing is running yet - so schedule the first task
			while (isTaskSkipped(taskToSchedule, workflow)) {
				taskToSchedule = def.getNextTask(taskToSchedule.getTaskReferenceName());
			}
			//List<Task> toBeScheduled = getTasksToBeScheduled(def, workflow, taskToSchedule, 0, workflow.getStartTime());
			List<Task> toBeScheduled = getTasksToBeScheduled(def, workflow, taskToSchedule, 0);
			return toBeScheduled;
		}

		// Get the first task to schedule
		Task rerunFromTask = null;
		for(Task t: tasks){
			if(t.getStatus().equals(Status.READY_FOR_RERUN)){
				rerunFromTask = t;
				break;
			}
		}
		if (rerunFromTask == null) {
			String reason = String.format("The workflow %s is marked for re-run from %s but could not find the starting task", workflow.getWorkflowId(), workflow.getReRunFromWorkflowId());
			throw new TerminateWorkflow(reason);
		}
		rerunFromTask.setStatus(Status.SCHEDULED);
		rerunFromTask.setRetried(true);
		rerunFromTask.setRetryCount(0);
		return Arrays.asList(rerunFromTask);

	}

	private void updateOutput(final WorkflowDef def, final Workflow workflow) {

		List<Task> allTasks = workflow.getTasks();
		if (allTasks.isEmpty()) {
			return;
		}

		Task last = null;
		Map<String, Object> output = new HashMap<>();
		if (!allTasks.isEmpty()) {
			last = allTasks.get(allTasks.size() - 1);
			output = last.getOutputData();
		}
		if (!def.getOutputParameters().isEmpty()) {
			output = getTaskInput(def.getOutputParameters(), workflow, null, null);
		}
		workflow.setOutput(output);
	}

	private boolean checkForWorkflowCompletion(final WorkflowDef def, final Workflow workflow) throws TerminateWorkflow {

		List<Task> allTasks = workflow.getTasks();
		if (allTasks.isEmpty()) {
			return false;
		}

		Map<String, Status> taskStatusMap = new HashMap<>();
		workflow.getTasks().forEach(task -> taskStatusMap.put(task.getReferenceTaskName(), task.getStatus()));

		LinkedList<WorkflowTask> wftasks = def.getTasks();
		boolean allCompletedSuccessfully = wftasks.stream().parallel().allMatch(wftask -> {
			Status status = taskStatusMap.get(wftask.getTaskReferenceName());
			return status != null && status.isSuccessful() && status.isTerminal();
		});

		boolean noPendingTasks = taskStatusMap.values().stream().allMatch(st -> st.isTerminal());

		List<Task> pendingScheduleTasks = workflow.getTasks().stream().filter(wftask -> {
			String next = getNextTasksToBeScheduled(def, workflow, wftask);
			return next != null && !taskStatusMap.containsKey(next);
		}).collect(Collectors.toList());
		boolean noPendingSchedule = pendingScheduleTasks.stream().allMatch(Task::isTerminal);

		if (allCompletedSuccessfully && noPendingTasks && noPendingSchedule) {
			return true;
		}

		if (noPendingTasks && noPendingSchedule) {
			logger.warn("Workflow might have a stuck state. workflowId=" + workflow.getWorkflowId()
				+ ",correlationId=" + workflow.getCorrelationId()
				+ ",traceId=" + workflow.getTraceId()
				+ ",contextUser=" + workflow.getContextUser());
		}

		return false;
	}

	List<Task> getNextTask(WorkflowDef def, Workflow workflow, Task task) {

		// Get the following task after the last completed task
		if(SystemTaskType.is(task.getTaskType()) && SystemTaskType.DECISION.name().equals(task.getTaskType())){
			if (task.getInputData().get("hasChildren") != null) {
				return Collections.emptyList();
			}
		}

		String taskReferenceName = task.getReferenceTaskName();
		WorkflowTask taskToSchedule = def.getNextTask(taskReferenceName);
		while (isTaskSkipped(taskToSchedule, workflow)) {
			taskToSchedule = def.getNextTask(taskToSchedule.getTaskReferenceName());
		}
		if(taskToSchedule != null){
			//return getTasksToBeScheduled(def, workflow, taskToSchedule, 0, task.getEndTime());
			return getTasksToBeScheduled(def, workflow, taskToSchedule, 0);
		}

		return Collections.emptyList();

	}

	private String getNextTasksToBeScheduled(WorkflowDef def, Workflow workflow, Task task) {

		String taskReferenceName = task.getReferenceTaskName();
		WorkflowTask taskToSchedule = def.getNextTask(taskReferenceName);
		while (isTaskSkipped(taskToSchedule, workflow)) {
			taskToSchedule = def.getNextTask(taskToSchedule.getTaskReferenceName());
		}
		return taskToSchedule == null ? null : taskToSchedule.getTaskReferenceName();

	}

	private Task retry(TaskDef taskDef, WorkflowTask workflowTask, Task task, Workflow workflow) throws TerminateWorkflow {

		int retryCount = task.getRetryCount();
		if (!task.getStatus().isRetriable() || SystemTaskType.isBuiltIn(task.getTaskType()) || taskDef == null || taskDef.getRetryCount() <= retryCount) {
			WorkflowStatus status;
			if (task.getStatus().equals(Status.TIMED_OUT)) {
				status = WorkflowStatus.TIMED_OUT;
			} else if (task.getStatus().equals(Status.CANCELED)) {
				status = WorkflowStatus.CANCELLED;
			} else if (task.getStatus().equals(Status.RESET)) {
				status = WorkflowStatus.RESET;
			} else {
				status = WorkflowStatus.FAILED;
			}
			task.setRetried(true);
			String message = "Timeout/fail/reset error occurred. workflowId=" + workflow.getWorkflowId()
				+ ",taskId=" + task.getTaskId() + ",correlationId=" + workflow.getCorrelationId()
				+ ",reason=" + task.getReasonForIncompletion() + ",status=" + status
				+ ",contextUser=" + workflow.getContextUser();

			String reason = StringUtils.defaultIfEmpty(task.getReasonForIncompletion(), workflow.getReasonForIncompletion());
			if (WorkflowStatus.FAILED.equals(status) && taskDef != null && retryCount >= taskDef.getRetryCount() && taskDef.getRetryCount() > 0) {
				if (taskDef.getRetryFailureMessage() != null) {
					reason = taskDef.getRetryFailureMessage();
				} else {
					reason = "Max retry count reached," + reason;
				}
				message += "," + reason;
			}
			if (WorkflowStatus.FAILED.equals(status)) {
				logger.error(message);
			} else {
				logger.debug(message);
			}
			throw new TerminateWorkflow(reason, status, task);
		}

		// retry... - but not immediately - put a delay...
		int startDelay = taskDef.getRetryDelaySeconds();
		switch (taskDef.getRetryLogic()) {
			case FIXED:
				startDelay = taskDef.getRetryDelaySeconds();
				break;
			case EXPONENTIAL_BACKOFF:
				startDelay = taskDef.getRetryDelaySeconds() * (1 + task.getRetryCount());
				break;
		}
		logger.debug("Task retry. workflowId=" + workflow.getWorkflowId()
				+ ",taskId=" + task.getTaskId() + ",correlationId=" + workflow.getCorrelationId()
				+ ",reason=" + task.getReasonForIncompletion()
				+ ",contextUser=" + workflow.getContextUser()
				+ ",startDelay=" + startDelay);

		task.setRetried(true);

		Task rescheduled = task.copy();
		rescheduled.setStartDelayInSeconds(startDelay);
		rescheduled.setCallbackAfterSeconds(startDelay);
		rescheduled.setRetryCount(task.getRetryCount() + 1);
		rescheduled.setRetried(false);
		rescheduled.setTaskId(IDGenerator.generate());
		rescheduled.setRetriedTaskId(task.getTaskId());
		rescheduled.setStatus(Status.SCHEDULED);
		rescheduled.setReasonForIncompletion(null);
		rescheduled.setPollCount(0);
		rescheduled.setWorkerId(null);
		rescheduled.setInputData(new HashMap<>());
		rescheduled.setOutputData(new HashMap<>());
		rescheduled.getInputData().putAll(task.getInputData());
		if(workflowTask != null && workflow.getSchemaVersion() > 1) {
			Map<String, Object> taskInput = pu.getTaskInputV2(workflowTask.getInputParameters(), workflow, rescheduled.getTaskId(), taskDef);
			rescheduled.getInputData().putAll(taskInput);
		}
		//for the schema version 1, we do not have to recompute the inputs
		return rescheduled;

	}

	@VisibleForTesting
	void checkForTimeout(TaskDef taskType, Task task) {

		if(taskType == null){
			logger.warn("missing task type " + task.getTaskDefName() + ", workflowId=" + task.getWorkflowInstanceId());
			return;
		}
		if (task.getStatus().isTerminal() || taskType.getTimeoutSeconds() <= 0 || !task.getStatus().equals(Status.IN_PROGRESS)) {
			return;
		}

		long timeout = 1000 * taskType.getTimeoutSeconds();

		WorkflowTask workflowTask = task.getWorkflowTask();
		if (workflowTask != null && workflowTask.getTimeoutSeconds() != null && workflowTask.getTimeoutSeconds() > 0) {
			timeout = 1000 * workflowTask.getTimeoutSeconds();
		}

		long now = System.currentTimeMillis();
		long elapsedTime = now - (task.getStartTime() + (task.getStartDelayInSeconds()* 1000L));

		if (elapsedTime < timeout) {
			return;
		}

		String reason = "Task timed out after " + elapsedTime + " millisecond.  Timeout configured as " + timeout;
		MetricService.getInstance().taskTimeout(task.getTaskType(), task.getReferenceTaskName());

		switch (taskType.getTimeoutPolicy()) {
		case ALERT_ONLY:
			return;
		case RETRY:
			task.setStatus(Status.TIMED_OUT);
			task.setReasonForIncompletion(reason);
			return;
		case TIME_OUT_WF:
			task.setStatus(Status.TIMED_OUT);
			task.setReasonForIncompletion(reason);
			String message = "Task timeout occurred. " + task
				+ ",workflowId=" + task.getWorkflowInstanceId()
				+ ",correlationId=" + task.getCorrelationId();
			logger.error(message);
			throw new TerminateWorkflow(reason, WorkflowStatus.TIMED_OUT, task);
		}

		return;
	}

	private List<Task> getTasksToBeScheduled(WorkflowDef def, Workflow workflow, WorkflowTask taskToSchedule, int retryCount)  {
		return getTasksToBeScheduled(def, workflow, taskToSchedule, retryCount, null);
	}

	private List<Task> getTasksToBeScheduled(WorkflowDef def, Workflow workflow, WorkflowTask taskToSchedule, int retryCount, String retriedTaskId) {

		List<Task> tasks = new LinkedList<>();

		Task task = null;
		Map<String, Object> input = getTaskInput(taskToSchedule.getInputParameters(), workflow, null, null);

		if ( input.get("timeoutSecondsOverride") != null){
			try {
				taskToSchedule.setTimeoutSeconds(Long.parseLong(String.valueOf(input.get("timeoutSecondsOverride"))));
			}catch(NumberFormatException nfe){}

			taskToSchedule.getInputParameters().remove("timeoutSecondsOverride");
			input.remove("timeoutSecondsOverride");
		}

		Type tt = Type.USER_DEFINED;
		String type = taskToSchedule.getType();
		if(Type.is(type)) {
			tt = Type.valueOf(type);
		}
		String taskId = IDGenerator.generate();
		switch (tt) {

			case DECISION:
				String expression = taskToSchedule.getCaseExpression();
				String caseValue = null;
				if(expression != null) {

					try {
						Object returnValue = ScriptEvaluator.eval(expression, input);
						caseValue = (returnValue == null) ? "null": returnValue.toString();
					} catch (ScriptException e) {
						logger.warn("Error while evaluating the script " + expression, e);
						throw new RuntimeException("Error while evaluating the script " + expression, e);
					}

				} else {
					String paramName = taskToSchedule.getCaseValueParam();
					caseValue = "" + input.get(paramName);
				}

				Task st = SystemTask.decisionTask(workflow, taskId, taskToSchedule, input, caseValue, Arrays.asList(caseValue));
				tasks.add(st);
				List<WorkflowTask> selectedTasks = taskToSchedule.getDecisionCases().get(caseValue);
				if(selectedTasks == null || selectedTasks.isEmpty()) {
					selectedTasks = taskToSchedule.getDefaultCase();
				}
				if (selectedTasks != null && !selectedTasks.isEmpty()) {
					WorkflowTask selectedTask = selectedTasks.get(0);		//Schedule the first task to be executed...
					List<Task> caseTasks = getTasksToBeScheduled(def, workflow, selectedTask, retryCount, retriedTaskId);
					tasks.addAll(caseTasks);
					st.getInputData().put("hasChildren", "true");
				}
				break;

			case DYNAMIC:
				String paramName = taskToSchedule.getDynamicTaskNameParam();
				String taskName = (String) input.get(paramName);
				if(taskName == null){
					//Workflow should be terminated here...
					throw new TerminateWorkflow("Cannot map a dynamic task based on the parameter and input.  Parameter= " + paramName + ", input=" + input);
				}
				taskToSchedule.setName(taskName);
				task = createSimpleTask(workflow, taskToSchedule, retryCount);
				task.setTaskType(taskName);
				task.setRetriedTaskId(retriedTaskId);
				tasks.add(task);
				break;
			case FORK_JOIN:
				st = SystemTask.forkTask(workflow, taskId, taskToSchedule, input);
				tasks.add(st);
				List<List<WorkflowTask>> forkTasks = taskToSchedule.getForkTasks();
				for(List<WorkflowTask> wfts : forkTasks){
					WorkflowTask wft = wfts.get(0);
					List<Task> tasks2 = getTasksToBeScheduled(def, workflow, wft, retryCount);
					tasks.addAll(tasks2);
				}

				WorkflowTask joinWorkflowTask = def.getNextTask(taskToSchedule.getTaskReferenceName());
				if(joinWorkflowTask == null || !joinWorkflowTask.getType().equals(Type.JOIN.name())){
					throw new TerminateWorkflow("Dynamic join definition is not followed by a join task.  Check the blueprint");
				}
				break;
			case JOIN:
				Optional<Task> joinExists = workflow.getTasks().stream()
					.filter(t -> t.getReferenceTaskName().equalsIgnoreCase(taskToSchedule.getTaskReferenceName()))
					.findFirst();
				if (joinExists.isPresent()) {
					break;
				}
				Map<String, Object> joinInput = new HashMap<String, Object>();
				joinInput.put("joinOn", taskToSchedule.getJoinOn());
				if (MapUtils.isNotEmpty(taskToSchedule.getInputParameters())) {
					joinInput.put("inputParameters", taskToSchedule.getInputParameters());
				}
				if (CollectionUtils.isNotEmpty(taskToSchedule.getJoinOnConditions())) {
					joinInput.put("joinOnConditions", taskToSchedule.getJoinOnConditions());
				}
				Task joinTask = SystemTask.JoinTask(workflow, taskId, taskToSchedule, joinInput);
				tasks.add(joinTask);
				break;
			case FORK_JOIN_DYNAMIC:
				joinTask = getDynamicTasks(def, workflow, taskToSchedule, taskId, retryCount, tasks);
				tasks.add(joinTask);
				break;
			case USER_DEFINED:
				TaskDef taskDef = metadata.getTaskDef(taskToSchedule.getName());
				if(taskDef == null){
					String reason = "Invalid task specified.  Cannot find task by name " + taskToSchedule.getName() + " in the task definitions";
					throw new TerminateWorkflow(reason);
				}
				input = pu.getTaskInputV2(taskToSchedule.getInputParameters(), workflow, taskId, taskDef, taskToSchedule);
				task = SystemTask.userDefined(workflow, taskId, taskToSchedule, input, taskDef, retryCount);
				tasks.add(task);
				break;
			case SIMPLE:
				task = createSimpleTask(workflow, taskToSchedule, retryCount);
				task.setRetriedTaskId(retriedTaskId);
				tasks.add(task);
				break;
			case SUB_WORKFLOW:
				SubWorkflowParams subWorkflowParams = taskToSchedule.getSubWorkflowParam();
				if(subWorkflowParams == null){
					throw new TerminateWorkflow("Task " + taskToSchedule.getName() + " is defined as sub-workflow and is missing subWorkflowParams.  Please check the blueprint");
				}
				String name = subWorkflowParams.getName();
				Object version = subWorkflowParams.getVersion();
				Map<String, Object> params = new HashMap<>();
				params.put("name", name);
				if(version != null){
					params.put("version", version.toString());
				}
				Map<String, Object> resolvedParams = pu.getTaskInputV2(params, workflow, null, null);
				String workflowName = resolvedParams.get("name").toString();
				version = resolvedParams.get("version");
				int workflowVersion;
				if(version == null){
					try {
						workflowVersion = metadata.getLatest(workflowName).getVersion();
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}else{
					workflowVersion = Integer.parseInt(version.toString());
				}
				task = SystemTask.subWorkflowTask(workflow, taskId, taskToSchedule, input, workflowName, workflowVersion);
				tasks.add(task);
				break;
			case EVENT:
				Map<String, Object> preProcess = taskToSchedule.getDefaults();
				if (MapUtils.isNotEmpty(preProcess)) {
					// Generate variables input
					Map<String, Map<String, Object>> inputMap = pu.getInputMap(null, workflow, taskId, taskToSchedule);
					// Replace preProcess map
					preProcess = pu.replace(preProcess, inputMap);
				}
				Map<String, Map<String, Object>> defaults = Collections.singletonMap("defaults", preProcess);

				taskToSchedule.getInputParameters().put("sink", taskToSchedule.getSink());
				Map<String, Object> eventTaskInput = pu.getTaskInputV2(taskToSchedule.getInputParameters(), defaults, workflow, taskId, null, taskToSchedule);
				String sink = (String)eventTaskInput.get("sink");
				Task eventTask = SystemTask.eventTask(workflow, taskId, taskToSchedule, eventTaskInput, sink);
				tasks.add(eventTask);
				break;
			case WAIT:
				Map<String, Object> waitTaskInput = pu.getTaskInputV2(taskToSchedule.getInputParameters(), workflow, taskId, null);
				Task waitTask = SystemTask.waitTask(workflow, taskId, taskToSchedule, waitTaskInput);
				tasks.add(waitTask);
				break;
			case BATCH:
				taskDef = metadata.getTaskDef(taskToSchedule.getName());
				if(taskDef == null){
					String reason = "Invalid task specified.  Cannot find task by name " + taskToSchedule.getName() + " in the task definitions";
					throw new TerminateWorkflow(reason);
				}
				input = pu.getTaskInputV2(taskToSchedule.getInputParameters(), workflow, taskId, taskDef, taskToSchedule);
				task = SystemTask.userDefined(workflow, taskId, taskToSchedule, input, taskDef, retryCount);
				task.setResponseTimeoutSeconds(taskDef.getResponseTimeoutSeconds());
				tasks.add(task);
				break;
			default:
				break;
		}
		return tasks;
	}

	@SuppressWarnings({ "unchecked", "deprecation" })
	private Task getDynamicTasks(WorkflowDef def, Workflow workflow, WorkflowTask taskToSchedule, String taskId, int retryCount, List<Task> tasks) {

		List<WorkflowTask> dynForkTasks = new LinkedList<>();
		Map<String, Map<String, Object>> tasksInput = new HashMap<>();

		String paramName = taskToSchedule.getDynamicForkTasksParam();

		if(paramName != null){

			Map<String, Object> input = getTaskInput(taskToSchedule.getInputParameters(), workflow, null, null);
			Object paramValue = input.get(paramName);
			dynForkTasks = om.convertValue(paramValue, ListOfWorkflowTasks);
			Object tasksInputO = input.get(taskToSchedule.getDynamicForkTasksInputParamName());
			if(! (tasksInputO instanceof Map) ){
				throw new TerminateWorkflow("Input to the dynamically forked tasks is not a map -> expecting a map of K,V  but found " + tasksInputO);
			}
			tasksInput = (Map<String, Map<String, Object>>) tasksInputO;

		}else {
			paramName = taskToSchedule.getDynamicForkJoinTasksParam();
			Map<String, Object> input = getTaskInput(taskToSchedule.getInputParameters(), workflow, null, null);
			Object paramValue = input.get(paramName);
			DynamicForkJoinTaskList dynForkTasks0 = om.convertValue(paramValue, DynamicForkJoinTaskList.class);
			for( DynamicForkJoinTask dt : dynForkTasks0.getDynamicTasks()) {
				WorkflowTask wft = new WorkflowTask();
				wft.setTaskReferenceName(dt.getReferenceName());
				wft.setName(dt.getTaskName());
				wft.setType(dt.getType());
				tasksInput.put(dt.getReferenceName(), dt.getInput());
				dynForkTasks.add(wft);
			}
		}

		// Create Fork Task
		Task st = SystemTask.forkDynamicTask(workflow, taskId, taskToSchedule, dynForkTasks);

		tasks.add(st);
		List<String> joinOnTaskRefs = new LinkedList<>();
		// Create Dynamic tasks
		for (WorkflowTask wft : dynForkTasks) {
			List<Task> forkedTasks = getTasksToBeScheduled(def, workflow, wft, retryCount);
			tasks.addAll(forkedTasks);
			Task last = forkedTasks.get(forkedTasks.size()-1);
			joinOnTaskRefs.add(last.getReferenceTaskName());
			for(Task ft : forkedTasks){
				Map<String, Object> forkedTaskInput = tasksInput.get(ft.getReferenceTaskName());
				if( forkedTaskInput != null && (!(forkedTaskInput instanceof Map)) ){
					throw new TerminateWorkflow("Input to the dynamically forked task " + ft.getReferenceTaskName() + " is not a map, this is what I got " + forkedTaskInput);
				}
				ft.getInputData().putAll(forkedTaskInput);
			}
		}

		WorkflowTask joinWorkflowTask = def.getNextTask(taskToSchedule.getTaskReferenceName());
		if(joinWorkflowTask == null || !joinWorkflowTask.getType().equals(Type.JOIN.name())){
			throw new TerminateWorkflow("Dynamic join definition is not followed by a join task.  Check the blueprint");
		}
		// Create Join task
		HashMap<String, Object> joinInput = new HashMap<String, Object>();
		joinInput.put("joinOn", joinOnTaskRefs);
		Task joinTask = SystemTask.JoinTask(workflow, IDGenerator.generate(), joinWorkflowTask, joinInput);
		return joinTask;
	}

	private Task createSimpleTask(Workflow workflow, WorkflowTask taskToSchedule, int retryCount) {
		TaskDef taskDef = metadata.getTaskDef(taskToSchedule.getName());

		if (taskDef == null) {
			String reason = "Invalid task specified.  Cannot find task by name " + taskToSchedule.getName() + " in the task definitions";
			throw new TerminateWorkflow(reason);
		}
		String taskId = IDGenerator.generate();
		Map<String, Object> input = getTaskInput(taskToSchedule.getInputParameters(), workflow, taskDef, taskId);
		return SystemTask.createSimpleTask(workflow, taskId, taskToSchedule, input, taskDef, retryCount);
	}

	@VisibleForTesting
	Map<String, Object> getTaskInput(Map<String, Object> inputParams, Workflow workflow, TaskDef taskDef, String taskId)  {
		if(workflow.getSchemaVersion() > 1){
			return pu.getTaskInputV2(inputParams, workflow, taskId, taskDef);
		}
		return getTaskInputV1(workflow, inputParams);
	}

	@Deprecated
	//Workflow schema version 1 is deprecated and new workflows should be using version 2
	private Map<String, Object> getTaskInputV1(Workflow workflow, Map<String, Object> inputParams) {
		Map<String, Object> input = new HashMap<>();
		if(inputParams == null){
			return input;
		}
		Map<String, Object> workflowInput = workflow.getInput();
		inputParams.entrySet().forEach(e -> {

			String paramName = e.getKey();
			String paramPath = ""+e.getValue();
			String[] paramPathComponents = paramPath.split("\\.");
			Preconditions.checkArgument(paramPathComponents.length == 3, "Invalid input expression for " + paramName + ", paramPathComponents.size=" + paramPathComponents.length + ", expression=" + paramPath);

			String source = paramPathComponents[0];	//workflow, or task reference name
			String type = paramPathComponents[1];	//input/output
			String name = paramPathComponents[2];	//name of the parameter
			if("workflow".equals(source)){
				input.put(paramName, workflowInput.get(name));
			}else{
				Task task = workflow.getTaskByRefName(source);
				if(task != null){
					if("input".equals(type)){
						input.put(paramName, task.getInputData().get(name));
					}else{
						input.put(paramName, task.getOutputData().get(name));
					}
				}
			}
		});
		return input;
	}

	private boolean isTaskSkipped(WorkflowTask taskToSchedule, Workflow workflow) {
		try {
			boolean retval = false;
			if (taskToSchedule != null) {
				Task t = workflow.getTaskByRefName(taskToSchedule.getTaskReferenceName());
				if (t == null) {
					retval = false;
				} else if (t.getStatus().equals(Status.SKIPPED)) {
					retval = true;
				}
			}
			return retval;
		} catch (Exception e) {
			throw new TerminateWorkflow(e.getMessage());
		}

	}

	public static class DeciderOutcome {

		List<Task> tasksToBeScheduled = new LinkedList<>();

		List<Task> tasksToBeUpdated = new LinkedList<>();

		List<Task> tasksToBeDeleted = new LinkedList<>();

		boolean isComplete;

		private DeciderOutcome() { }

	}
}


text:
import re

with open("day_12_input.txt") as f:
    num_list, count = re.findall("[-\d]+", f.readline().rstrip()), 0

for num in num_list:
    count += int(num)

print count

redpajama_set_name: RedPajamaGithub


text:
package org.sfm.csv.impl.cellreader;

import org.sfm.csv.CellValueReader;
import org.sfm.csv.ParsingContext;

public class BoxedIntegerCellValueReader implements IntegerCellValueReader {
    private final CellValueReader<Integer> reader;

    public BoxedIntegerCellValueReader(CellValueReader<Integer> customReader) {
        this.reader = customReader;
    }

    @Override
    public int readInt(char[] chars, int offset, int length, ParsingContext parsingContext) {
        return read(chars, offset, length, parsingContext);
    }

    @Override
    public Integer read(char[] chars, int offset, int length, ParsingContext parsingContext) {
        return reader.read(chars, offset, length, parsingContext);
    }

    @Override
    public String toString() {
        return "BoxedIntegerCellValueReader{" +
                "reader=" + reader +
                '}';
    }
}


text:
package org.apache.bookkeeper.replication;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.BookKeeper.DigestType;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.meta.AbstractZkLedgerManagerFactory;
import org.apache.bookkeeper.meta.LedgerManager;
import org.apache.bookkeeper.meta.LedgerManagerFactory;
import org.apache.bookkeeper.meta.ZkLayoutManager;
import org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase;
import org.apache.bookkeeper.replication.ReplicationException.BKAuditException;
import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
import org.apache.bookkeeper.util.ZkUtils;
import org.apache.commons.io.FileUtils;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Tests verifies bookie vs ledger mapping generating by the BookieLedgerIndexer.
 */
public class BookieLedgerIndexTest extends BookKeeperClusterTestCase {

    // Depending on the taste, select the amount of logging
    // by decommenting one of the two lines below
    // private final static Logger LOG = Logger.getRootLogger();
    private static final Logger LOG = LoggerFactory
            .getLogger(BookieLedgerIndexTest.class);

    private Random rng; // Random Number Generator
    private ArrayList<byte[]> entries; // generated entries
    private final DigestType digestType = DigestType.CRC32;
    private int numberOfLedgers = 3;
    private List<Long> ledgerList;
    private LedgerManagerFactory newLedgerManagerFactory;
    private LedgerManager ledgerManager;

    public BookieLedgerIndexTest()
        throws IOException, KeeperException, InterruptedException {
        this("org.apache.bookkeeper.meta.HierarchicalLedgerManagerFactory");
    }

    BookieLedgerIndexTest(String ledgerManagerFactory)
            throws IOException, KeeperException, InterruptedException {
        super(3);
        LOG.info("Running test case using ledger manager : "
                + ledgerManagerFactory);
        // set ledger manager name
        baseConf.setLedgerManagerFactoryClassName(ledgerManagerFactory);
        baseClientConf.setLedgerManagerFactoryClassName(ledgerManagerFactory);
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();
        baseConf.setMetadataServiceUri(zkUtil.getMetadataServiceUri());
        rng = new Random(System.currentTimeMillis()); // Initialize the Random
        // Number Generator
        entries = new ArrayList<byte[]>(); // initialize the entries list
        ledgerList = new ArrayList<Long>(3);
        // initialize ledger manager
        newLedgerManagerFactory = AbstractZkLedgerManagerFactory.newLedgerManagerFactory(
            baseConf,
            new ZkLayoutManager(zkc,
                ZKMetadataDriverBase.resolveZkLedgersRootPath(baseConf), ZkUtils.getACLs(baseConf)));

        ledgerManager = newLedgerManagerFactory.newLedgerManager();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();
        if (null != newLedgerManagerFactory) {
            newLedgerManagerFactory.close();
            newLedgerManagerFactory = null;
        }
        if (null != ledgerManager) {
            ledgerManager.close();
            ledgerManager = null;
        }
    }

    /**
     * Verify the bookie-ledger mapping with minimum number of bookies and few
     * ledgers.
     */
    @Test
    public void testSimpleBookieLedgerMapping() throws Exception {

        for (int i = 0; i < numberOfLedgers; i++) {
            createAndAddEntriesToLedger().close();
        }

        BookieLedgerIndexer bookieLedgerIndex = new BookieLedgerIndexer(
                ledgerManager);

        Map<String, Set<Long>> bookieToLedgerIndex = bookieLedgerIndex
                .getBookieToLedgerIndex();

        assertEquals("Missed few bookies in the bookie-ledger mapping!", 3,
                bookieToLedgerIndex.size());
        Collection<Set<Long>> bk2ledgerEntry = bookieToLedgerIndex.values();
        for (Set<Long> ledgers : bk2ledgerEntry) {
            assertEquals("Missed few ledgers in the bookie-ledger mapping!", 3,
                    ledgers.size());
            for (Long ledgerId : ledgers) {
                assertTrue("Unknown ledger-bookie mapping", ledgerList
                        .contains(ledgerId));
            }
        }
    }

    /**
     * Verify ledger index with failed bookies and throws exception.
     */
    @SuppressWarnings("deprecation")
    @Test
    public void testWithoutZookeeper() throws Exception {
        // This test case is for ledger metadata that stored in ZooKeeper. As
        // far as MSLedgerManagerFactory, ledger metadata are stored in other
        // storage. So this test is not suitable for MSLedgerManagerFactory.
        if (newLedgerManagerFactory instanceof org.apache.bookkeeper.meta.MSLedgerManagerFactory) {
            return;
        }

        for (int i = 0; i < numberOfLedgers; i++) {
            createAndAddEntriesToLedger().close();
        }

        BookieLedgerIndexer bookieLedgerIndex = new BookieLedgerIndexer(
                ledgerManager);
        stopZKCluster();
        try {
            bookieLedgerIndex.getBookieToLedgerIndex();
            fail("Must throw exception as zookeeper are not running!");
        } catch (BKAuditException bkAuditException) {
            // expected behaviour
        }
    }

    /**
     * Verify indexing with multiple ensemble reformation.
     */
    @Test
    public void testEnsembleReformation() throws Exception {
        try {
            LedgerHandle lh1 = createAndAddEntriesToLedger();
            LedgerHandle lh2 = createAndAddEntriesToLedger();

            startNewBookie();
            shutdownBookie(bs.size() - 2);

            // add few more entries after ensemble reformation
            for (int i = 0; i < 10; i++) {
                ByteBuffer entry = ByteBuffer.allocate(4);
                entry.putInt(rng.nextInt(Integer.MAX_VALUE));
                entry.position(0);

                entries.add(entry.array());
                lh1.addEntry(entry.array());
                lh2.addEntry(entry.array());
            }

            BookieLedgerIndexer bookieLedgerIndex = new BookieLedgerIndexer(
                    ledgerManager);

            Map<String, Set<Long>> bookieToLedgerIndex = bookieLedgerIndex
                    .getBookieToLedgerIndex();
            assertEquals("Missed few bookies in the bookie-ledger mapping!", 4,
                    bookieToLedgerIndex.size());
            Collection<Set<Long>> bk2ledgerEntry = bookieToLedgerIndex.values();
            for (Set<Long> ledgers : bk2ledgerEntry) {
                assertEquals(
                        "Missed few ledgers in the bookie-ledger mapping!", 2,
                        ledgers.size());
                for (Long ledgerNode : ledgers) {
                    assertTrue("Unknown ledger-bookie mapping", ledgerList
                            .contains(ledgerNode));
                }
            }
        } catch (BKException e) {
            LOG.error("Test failed", e);
            fail("Test failed due to BookKeeper exception");
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            LOG.error("Test failed", e);
            fail("Test failed due to interruption");
        }
    }

    private void shutdownBookie(int bkShutdownIndex) throws IOException {
        bs.remove(bkShutdownIndex).shutdown();
        File f = tmpDirs.remove(bkShutdownIndex);
        FileUtils.deleteDirectory(f);
    }

    private LedgerHandle createAndAddEntriesToLedger() throws BKException,
            InterruptedException {
        int numEntriesToWrite = 20;
        // Create a ledger
        LedgerHandle lh = bkc.createLedger(digestType, "admin".getBytes());
        LOG.info("Ledger ID: " + lh.getId());
        for (int i = 0; i < numEntriesToWrite; i++) {
            ByteBuffer entry = ByteBuffer.allocate(4);
            entry.putInt(rng.nextInt(Integer.MAX_VALUE));
            entry.position(0);

            entries.add(entry.array());
            lh.addEntry(entry.array());
        }
        ledgerList.add(lh.getId());
        return lh;
    }
}


text:
// DOM-IGNORE-BEGIN

//DOM-IGNORE-END

//DOM-IGNORE-BEGIN
#ifndef _USB_HOST_HID_H_
#define _USB_HOST_HID_H_
//DOM-IGNORE-END

#include <stdint.h>
#include <stdbool.h>
#include "usb_hid.h"
#include "usb_host_hid_parser.h"

// *****************************************************************************
// *****************************************************************************
// Section: Configuration
// *****************************************************************************
// *****************************************************************************

#ifndef USB_ENABLE_TRANSFER_EVENT
    #error USB_ENABLE_TRANSFER_EVENT must be defined
#endif

// *****************************************************************************
// *****************************************************************************
// Section: Constants
// *****************************************************************************
// *****************************************************************************

#define USB_HID_TRANSFER_IN             1
#define USB_HID_TRANSFER_OUT            0

// *****************************************************************************
// Section: HID Class Error Codes
// *****************************************************************************

#define USB_HID_CLASS_ERROR              USB_ERROR_CLASS_DEFINED

typedef enum
{
    USB_HID_COMMAND_PASSED          = USB_SUCCESS,          // Command was successful.
    USB_HID_COMMAND_FAILED          = USB_HID_CLASS_ERROR,  // Command failed at the device.
    USB_HID_PHASE_ERROR,                                    // Command had a phase error at the device.
    USB_HID_DEVICE_NOT_FOUND,                               // Device with the specified address is not available.
    USB_HID_DEVICE_BUSY,                                    // A transfer is currently in progress.
    USB_HID_NO_REPORT_DESCRIPTOR,                           // No report descriptor found
    USB_HID_INTERFACE_ERROR,                                // The interface layer cannot support the device.
    USB_HID_REPORT_DESCRIPTOR_BAD,                          // Report Descriptor for not proper
    USB_HID_RESET_ERROR,                                    // An error occurred while resetting the device.
    USB_HID_ILLEGAL_REQUEST,                                // Cannot perform requested operation.

    USB_HID_DEVICE_DETACHED,
    USB_HID_INITIALIZING,
    USB_PROCESSING_REPORT_DESCRIPTOR,
    USB_HID_NORMAL_RUNNING,
    USB_HID_DEVICE_HOLDING,
    USB_HID_RESETTING_DEVICE

} USB_HOST_HID_RETURN_CODES;

// *****************************************************************************
// Section: Interface and Protocol Constants
// *****************************************************************************

#define DEVICE_CLASS_HID             0x03   // HID Interface Class Code

#define DSC_HID                      0x21   // HID Descriptor Code
#define DSC_RPT_wValue               0x2200 // Report Descriptor Code, used for USBHostIssueDeviceRequest
#define DSC_PHY                      0x23   // Physical Descriptor Code

// *****************************************************************************
// Section: HID Event Definition
// *****************************************************************************

// If the application has not defined an offset for HID events, set it to 0.
#ifndef EVENT_HID_OFFSET
    #define EVENT_HID_OFFSET    0
#endif

    // No event occured (NULL event)
#define EVENT_HID_NONE                      EVENT_HID_BASE + EVENT_HID_OFFSET + 0
    // A Report Descriptor has been parsed.  The returned data pointer is NULL.
    // The application must collect details, or simply return true if the
    // application is already aware of the data format.
#define EVENT_HID_RPT_DESC_PARSED           EVENT_HID_BASE + EVENT_HID_OFFSET + 1
//#define EVENT_HID_TRANSFER        EVENT_HID_BASE + EVENT_HID_OFFSET + 3   // Unused - value retained for legacy.
    // A HID Read transfer has completed.  The returned data pointer points to a
    // HID_TRANSFER_DATA structure, with information about the transfer.
#define EVENT_HID_READ_DONE                 EVENT_HID_BASE + EVENT_HID_OFFSET + 4
    // A HID Write transfer has completed.  The returned data pointer points to a
    // HID_TRANSFER_DATA structure, with information about the transfer.
#define EVENT_HID_WRITE_DONE                EVENT_HID_BASE + EVENT_HID_OFFSET + 5
    // HID reset complete.  The returned data pointer is NULL.
#define EVENT_HID_RESET                     EVENT_HID_BASE + EVENT_HID_OFFSET + 6
    // A HID device has attached.  The returned data pointer points to a
    // USB_HID_DEVICE_ID structure.
#define EVENT_HID_ATTACH                    EVENT_HID_BASE + EVENT_HID_OFFSET + 7
    // A HID device has detached.  The returned data pointer points to a
    // byte with the previous address of the detached device.
#define EVENT_HID_DETACH                    EVENT_HID_BASE + EVENT_HID_OFFSET + 8
    // There was a problem parsing the report descriptor of the attached device.
    // Communication with the device is not allowed, and the device should be
    // detached.
#define EVENT_HID_BAD_REPORT_DESCRIPTOR     EVENT_HID_BASE + EVENT_HID_OFFSET + 9
    // An error occurred while trying to do a HID reset.  The returned data pointer
    // is NULL.
#define EVENT_HID_RESET_ERROR               EVENT_HID_BASE + EVENT_HID_OFFSET + 10

// *****************************************************************************
// *****************************************************************************
// Section: Data Structures
// *****************************************************************************
// *****************************************************************************

//******************************************************************************
/* HID Data Details

This structure defines the objects used by the application to access required
report. Application must use parser interface functions to fill these details.
e.g. USBHostHID_ApiFindValue
*/
typedef struct _HID_DATA_DETAILS
{
    uint16_t reportLength;                // reportLength - the expected length of the parent report.
    uint16_t reportID;                    // reportID - report ID - the first byte of the parent report.
    uint8_t bitOffset;                   // BitOffset - bit offset within the report.
    uint8_t bitLength;                   // bitlength - length of the data in bits.
    uint8_t count;                       // count - what's left of the message after this data.
    uint8_t signExtend;                  // extend - sign extend the data.
    uint8_t interfaceNum;                // interfaceNum - informs HID layer about interface number.
}   HID_DATA_DETAILS;
// Note: One would ordinarily get these values from a parser
//       find. (e.g. USBHostHID_ApiFindValue)

// *****************************************************************************
/* HID User Data Size

This defines the data type required to hold the maximum field size data.
*/
#if((HID_MAX_DATA_FIELD_SIZE >= 1) && (HID_MAX_DATA_FIELD_SIZE <= 8))  /* Maximum size of data field within a report */
    typedef unsigned char    HID_USER_DATA_SIZE;
#elif((HID_MAX_DATA_FIELD_SIZE >= 9) && (HID_MAX_DATA_FIELD_SIZE <= 16))
    typedef unsigned int     HID_USER_DATA_SIZE;
#elif((HID_MAX_DATA_FIELD_SIZE >= 17) && (HID_MAX_DATA_FIELD_SIZE <= 32))
    typedef unsigned long    HID_USER_DATA_SIZE;
#else
    typedef unsigned char    HID_USER_DATA_SIZE;
#endif

// *****************************************************************************
/* HID Device ID Information

This structure contains identification information about an attached device.
*/
typedef struct _USB_HID_DEVICE_ID
{
    uint16_t                           vid;                    // Vendor ID of the device
    uint16_t                           pid;                    // Product ID of the device
    uint8_t                            deviceAddress;          // Address of the device on the USB
    uint8_t                            clientDriverID;         // Client driver ID for device requests
} USB_HID_DEVICE_ID;

// *****************************************************************************
/* HID Transfer Information

This structure is used when the event handler is used to notify the upper layer
of transfer completion (EVENT_HID_READ_DONE or EVENT_HID_WRITE_DONE).
*/

typedef struct _HID_TRANSFER_DATA
{
   uint32_t                dataCount;          // Count of bytes transferred.
   uint8_t                 bErrorCode;         // Transfer error code.
} HID_TRANSFER_DATA;

// *****************************************************************************
// *****************************************************************************
// Section: Function Prototypes
// *****************************************************************************
// *****************************************************************************

/*******************************************************************************
  Function:
    bool USBHostHIDDeviceDetect( uint8_t deviceAddress )

  Description:
    This function determines if a HID device is attached and ready to use.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress  - Address of the attached device.

  Return Values:
    uint8_t deviceAddress  - Address of the newly attached device or 0 if there
 are no newly attached devices.

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHIDDeviceDetect
(
    void
);

/*******************************************************************************
  Function:
    uint8_t    USBHostHIDDeviceStatus( uint8_t deviceAddress )

  Summary:

  Description:
    This function determines the status of a HID device.

  Preconditions:  None

  Parameters:
    uint8_t deviceAddress - address of device to query

  Return Values:
    USB_HID_DEVICE_NOT_FOUND           -  Illegal device address, or the
                                          device is not an HID
    USB_HID_INITIALIZING               -  HID is attached and in the
                                          process of initializing
    USB_PROCESSING_REPORT_DESCRIPTOR   -  HID device is detected and report
                                          descriptor is being parsed
    USB_HID_NORMAL_RUNNING             -  HID Device is running normal,
                                          ready to send and receive reports
    USB_HID_DEVICE_HOLDING             -  Driver has encountered error and
										  could not recover
    USB_HID_DEVICE_DETACHED            -  HID detached.

  Remarks:
    None
*******************************************************************************/
uint8_t    USBHostHIDDeviceStatus
(
    uint8_t deviceAddress
);

/*******************************************************************************
  Function:
    uint8_t USBHostHIDRead( uint8_t deviceAddress,uint8_t reportid, uint8_t interface,
                uint8_t size, uint8_t *data)

  Summary:
     This function starts a Get report transfer reuest from the device,
     utilizing the function USBHostHIDTransfer();

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress      - Device address
    uint8_t reportid           - Report ID of the requested report
    uint8_t interface          - Interface number
    uint8_t size               - Byte size of the data buffer
    uint8_t *data              - Pointer to the data buffer

  Return Values:
    USB_SUCCESS                 - Request started successfully
    USB_HID_DEVICE_NOT_FOUND    - No device with specified address
    USB_HID_DEVICE_BUSY         - Device not in proper state for
                                  performing a transfer
    Others                      - Return values from USBHostRead()

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHIDRead
(
    uint8_t deviceAddress,
    uint8_t reportid,
    uint8_t interface,
    uint8_t size,
    uint8_t *data
);

/*******************************************************************************
  Function:
    bool USBHostHIDReadIsComplete( uint8_t deviceAddress, uint8_t *errorCode, uint32_t *byteCount )

  Summary:
    This function indicates whether or not the last read request is complete.

  Description:
    This function indicates whether or not the last read request is complete.
    If the functions returns true, the returned byte count and error
    code are valid. Since only one read request can be performed at once
    and only one endpoint can be used, we only need to know the
    device address.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress  - Device address
    uint8_t *errorCode     - Error code from last transfer
    uint32_t *byteCount    - Number of bytes transferred

  Return Values:
    true    - Transfer is complete, errorCode is valid
    false   - Transfer is not complete, errorCode is not valid
*******************************************************************************/
bool USBHostHIDReadIsComplete
(
    uint8_t deviceAddress,
    uint8_t *errorCode,
    uint8_t *byteCount
);

/*******************************************************************************
  Function:
     uint8_t USBHostHIDReadTerminate( uint8_t deviceAddress, uint8_t interfaceNum )

  Summary:
    This function terminates a read request that is in progress.

  Description:
    This function terminates a read request that is in progress.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress  - Device address
    uint8_t interfaceNum   - Interface number

  Return Values:
    USB_SUCCESS                 - read request terminated
    USB_HID_DEVICE_NOT_FOUND    - No device with specified address

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHIDReadTerminate
(
    uint8_t deviceAddress,
    uint8_t interfaceNum
);

/*******************************************************************************
  Function:
    uint8_t USBHostHIDResetDevice( uint8_t deviceAddress )

  Summary:
    This function starts a HID  reset.

  Description:
    This function starts a HID reset.  A reset can be
    issued only if the device is attached and not being initialized.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress - Device address

  Return Values:
    USB_SUCCESS                 - Reset started
    USB_MSD_DEVICE_NOT_FOUND    - No device with specified address
    USB_MSD_ILLEGAL_REQUEST     - Device is in an illegal state for reset

  Remarks:
    None
*******************************************************************************/
uint8_t    USBHostHIDResetDevice
(
    uint8_t deviceAddress
);

/*******************************************************************************
  Function:
     void USBHostHIDTasks( void )

  Summary:
    This function performs the maintenance tasks required by HID class

  Description:
    This function performs the maintenance tasks required by the HID
    class.  If transfer events from the host layer are not being used, then
    it should be called on a regular basis by the application.  If transfer
    events from the host layer are being used, this function is compiled out,
    and does not need to be called.

  Precondition:
    USBHostHIDInitialize() has been called.

  Parameters:
    None - None

  Returns:
    None

  Remarks:
    None
*******************************************************************************/
void    USBHostHIDTasks( void );

/*******************************************************************************
  Function:
    uint8_t USBHostHIDWrite( uint8_t deviceAddress,uint8_t reportid, uint8_t interface,
                uint8_t size, uint8_t *data)

  Summary:
    This function starts a Set report transfer request to the device,
    utilizing the function USBHostHIDTransfer();

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress      - Device address
    uint8_t reportid           - Report ID of the requested report
    uint8_t interface          - Interface number
    uint8_t size               - Byte size of the data buffer
    uint8_t *data              - Pointer to the data buffer

  Return Values:
    USB_SUCCESS                 - Request started successfully
    USB_HID_DEVICE_NOT_FOUND    - No device with specified address
    USB_HID_DEVICE_BUSY         - Device not in proper state for
                                  performing a transfer
    Others                      - Return values from USBHostIssueDeviceRequest(),
                                    and USBHostWrite()

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHIDWrite
(
    uint8_t deviceAddress,
    uint8_t reportid,
    uint8_t interface,
    uint8_t size,
    uint8_t *data
);

/*******************************************************************************
  Function:
    bool USBHostHIDWriteIsComplete( uint8_t deviceAddress, uint8_t *errorCode, uint32_t *byteCount )

  Summary:
    This function indicates whether or not the last write request is complete.

  Description:
    This function indicates whether or not the last write request is complete.
    If the functions returns true, the returned byte count and error
    code are valid. Since only one write can be performed at once
    and only one endpoint can be used, we only need to know the
    device address.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress  - Device address
    uint8_t *errorCode     - Error code from last transfer
    uint32_t *byteCount    - Number of bytes transferred

  Return Values:
    true    - Transfer is complete, errorCode is valid
    false   - Transfer is not complete, errorCode is not valid
*******************************************************************************/
bool USBHostHIDWriteIsComplete
(
    uint8_t deviceAddress,
    uint8_t *errorCode,
    uint8_t *byteCount
);

/*******************************************************************************
  Function:
     uint8_t USBHostHIDWriteTerminate( uint8_t deviceAddress, uint8_t interfaceNum )

  Summary:
    This function terminates a write request that is in progress.

  Description:
    This function terminates a write request that is in progress.

  Precondition:
    None

  Parameters:
    uint8_t deviceAddress  - Device address
    uint8_t interfaceNum   - Interface number

  Return Values:
    USB_SUCCESS                 - write request terminated
    USB_HID_DEVICE_NOT_FOUND    - No device with specified address

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHIDWriteTerminate
(
    uint8_t deviceAddress,
    uint8_t interfaceNum
);

// *****************************************************************************
// *****************************************************************************
// Section: USB Host HID Report Functions
// *****************************************************************************
// *****************************************************************************

/*******************************************************************************
  Function:
    bool USBHostHID_ApiFindBit(uint16_t usagePage,uint16_t usage,HIDReportTypeEnum type,
                          uint8_t* Report_ID, uint8_t* Report_Length, uint8_t* Start_Bit)

  Description:
    This function is used to locate a specific button or indicator.
    Once the report descriptor is parsed by the HID layer without any error,
    data from the report descriptor is stored in pre defined dat structures.
    This function traverses these data structure and exract data required
    by application

  Precondition:
    None

  Parameters:
    uint16_t usagePage         - usage page supported by application
    uint16_t usage             - usage supported by application
    HIDReportTypeEnum type - report type Input/Output for the particular
                             usage
    uint8_t* Report_ID        - returns the report ID of the required usage
    uint8_t* Report_Length    - returns the report length of the required usage
    uint8_t* Start_Bit        - returns  the start bit of the usage in a
                             particular report

  Return Values:
    true    - If the required usage is located in the report descriptor
    false   - If the application required usage is not supported by the
              device(i.e report descriptor).

  Remarks:
    Application event handler with event 'EVENT_HID_RPT_DESC_PARSED' is called.
    Application is suppose to fill in data details in structure 'HID_DATA_DETAILS'.
    This function can be used to the get the details of the required usages.
*******************************************************************************/
bool USBHostHID_ApiFindBit
(
    uint16_t usagePage,
    uint16_t usage,
    HIDReportTypeEnum type,
    uint8_t* Report_ID,
    uint8_t* Report_Length,
    uint8_t* Start_Bit
);

/*******************************************************************************
  Function:
    bool USBHostHID_ApiFindValue(uint16_t usagePage,uint16_t usage,
                HIDReportTypeEnum type,uint8_t* Report_ID,uint8_t* Report_Length,uint8_t*
                Start_Bit, uint8_t* Bit_Length)

  Description:
    Find a specific Usage Value. Once the report descriptor is parsed by the HID
    layer without any error, data from the report descriptor is stored in
    pre defined dat structures. This function traverses these data structure and
    exract data required by application.

  Precondition:
    None

  Parameters:
    uint16_t usagePage         - usage page supported by application
    uint16_t usage             - usage supported by application
    HIDReportTypeEnum type - report type Input/Output for the particular
                             usage
    uint8_t* Report_ID        - returns the report ID of the required usage
    uint8_t* Report_Length    - returns the report length of the required usage
    uint8_t* Start_Bit        - returns  the start bit of the usage in a
                             particular report
    uint8_t* Bit_Length       - returns size of requested usage type data in bits

  Return Values:
    true    - If the required usage is located in the report descriptor
    false   - If the application required usage is not supported by the
              device(i.e report descriptor).

  Remarks:
    Application event handler with event 'EVENT_HID_RPT_DESC_PARSED' is called.
    Application is suppose to fill in data details structure 'HID_DATA_DETAILS'
    This function can be used to the get the details of the required usages.
*******************************************************************************/
bool USBHostHID_ApiFindValue
(
    uint16_t usagePage,
    uint16_t usage,
    HIDReportTypeEnum type,
    uint8_t* Report_ID,
    uint8_t* Report_Length,
    uint8_t* Start_Bit,
    uint8_t* Bit_Length
);

/*******************************************************************************
  Function:
    uint8_t USBHostHID_ApiGetCurrentInterfaceNum(void)

  Description:
    This function reurns the interface number of the cuurent report descriptor
    parsed. This function must be called to fill data interface detail data
    structure and passed as parameter when requesinf for report transfers.

  Precondition:
    None

  Parameters:
    None

  Return Values:
    true    - Transfer is complete, errorCode is valid
    false   - Transfer is not complete, errorCode is not valid

  Remarks:
    None
*******************************************************************************/
uint8_t USBHostHID_ApiGetCurrentInterfaceNum(void);

/*******************************************************************************
  Function:
    bool USBHostHID_ApiImportData(uint8_t *report, uint16_t reportLength,
                     HID_USER_DATA_SIZE *buffer,HID_DATA_DETAILS *pDataDetails)
  Description:
    This function can be used by application to extract data from the input
    reports. On receiving the input report from the device application can call
    the function with required inputs 'HID_DATA_DETAILS'.

  Precondition:
    None

  Parameters:
    uint8_t *report                    - Input report received from device
    uint16_t reportLength               - Length of input report report
    HID_USER_DATA_SIZE *buffer      - Buffer into which data needs to be
                                      populated
    HID_DATA_DETAILS *pDataDetails  - data details extracted from report
                                      descriptor
  Return Values:
    true    - If the required data is retrieved from the report
    false   - If required data is not found.

  Remarks:
    None
*******************************************************************************/
bool USBHostHID_ApiImportData
(
    uint8_t *report,
    uint16_t reportLength,
    HID_USER_DATA_SIZE *buffer,
    HID_DATA_DETAILS *pDataDetails
);

/****************************************************************************
  Function:
    uint8_t* USBHostHID_GetCurrentReportInfo(void)

  Description:
    This function returns a pointer to the current report info structure.

  Precondition:
    None

  Parameters:
    None

  Returns:
    uint8_t * - Pointer to the report Info structure.

  Remarks:
    None
  ***************************************************************************/
#define USBHostHID_GetCurrentReportInfo() (&deviceRptInfo)

/****************************************************************************
  Function:
    uint8_t* USBHostHID_GetItemListPointers()

  Description:
    This function returns a pointer to list of item pointers stored in a
    structure.

  Precondition:
    None

  Parameters:
    None

  Returns:
    uint8_t * - Pointer to list of item pointers structure.

  Remarks:
    None
  ***************************************************************************/
#define USBHostHID_GetItemListPointers() (&itemListPtrs)

// *****************************************************************************
// *****************************************************************************
// Section: USB Host Callback Function Prototypes
// *****************************************************************************
// *****************************************************************************

/*******************************************************************************
  Function:
    bool USBHostHIDInitialize( uint8_t address, uint16_t flags, uint8_t clientDriverID )

  Summary:
    This function is the initialization routine for this client driver.

  Description:
    This function is the initialization routine for this client driver.  It
    is called by the host layer when the USB device is being enumerated.For a
    HID device we need to look into HID descriptor, interface descriptor and
    endpoint descriptor.

  Precondition:
    None

  Parameters:
    uint8_t address        - Address of the new device
    uint32_t flags          - Initialization flags
    uint8_t clientDriverID - Client driver identification for device requests

  Return Values:
    true   - We can support the device.
    false  - We cannot support the device.

  Remarks:
    None
*******************************************************************************/
bool USBHostHIDInitialize
(
    uint8_t address,
    uint32_t flags,
    uint8_t clientDriverID
);

/*******************************************************************************
  Function:
    bool USBHostHIDEventHandler( uint8_t address, USB_EVENT event,
                        void *data, uint32_t size )

  Precondition:
    The device has been initialized.

  Summary:
    This function is the event handler for this client driver.

  Description:
    This function is the event handler for this client driver.  It is called
    by the host layer when various events occur.

  Parameters:
    uint8_t address    - Address of the device
    USB_EVENT event - Event that has occurred
    void *data      - Pointer to data pertinent to the event
    uint32_t size       - Size of the data

  Return Values:
    true   - Event was handled
    false  - Event was not handled

  Remarks:
    None
*******************************************************************************/
bool USBHostHIDEventHandler
(
    uint8_t address,
    USB_EVENT event,
    void *data,
    uint32_t size
);

/*******************************************************************************
  Function:
    bool USBHostHIDAppDataEventHandler( uint8_t address, USB_EVENT event,
                        void *data, uint32_t size )

  Precondition:
    The device has been initialized.

  Summary:
    This function is the data event handler for this client driver.

  Description:
    This function is the data event handler for this client driver.  It is called
    by the host layer when various events occur.

  Parameters:
    uint8_t address    - Address of the device
    USB_EVENT event - Event that has occurred
    void *data      - Pointer to data pertinent to the event
    uint32_t size       - Size of the data

  Return Values:
    true   - Event was handled
    false  - Event was not handled

  Remarks:
    None
*******************************************************************************/
bool USBHostHIDAppDataEventHandler( uint8_t address, USB_EVENT event, void *data, uint32_t size );

#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace ShantenHelper.Interfaces
{
    public interface IDrawingComponent
    {
        void Draw(Microsoft.Xna.Framework.GameTime gameTime);
    }
}


text:
package com.xeiam.xchange.btcchina.dto.trade.request;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class BTCChinaGetMarketDepthRequestTest {

  @Test
  public void testBTCChinaGetMarketDepthRequest() {

    assertEquals("[]", new BTCChinaGetMarketDepthRequest(null, null).getParams());
    assertEquals("[1]", new BTCChinaGetMarketDepthRequest(1, null).getParams());
    assertEquals("[10,\"LTCCNY\"]", new BTCChinaGetMarketDepthRequest(null, "LTCCNY").getParams());
    assertEquals("[1,\"LTCCNY\"]", new BTCChinaGetMarketDepthRequest(1, "LTCCNY").getParams());
  }

}


text:
package org.jboss.arquillian.integration.persistence.testextension.event.annotation;

import org.jboss.arquillian.persistence.TestExecutionPhase;

import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target(METHOD)
@Retention(RUNTIME)
@Inherited
public @interface CleanupUsingScriptShouldBeTriggered
{

   TestExecutionPhase value();

}


text:
using System;

namespace Shindy.Core.Entities
{
    public class Attendee
    {
        public int AttendeeID { get; set; }
        public int EventID { get; set; }
        public int PersonID { get; set; }
        public DateTime? CreatedDate { get; set; }
        public string CreatedUser { get; set; }
        public DateTime UpdatedDate { get; set; }
        public string UpdatedUser { get; set; }
        public virtual Event Event { get; set; }
        public virtual Person Person { get; set; }
    }
}


text:
BiddingStrategyServiceでは、自動入札設定の取得および追加・更新・削除を行います。
#### WSDL
| environment | url |
|---|---|
| production  | https://ss.yahooapis.jp/services/V201909/BiddingStrategyService?wsdl|
| sandbox  | https://sandbox.ss.yahooapis.jp/services/V201909/BiddingStrategyService?wsdl|
#### Namespace
http://ss.yahooapis.jp/V201909/BiddingStrategy
#### サービス概要
自動入札設定の取得および追加・更新・削除を行います。
#### 操作
BiddingStrategyServiceで提供される操作を説明します。

+ [get](#get)
+ [mutate(ADD)](#mutateadd)
+ [mutate(SET)](#mutateset)
+ [mutate(REMOVE)](#mutateremove)

#### オブジェクト
[BiddingStrategy](../data/BiddingStrategy)

## get
自動入札設定に関する情報を取得します。

### リクエスト
| パラメータ | 必須 | データ型 | 説明 |
|---|---|---|---|
| selector | ○ | [BiddingStrategySelector](../data/BiddingStrategy/BiddingStrategySelector.md) | 自動入札設定を取得します。 |

##### <リクエストサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <RequestHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:license>1111-1111-1111-1111</ns2:license>
      <ns2:apiAccountId>2222-2222-2222-2222</ns2:apiAccountId>
      <ns2:apiAccountPassword>password</ns2:apiAccountPassword>
    </RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <get xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <selector>
        <accountId>1234567890</accountId>
        <biddingStrategyIds>20001</biddingStrategyIds>
        <biddingStrategyIds>20002</biddingStrategyIds>
        <biddingStrategyIds>20003</biddingStrategyIds>
        <biddingStrategyIds>20004</biddingStrategyIds>
        <biddingStrategyIds>20005</biddingStrategyIds>
        <biddingStrategyTypes>TARGET_CPA</biddingStrategyTypes>
        <biddingStrategyTypes>TARGET_SPEND</biddingStrategyTypes>
        <biddingStrategyTypes>TARGET_ROAS</biddingStrategyTypes>
        <paging>
          <ns2:startIndex>1</ns2:startIndex>
          <ns2:numberResults>1000</ns2:numberResults>
        </paging>
      </selector>
    </get>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

### レスポンス
正常時のレスポンスフィールド

| フィールド | データ型 | 説明 |
|---|---|---|
| rval | [BiddingStrategyPage](../data/BiddingStrategy/BiddingStrategyPage.md) | 取得される広告グループのエントリーです。 |

##### <レスポンスサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <ResponseHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:service>BiddingStrategy</ns2:service>
      <ns2:requestTime>1567167410059</ns2:requestTime>
      <ns2:timeTakenSeconds>0.2671</ns2:timeTakenSeconds>
    </ResponseHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns2:getResponse xmlns="http://ss.yahooapis.jp/V201909" xmlns:ns2="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <ns2:rval>
        <totalNumEntries>3</totalNumEntries>
        <Page.Type>BiddingStrategyPage</Page.Type>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20003</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetCpaBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetCpaBiddingScheme">
              <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
              <ns2:targetCpa>99999999</ns2:targetCpa>
              <ns2:bidCeiling>500</ns2:bidCeiling>
              <ns2:bidFloor>1</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20004</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetSpendBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetSpendBiddingScheme">
              <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
              <ns2:bidCeiling>1</ns2:bidCeiling>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20005</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetRoasBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetRoasBiddingScheme">
              <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
              <ns2:targetRoas>1000.0</ns2:targetRoas>
              <ns2:bidCeiling>5000</ns2:bidCeiling>
              <ns2:bidFloor>10</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
      </ns2:rval>
    </ns2:getResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

## mutate(ADD)
自動入札設定を追加します。

### リクエスト
| パラメータ | 必須 | 値 | 説明 |
|---|---|---|---|
| operations | ○ | [BiddingStrategyOperation](../data/BiddingStrategy/BiddingStrategyOperation.md) | 自動入札設定を作成します。 |

##### <リクエストサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <RequestHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:license>1111-1111-1111-1111</ns2:license>
      <ns2:apiAccountId>2222-2222-2222-2222</ns2:apiAccountId>
      <ns2:apiAccountPassword>password</ns2:apiAccountPassword>
    </RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <mutate xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <operations>
        <operator>ADD</operator>
        <accountId>1234567890</accountId>
        <operand>
          <biddingStrategyName>TargetCpaBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetCpaBiddingScheme">
            <biddingStrategyType>TARGET_CPA</biddingStrategyType>
            <targetCpa>99999999</targetCpa>
            <bidCeiling>500</bidCeiling>
            <bidFloor>1</bidFloor>
          </biddingScheme>
        </operand>
        <operand>
          <biddingStrategyName>TargetSpendBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetSpendBiddingScheme">
            <biddingStrategyType>TARGET_SPEND</biddingStrategyType>
            <bidCeiling>1</bidCeiling>
          </biddingScheme>
        </operand>
        <operand>
          <biddingStrategyName>TargetRoasBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetRoasBiddingScheme">
            <biddingStrategyType>TARGET_ROAS</biddingStrategyType>
            <targetRoas>1000.0</targetRoas>
            <bidCeiling>5000</bidCeiling>
            <bidFloor>10</bidFloor>
          </biddingScheme>
        </operand>
      </operations>
    </mutate>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

### レスポンス
正常時のレスポンスフィールド

| フィールド | データ型 | 説明 |
|---|---|---|
| rval | [BiddingStrategyReturnValue](../data/BiddingStrategy/BiddingStrategyReturnValue.md) | 操作結果を含む自動入札設定に関する情報のコンテナです。 |

##### <レスポンスサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <ResponseHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:service>BiddingStrategy</ns2:service>
      <ns2:requestTime>1567167410100</ns2:requestTime>
      <ns2:timeTakenSeconds>0.2671</ns2:timeTakenSeconds>
    </ResponseHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns2:mutateResponse xmlns="http://ss.yahooapis.jp/V201909" xmlns:ns2="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <ns2:rval>
        <ListReturnValue.Type>BiddingStrategyReturnValue</ListReturnValue.Type>
        <Operation.Type>ADD</Operation.Type>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20003</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetCpaBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetCpaBiddingScheme">
              <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
              <ns2:targetCpa>99999999</ns2:targetCpa>
              <ns2:bidCeiling>500</ns2:bidCeiling>
              <ns2:bidFloor>1</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20004</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetSpendBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetSpendBiddingScheme">
              <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
              <ns2:bidCeiling>1</ns2:bidCeiling>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20005</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetRoasBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetRoasBiddingScheme">
              <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
              <ns2:targetRoas>1000.0</ns2:targetRoas>
              <ns2:bidCeiling>5000</ns2:bidCeiling>
              <ns2:bidFloor>10</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
      </ns2:rval>
    </ns2:mutateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

## mutate(SET)
自動入札設定を更新します。

### リクエスト
| パラメータ | 必須 | 値 | 説明 |
|---|---|---|---|
| operations | ○ | [BiddingStrategyOperation](../data/BiddingStrategy/BiddingStrategyOperation.md) | 自動入設定を更新します。 |

##### <リクエストサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <RequestHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:license>1111-1111-1111-1111</ns2:license>
      <ns2:apiAccountId>2222-2222-2222-2222</ns2:apiAccountId>
      <ns2:apiAccountPassword>password</ns2:apiAccountPassword>
    </RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <mutate xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <operations>
        <operator>SET</operator>
        <accountId>1234567890</accountId>
        <operand>
          <biddingStrategyId>20003</biddingStrategyId>
          <biddingStrategyName>set TargetCpaBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetCpaBiddingScheme">
            <biddingStrategyType>TARGET_CPA</biddingStrategyType>
            <targetCpa>11111111</targetCpa>
            <bidCeiling>100</bidCeiling>
            <bidFloor>10</bidFloor>
          </biddingScheme>
        </operand>
        <operand>
          <biddingStrategyId>20004</biddingStrategyId>
          <biddingStrategyName>set TargetSpendBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetSpendBiddingScheme">
            <biddingStrategyType>TARGET_SPEND</biddingStrategyType>
            <bidCeiling>2</bidCeiling>
          </biddingScheme>
        </operand>
        <operand>
          <biddingStrategyId>20005</biddingStrategyId>
          <biddingStrategyName>set TargetRoasBiddingScheme</biddingStrategyName>
          <biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetRoasBiddingScheme">
            <biddingStrategyType>TARGET_ROAS</biddingStrategyType>
            <targetRoas>100.0</targetRoas>
            <bidCeiling>3000</bidCeiling>
            <bidFloor>1</bidFloor>
          </biddingScheme>
        </operand>
      </operations>
    </mutate>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

### レスポンス
正常時のレスポンスフィールド

| フィールド | データ型 | 説明 |
|---|---|---|
| rval | [BiddingStrategyReturnValue](../data/BiddingStrategy/BiddingStrategyReturnValue.md) | 操作結果を含む自動入札設定に関する情報のコンテナです。 |

##### <レスポンスサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <ResponseHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:service>BiddingStrategy</ns2:service>
      <ns2:requestTime>1567167410128</ns2:requestTime>
      <ns2:timeTakenSeconds>0.2671</ns2:timeTakenSeconds>
    </ResponseHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns2:mutateResponse xmlns="http://ss.yahooapis.jp/V201909" xmlns:ns2="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <ns2:rval>
        <ListReturnValue.Type>BiddingStrategyReturnValue</ListReturnValue.Type>
        <Operation.Type>SET</Operation.Type>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20003</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>set TargetCpaBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetCpaBiddingScheme">
              <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
              <ns2:targetCpa>11111111</ns2:targetCpa>
              <ns2:bidCeiling>100</ns2:bidCeiling>
              <ns2:bidFloor>10</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20004</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>set TargetSpendBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetSpendBiddingScheme">
              <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
              <ns2:bidCeiling>2</ns2:bidCeiling>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20005</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>set TargetRoasBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetRoasBiddingScheme">
              <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
              <ns2:targetRoas>100.0</ns2:targetRoas>
              <ns2:bidCeiling>3000</ns2:bidCeiling>
              <ns2:bidFloor>1</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
      </ns2:rval>
    </ns2:mutateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

## mutate(REMOVE)
自動入札設定を削除します。

### リクエスト
| パラメータ | 必須 | 値 | 説明 |
|---|---|---|---|
| operations | ○ | [BiddingStrategyOperation](../data/BiddingStrategy/BiddingStrategyOperation.md) | 自動入札設定を削除します。 |

##### <リクエストサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <RequestHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:license>1111-1111-1111-1111</ns2:license>
      <ns2:apiAccountId>2222-2222-2222-2222</ns2:apiAccountId>
      <ns2:apiAccountPassword>password</ns2:apiAccountPassword>
    </RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <mutate xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <operations>
        <operator>REMOVE</operator>
        <accountId>1234567890</accountId>
        <operand>
          <biddingStrategyId>20001</biddingStrategyId>
        </operand>
        <operand>
          <biddingStrategyId>20002</biddingStrategyId>
        </operand>
        <operand>
          <biddingStrategyId>20003</biddingStrategyId>
        </operand>
        <operand>
          <biddingStrategyId>20004</biddingStrategyId>
        </operand>
        <operand>
          <biddingStrategyId>20005</biddingStrategyId>
        </operand>
      </operations>
    </mutate>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

### レスポンス
正常時のレスポンスフィールド

| フィールド | データ型 | 説明 |
|---|---|---|
| rval | [BiddingStrategyReturnValue](../data/BiddingStrategy/BiddingStrategyReturnValue.md) | 操作結果を含む自動入札設定に関する情報のコンテナです。 |

##### <レスポンスサンプル>
```xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <ResponseHeader xmlns="http://ss.yahooapis.jp/V201909/BiddingStrategy" xmlns:ns2="http://ss.yahooapis.jp/V201909">
      <ns2:service>BiddingStrategy</ns2:service>
      <ns2:requestTime>1567167410154</ns2:requestTime>
      <ns2:timeTakenSeconds>0.2671</ns2:timeTakenSeconds>
    </ResponseHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns2:mutateResponse xmlns="http://ss.yahooapis.jp/V201909" xmlns:ns2="http://ss.yahooapis.jp/V201909/BiddingStrategy">
      <ns2:rval>
        <ListReturnValue.Type>BiddingStrategyReturnValue</ListReturnValue.Type>
        <Operation.Type>REMOVE</Operation.Type>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20003</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetCpaBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetCpaBiddingScheme">
              <ns2:biddingStrategyType>TARGET_CPA</ns2:biddingStrategyType>
              <ns2:targetCpa>11111111</ns2:targetCpa>
              <ns2:bidCeiling>100</ns2:bidCeiling>
              <ns2:bidFloor>10</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20004</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetSpendBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetSpendBiddingScheme">
              <ns2:biddingStrategyType>TARGET_SPEND</ns2:biddingStrategyType>
              <ns2:bidCeiling>2</ns2:bidCeiling>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
        <ns2:values>
          <operationSucceeded>true</operationSucceeded>
          <ns2:biddingStrategy>
            <ns2:accountId>1234567890</ns2:accountId>
            <ns2:biddingStrategyId>20005</ns2:biddingStrategyId>
            <ns2:biddingStrategyName>TargetRoasBiddingScheme</ns2:biddingStrategyName>
            <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
            <ns2:biddingScheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TargetRoasBiddingScheme">
              <ns2:biddingStrategyType>TARGET_ROAS</ns2:biddingStrategyType>
              <ns2:targetRoas>100.0</ns2:targetRoas>
              <ns2:bidCeiling>3000</ns2:bidCeiling>
              <ns2:bidFloor>1</ns2:bidFloor>
            </ns2:biddingScheme>
          </ns2:biddingStrategy>
        </ns2:values>
      </ns2:rval>
    </ns2:mutateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

<a rel="license" href="http://creativecommons.org/licenses/by-nd/2.1/jp/"><img alt="クリエイティブ・コモンズ・ライセンス" style="border-width:0" src="https://i.creativecommons.org/l/by-nd/2.1/jp/88x31.png" /></a><br />この 作品 は <a rel="license" href="http://creativecommons.org/licenses/by-nd/2.1/jp/">クリエイティブ・コモンズ 表示 - 改変禁止 2.1 日本 ライセンスの下に提供されています。</a>


text:
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });

exports.default = class Command {
  constructor(props){
    Object.entries(props).map( ([k, v]) => this[k] = v);
  }
};


text:
//
// (C) Copyright 1998-1999 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//

#ifndef ARXDBGUITDMDATABASE_H
#define ARXDBGUITDMDATABASE_H

#include "Res_ArxDbg.h"

class ArxDbgUiTdcSymTbl;
class ArxDbgUiTdcDict;
class ArxDbgUiTdcDatabase;

/****************************************************************************
**
**	CLASS ArxDbgUiTdmDatabase:
**
**	**jma
**
*************************************/

class ArxDbgUiTdmDatabase : public CAcUiTabMainDialog {

public:
            ArxDbgUiTdmDatabase(AcDbDatabase* db, CWnd* parent, const char* winTitle = NULL);
			ArxDbgUiTdmDatabase(const AcDbObjectId& dictId, CWnd* parent, const char* winTitle = NULL);	// when you just want page for extension dict
	virtual	~ArxDbgUiTdmDatabase();

    //{{AFX_DATA(ArxDbgUiTdmDatabase)
    enum { IDD = ARXDBG_TDM_DATABASE };
	CAdUiTab	m_tabCtrl;
    //}}AFX_DATA

    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(ArxDbgUiTdmDatabase)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

protected:
    // Generated message map functions
    //{{AFX_MSG(ArxDbgUiTdmDatabase)
    virtual BOOL OnInitDialog();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()

private:
        // data members
	AcDbDatabase*			m_db;
	CString					m_winTitle;
	ArxDbgUiTdcSymTbl*		m_tdcSymTbl;
	ArxDbgUiTdcDict*		m_tdcDicts;
	ArxDbgUiTdcDatabase*	m_tdcDb;
};

#endif // ARXDBGUITDMDATABASE_H


text:
namespace util {
using base::Status;

}  // namespace util

#endif  // _UTIL_STATUS_H