text:
package org.kie.workbench.common.dmn.client.editors.expressions.types.dtable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import com.ait.lienzo.test.LienzoMockitoTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.workbench.common.dmn.api.definition.HasExpression;
import org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel;
import org.kie.workbench.common.dmn.api.definition.model.Context;
import org.kie.workbench.common.dmn.api.definition.model.ContextEntry;
import org.kie.workbench.common.dmn.api.definition.model.DMNDiagram;
import org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase;
import org.kie.workbench.common.dmn.api.definition.model.Decision;
import org.kie.workbench.common.dmn.api.definition.model.DecisionRule;
import org.kie.workbench.common.dmn.api.definition.model.DecisionTable;
import org.kie.workbench.common.dmn.api.definition.model.Definitions;
import org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition;
import org.kie.workbench.common.dmn.api.definition.model.InformationItem;
import org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary;
import org.kie.workbench.common.dmn.api.definition.model.InputClause;
import org.kie.workbench.common.dmn.api.definition.model.InputClauseLiteralExpression;
import org.kie.workbench.common.dmn.api.definition.model.InputData;
import org.kie.workbench.common.dmn.api.definition.model.ItemDefinition;
import org.kie.workbench.common.dmn.api.definition.model.OutputClause;
import org.kie.workbench.common.dmn.api.property.dmn.Description;
import org.kie.workbench.common.dmn.api.property.dmn.Id;
import org.kie.workbench.common.dmn.api.property.dmn.Name;
import org.kie.workbench.common.dmn.api.property.dmn.QName;
import org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType;
import org.kie.workbench.common.dmn.client.editors.types.common.ItemDefinitionUtils;
import org.kie.workbench.common.dmn.client.graph.DMNGraphUtils;
import org.kie.workbench.common.stunner.core.graph.Edge;
import org.kie.workbench.common.stunner.core.graph.Node;
import org.kie.workbench.common.stunner.core.graph.content.definition.Definition;
import org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionImpl;
import org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl;
import org.kie.workbench.common.stunner.core.graph.impl.NodeImpl;
import org.kie.workbench.common.stunner.core.util.UUID;

import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType.ANY;
import static org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType.NUMBER;
import static org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType.STRING;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(LienzoMockitoTestRunner.class)
public class DecisionTableEditorDefinitionEnricherTest extends BaseDecisionTableEditorDefinitionTest {

    private static final String NODE_UUID = UUID.uuid();

    private static final String INPUT_DATA_NAME_1 = "z-inputData1";

    private static final String INPUT_DATA_NAME_2 = "a-inputData2";

    private static final QName INPUT_DATA_QNAME_1 = STRING.asQName();

    private static final QName INPUT_DATA_QNAME_2 = NUMBER.asQName();

    private static final String DECISION_NAME_1 = "b-decision1";

    private static final String DEFAULT_OUTPUT_NAME = "output-1";

    private static final String TYPE_PERSON = "tPerson";

    private static final String TYPE_COMPANY = "tCompany";

    private static final QName DECISION_QNAME_1 = STRING.asQName();

    private static final QName OUTPUT_DATA_QNAME = BuiltInType.DATE.asQName();

    private static final QName T_ADDRESS_QNAME = new QName("", "tAddress");

    private DMNDiagram diagram;

    private InputData inputData1;

    private InputData inputData2;

    private Decision decision1;

    @Before
    public void setup() {
        super.setup();

        this.diagram = new DMNDiagram();
        this.inputData1 = new InputData();
        this.inputData2 = new InputData();
        this.decision1 = new Decision();
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithDecision() {
        setupGraphWithDiagram();
        setupGraphWithDecision();

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(1);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(DECISION_NAME_1);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(DECISION_QNAME_1);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithInputData() {
        setupGraphWithDiagram();
        setupGraphWithInputData();

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(2);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1);
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_1);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithDecisionAndInputData() {
        setupGraphWithDiagram();
        setupGraphWithDecision();
        setupGraphWithInputData();

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(3);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(DECISION_NAME_1);
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(DECISION_QNAME_1);
        assertThat(input.get(2).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(2).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1);
        assertThat(input.get(2).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_1);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithInputDataAndSimpleCustomType() {
        setupGraphWithDiagram();
        setupGraphWithInputData();

        final Definitions definitions = diagram.getDefinitions();

        final String simpleItemDefinitionName = "tSmurf";
        final QName simpleItemDefinitionTypeRef = new QName(QName.NULL_NS_URI, BuiltInType.DATE.getName());
        final ItemDefinition simpleItemDefinition = new ItemDefinition();
        simpleItemDefinition.setName(new Name(simpleItemDefinitionName));
        simpleItemDefinition.setTypeRef(simpleItemDefinitionTypeRef);
        definitions.getItemDefinition().add(simpleItemDefinition);

        final QName inputData1TypeRef = new QName(QName.NULL_NS_URI, simpleItemDefinitionName);
        inputData1.getVariable().setTypeRef(inputData1TypeRef);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(2);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1);
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(simpleItemDefinitionTypeRef);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithInputDataAndComplexCustomType() {
        setupGraphWithDiagram();
        setupGraphWithInputData();

        final Definitions definitions = diagram.getDefinitions();

        final String complexItemDefinitionName = "tSmurf";
        final String complexItemDefinitionPart1Name = "tDateOfBirth";
        final String complexItemDefinitionPart2Name = "tIsBlue";
        final QName complexItemDefinitionPart1TypeRef = new QName(QName.NULL_NS_URI, BuiltInType.DATE.getName());
        final QName complexItemDefinitionPart2TypeRef = new QName(QName.NULL_NS_URI, BuiltInType.BOOLEAN.getName());
        final ItemDefinition complexItemDefinition = new ItemDefinition();
        complexItemDefinition.setName(new Name(complexItemDefinitionName));
        complexItemDefinition.getItemComponent().add(new ItemDefinition() {{
            setName(new Name(complexItemDefinitionPart1Name));
            setTypeRef(complexItemDefinitionPart1TypeRef);
        }});
        complexItemDefinition.getItemComponent().add(new ItemDefinition() {{
            setName(new Name(complexItemDefinitionPart2Name));
            setTypeRef(complexItemDefinitionPart2TypeRef);
        }});

        definitions.getItemDefinition().add(complexItemDefinition);

        final QName inputData1TypeRef = new QName(QName.NULL_NS_URI, complexItemDefinitionName);
        inputData1.getVariable().setTypeRef(inputData1TypeRef);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(3);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + "." + complexItemDefinitionPart1Name);
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(complexItemDefinitionPart1TypeRef);
        assertThat(input.get(2).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(2).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + "." + complexItemDefinitionPart2Name);
        assertThat(input.get(2).getInputExpression().getTypeRef()).isEqualTo(complexItemDefinitionPart2TypeRef);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithInputDataAndRecursiveCustomType() {
        setupGraphWithDiagram();
        setupGraphWithInputData();

        final Definitions definitions = diagram.getDefinitions();

        final String tSmurfName = "tSmurf";
        final String tDateOfBirthName = "tDateOfBirth";
        final String tIsBlueName = "tIsBlue";
        final String tParentName = "tParent";
        final QName dateBuiltInType = new QName(QName.NULL_NS_URI, BuiltInType.DATE.getName());
        final QName booleanBuiltInType = new QName(QName.NULL_NS_URI, BuiltInType.BOOLEAN.getName());
        final QName parentCustomType = new QName(QName.NULL_NS_URI, tSmurfName);
        final ItemDefinition tSmurfCustomDataType = new ItemDefinition();
        tSmurfCustomDataType.setName(new Name(tSmurfName));
        tSmurfCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name(tDateOfBirthName));
            setTypeRef(dateBuiltInType);
        }});
        tSmurfCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name(tIsBlueName));
            setTypeRef(booleanBuiltInType);
        }});
        tSmurfCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name(tParentName));
            setTypeRef(parentCustomType);
        }});

        definitions.getItemDefinition().add(tSmurfCustomDataType);

        final QName inputData1TypeRef = new QName(QName.NULL_NS_URI, tSmurfName);
        inputData1.getVariable().setTypeRef(inputData1TypeRef);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(4);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + "." + tDateOfBirthName);
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(dateBuiltInType);
        assertThat(input.get(2).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(2).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + "." + tIsBlueName);
        assertThat(input.get(2).getInputExpression().getTypeRef()).isEqualTo(booleanBuiltInType);
        assertThat(input.get(3).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(3).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + "." + tParentName);
        assertThat(input.get(3).getInputExpression().getTypeRef()).isEqualTo(parentCustomType);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testModelEnrichmentWhenTopLevelDecisionTableWithMultipleHierarchyCustomTypes() {
        setupGraphWithDiagram();
        setupGraphWithInputData();

        final Definitions definitions = diagram.getDefinitions();

        final String tSmurf = "tSmurf";
        final String tSmurfAddress = "tSmurfAddress";
        final QName dateBuiltInType = new QName(QName.NULL_NS_URI, BuiltInType.DATE.getName());
        final QName stringBuiltInType = new QName(QName.NULL_NS_URI, STRING.getName());

        final ItemDefinition tSmurfAddressCustomDataType = new ItemDefinition();
        tSmurfAddressCustomDataType.setName(new Name(tSmurfAddress));
        tSmurfAddressCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name("line1"));
            setTypeRef(stringBuiltInType);
        }});
        tSmurfAddressCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name("line2"));
            setTypeRef(stringBuiltInType);
        }});

        final ItemDefinition tSmurfCustomDataType = new ItemDefinition();
        tSmurfCustomDataType.setName(new Name(tSmurf));
        tSmurfCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name("dob"));
            setTypeRef(dateBuiltInType);
        }});
        tSmurfCustomDataType.getItemComponent().add(new ItemDefinition() {{
            setName(new Name("address"));
            getItemComponent().add(tSmurfAddressCustomDataType);
        }});

        definitions.getItemDefinition().add(tSmurfCustomDataType);

        final QName inputData1TypeRef = new QName(QName.NULL_NS_URI, tSmurf);
        inputData1.getVariable().setTypeRef(inputData1TypeRef);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(NODE_UUID), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);

        final List<InputClause> input = model.getInput();
        assertThat(input.size()).isEqualTo(4);
        assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
        assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
        assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + ".address." + tSmurfAddress + ".line1");
        assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(stringBuiltInType);
        assertThat(input.get(2).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(2).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + ".address." + tSmurfAddress + ".line2");
        assertThat(input.get(2).getInputExpression().getTypeRef()).isEqualTo(stringBuiltInType);
        assertThat(input.get(3).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
        assertThat(input.get(3).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1 + ".dob");
        assertThat(input.get(3).getInputExpression().getTypeRef()).isEqualTo(dateBuiltInType);

        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    private void setupGraphWithDiagram() {
        final Node<Definition, Edge> diagramNode = new NodeImpl<>(UUID.uuid());
        final Definition<DMNDiagram> diagramDefinition = new DefinitionImpl<>(diagram);
        diagramNode.setContent(diagramDefinition);
        graph.addNode(diagramNode);
    }

    @SuppressWarnings("unchecked")
    private void setupGraphWithDecision() {
        Node<Definition, Edge> targetNode = graph.getNode(NODE_UUID);
        if (Objects.isNull(targetNode)) {
            targetNode = new NodeImpl<>(NODE_UUID);
            graph.addNode(targetNode);
        }

        final Node<Definition, Edge> sourceNode1 = new NodeImpl<>(UUID.uuid());
        decision1.getName().setValue(DECISION_NAME_1);
        final QName decision1QName = new QName(QName.NULL_NS_URI, STRING.getName());
        decision1.getVariable().setTypeRef(decision1QName);

        final Definition<Decision> sourceNode1Definition = new DefinitionImpl<>(decision1);
        sourceNode1.setContent(sourceNode1Definition);

        final Edge edge1 = new EdgeImpl<>(UUID.uuid());
        edge1.setTargetNode(targetNode);
        edge1.setSourceNode(sourceNode1);

        targetNode.getInEdges().add(edge1);
        sourceNode1.getOutEdges().add(edge1);

        graph.addNode(sourceNode1);
    }

    @SuppressWarnings("unchecked")
    private void setupGraphWithInputData() {
        Node<Definition, Edge> targetNode = graph.getNode(NODE_UUID);
        if (Objects.isNull(targetNode)) {
            targetNode = new NodeImpl<>(NODE_UUID);
            graph.addNode(targetNode);
        }

        final Node<Definition, Edge> sourceNode1 = new NodeImpl<>(UUID.uuid());
        final Node<Definition, Edge> sourceNode2 = new NodeImpl<>(UUID.uuid());
        inputData1.getName().setValue(INPUT_DATA_NAME_1);
        inputData2.getName().setValue(INPUT_DATA_NAME_2);
        final QName inputData1QName = new QName(QName.NULL_NS_URI, STRING.getName());
        final QName inputData2QName = new QName(QName.NULL_NS_URI, NUMBER.getName());
        inputData1.getVariable().setTypeRef(inputData1QName);
        inputData2.getVariable().setTypeRef(inputData2QName);

        final Definition<InputData> sourceNode1Definition = new DefinitionImpl<>(inputData1);
        final Definition<InputData> sourceNode2Definition = new DefinitionImpl<>(inputData2);
        sourceNode1.setContent(sourceNode1Definition);
        sourceNode2.setContent(sourceNode2Definition);

        final Edge edge1 = new EdgeImpl<>(UUID.uuid());
        final Edge edge2 = new EdgeImpl<>(UUID.uuid());
        edge1.setTargetNode(targetNode);
        edge1.setSourceNode(sourceNode1);
        edge2.setTargetNode(targetNode);
        edge2.setSourceNode(sourceNode2);

        targetNode.getInEdges().add(edge1);
        targetNode.getInEdges().add(edge2);
        sourceNode1.getOutEdges().add(edge1);
        sourceNode2.getOutEdges().add(edge2);

        graph.addNode(sourceNode1);
        graph.addNode(sourceNode2);
    }

    @Test
    public void testModelEnrichmentWhenTopLevelDecisionTableWithoutInputData() {
        final String uuid = UUID.uuid();
        final Node<Definition, Edge> node = new NodeImpl<>(uuid);
        graph.addNode(node);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        definition.enrich(Optional.of(uuid), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);
        assertStandardOutputClauseEnrichment(model);
        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenParentIsContextEntry() {
        final Decision decision = mock(Decision.class);
        final String name = "context-entry";
        final Context context = new Context();
        final ContextEntry contextEntry = new ContextEntry();
        context.getContextEntry().add(contextEntry);
        contextEntry.setVariable(new InformationItem(new Id(), new Description(), new Name(name), OUTPUT_DATA_QNAME));

        final Optional<DecisionTable> oModel = definition.getModelClass();
        oModel.get().setParent(contextEntry);
        contextEntry.setParent(context);
        context.setParent(decision);
        when(decision.asDMNModelInstrumentedBase()).thenReturn(contextEntry);

        definition.enrich(Optional.empty(), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(OUTPUT_DATA_QNAME);

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenParentIsBKM() {
        final FunctionDefinition functionDefinition = mock(FunctionDefinition.class);
        final DMNModelInstrumentedBase dmnModelInstrumentedBase = mock(DMNModelInstrumentedBase.class);
        final BusinessKnowledgeModel businessKnowledgeModel = new BusinessKnowledgeModel();
        businessKnowledgeModel.setVariable(new InformationItemPrimary(new Id(), new Name(), OUTPUT_DATA_QNAME));
        businessKnowledgeModel.setEncapsulatedLogic(functionDefinition);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        oModel.get().setParent(functionDefinition);
        when(functionDefinition.asDMNModelInstrumentedBase()).thenReturn(dmnModelInstrumentedBase);
        when(dmnModelInstrumentedBase.getParent()).thenReturn(businessKnowledgeModel);

        definition.enrich(Optional.empty(), functionDefinition, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(OUTPUT_DATA_QNAME);

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenParentIsContextEntryDefaultResult() {
        final String name = "decision";

        final Context context = new Context();
        final ContextEntry contextEntry = new ContextEntry();
        context.getContextEntry().add(contextEntry);
        contextEntry.setParent(context);
        context.setParent(decision);

        decision.setName(new Name(name));
        decision.getVariable().setTypeRef(OUTPUT_DATA_QNAME);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        oModel.get().setParent(contextEntry);

        definition.enrich(Optional.empty(), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(OUTPUT_DATA_QNAME);

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenParentIsNestedContextEntryDefaultResult() {
        final Decision decision = mock(Decision.class);
        final String name = "context-entry";
        final Context innerContext = new Context();
        final ContextEntry innerContextEntry = new ContextEntry();
        innerContext.getContextEntry().add(innerContextEntry);
        innerContextEntry.setParent(innerContext);

        final Context outerContext = new Context();
        final ContextEntry outerContextEntry = new ContextEntry();
        outerContext.getContextEntry().add(outerContextEntry);
        outerContextEntry.setParent(outerContext);
        innerContext.setParent(outerContextEntry);
        outerContext.setParent(decision);

        outerContextEntry.setVariable(new InformationItem(new Id(), new Description(), new Name(name), OUTPUT_DATA_QNAME));
        when(decision.asDMNModelInstrumentedBase()).thenReturn(outerContextEntry);

        final Optional<DecisionTable> oModel = definition.getModelClass();
        oModel.get().setParent(innerContextEntry);

        definition.enrich(Optional.empty(), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(OUTPUT_DATA_QNAME);

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenHasExpressionIsHasVariable() {
        decision.setVariable(new InformationItemPrimary(new Id(), new Name(), OUTPUT_DATA_QNAME));

        final Optional<DecisionTable> oModel = definition.getModelClass();

        definition.enrich(Optional.empty(), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(OUTPUT_DATA_QNAME);

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenHasExpressionIsNotHasVariable() {
        final Optional<DecisionTable> oModel = definition.getModelClass();

        definition.enrich(Optional.empty(), decision, oModel);

        final DecisionTable model = oModel.get();
        assertBasicEnrichment(model);
        assertStandardInputClauseEnrichment(model);

        final List<OutputClause> output = model.getOutput();
        assertThat(output.size()).isEqualTo(1);
        assertThat(output.get(0).getName()).isEqualTo(DEFAULT_OUTPUT_NAME);
        assertThat(output.get(0).getTypeRef()).isEqualTo(BuiltInType.UNDEFINED.asQName());

        assertStandardDecisionRuleEnrichment(model);
        assertParentHierarchyEnrichment(model);
    }

    @Test
    public void testModelEnrichmentWhenDecisionTypeRefIsStructureWithMultipleFields() {

        final DMNGraphUtils dmnGraphUtils = mock(DMNGraphUtils.class);
        final Definitions definitions = mock(Definitions.class);
        final HasExpression hasExpression = mock(HasExpression.class);
        final Decision decision = mock(Decision.class);
        final InformationItemPrimary informationItemPrimary = mock(InformationItemPrimary.class);
        final ItemDefinition tPerson = mockTPersonStructure();

        when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
        when(definitions.getItemDefinition()).thenReturn(Collections.singletonList(tPerson));
        when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(decision);
        when(decision.getVariable()).thenReturn(informationItemPrimary);
        when(informationItemPrimary.getTypeRef()).thenReturn(new QName("", TYPE_PERSON));

        final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, dmnGraphUtils, itemDefinitionUtils);
        final Optional<DecisionTable> oModel = definition.getModelClass();
        final DecisionTable model = oModel.get();
        enricher.buildOutputClausesByDataType(hasExpression, model, new DecisionRule());

        final List<OutputClause> outputClauses = model.getOutput();
        assertThat(outputClauses.size()).isEqualTo(2);

        final OutputClause outputClause1 = outputClauses.get(0);
        final OutputClause outputClause2 = outputClauses.get(1);

        assertEquals("age", outputClause1.getName());
        assertEquals(NUMBER.asQName(), outputClause1.getTypeRef());

        assertEquals("name", outputClause2.getName());
        assertEquals(STRING.asQName(), outputClause2.getTypeRef());
    }

    @Test
    public void testModelEnrichmentWhenDecisionTypeRefIsStructureAndOneSubfieldIsStructure() {

        final DMNGraphUtils dmnGraphUtils = mock(DMNGraphUtils.class);
        final Definitions definitions = mock(Definitions.class);
        final HasExpression hasExpression = mock(HasExpression.class);
        final Decision decision = mock(Decision.class);
        final InformationItemPrimary informationItemPrimary = mock(InformationItemPrimary.class);
        final ItemDefinition tCompany = mockTCompanyStructure();

        when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
        when(definitions.getItemDefinition()).thenReturn(Collections.singletonList(tCompany));
        when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(decision);
        when(decision.getVariable()).thenReturn(informationItemPrimary);
        when(informationItemPrimary.getTypeRef()).thenReturn(new QName("", TYPE_COMPANY));

        final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, dmnGraphUtils, itemDefinitionUtils);
        final Optional<DecisionTable> oModel = definition.getModelClass();
        final DecisionTable model = oModel.get();
        enricher.buildOutputClausesByDataType(hasExpression, model, new DecisionRule());

        final List<OutputClause> outputClauses = model.getOutput();
        assertThat(outputClauses.size()).isEqualTo(2);

        final OutputClause outputClause1 = outputClauses.get(0);
        final OutputClause outputClause2 = outputClauses.get(1);

        assertEquals("address", outputClause1.getName());
        assertEquals(ANY.asQName(), outputClause1.getTypeRef());

        assertEquals("name", outputClause2.getName());
        assertEquals(STRING.asQName(), outputClause2.getTypeRef());
    }

    private ItemDefinition mockTCompanyStructure() {
        final ItemDefinition tCompany = mock(ItemDefinition.class);
        final ItemDefinition name = mock(ItemDefinition.class);
        final ItemDefinition tAddress = mock(ItemDefinition.class);

        /* === ItemDefinition ===
         * - tCompany (Structure)
         *   - name     (String)
         *   - tAddress (Structure)
         * ======================
         */

        when(name.getName()).thenReturn(new Name("name"));
        when(name.getTypeRef()).thenReturn(STRING.asQName());
        when(name.getItemComponent()).thenReturn(emptyList());

        when(tAddress.getName()).thenReturn(new Name("address"));
        when(tAddress.getTypeRef()).thenReturn(T_ADDRESS_QNAME);
        when(tAddress.getItemComponent()).thenReturn(singletonList(name));

        when(tCompany.getName()).thenReturn(new Name(TYPE_COMPANY));
        when(tCompany.getTypeRef()).thenReturn(null);
        when(tCompany.getItemComponent()).thenReturn(asList(name, tAddress));
        return tCompany;
    }

    @Test
    public void testModelEnrichmentWhenDecisionTypeRefIsStructureWithNoFields() {

        final DMNGraphUtils dmnGraphUtils = mock(DMNGraphUtils.class);
        final Definitions definitions = mock(Definitions.class);
        final HasExpression hasExpression = mock(HasExpression.class);
        final Decision decision = mock(Decision.class);
        final InformationItemPrimary informationItemPrimary = mock(InformationItemPrimary.class);
        final ItemDefinition tPerson = mock(ItemDefinition.class);
        final QName tPersonTypeRef = new QName("", TYPE_PERSON);

        when(tPerson.getName()).thenReturn(new Name(TYPE_PERSON));
        when(tPerson.getTypeRef()).thenReturn(tPersonTypeRef);
        when(tPerson.getItemComponent()).thenReturn(emptyList());

        when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
        when(definitions.getItemDefinition()).thenReturn(Collections.singletonList(tPerson));
        when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(decision);
        when(decision.getVariable()).thenReturn(informationItemPrimary);
        when(informationItemPrimary.getTypeRef()).thenReturn(tPersonTypeRef);

        final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, dmnGraphUtils, itemDefinitionUtils);
        final Optional<DecisionTable> oModel = definition.getModelClass();
        final DecisionTable model = oModel.get();
        enricher.buildOutputClausesByDataType(hasExpression, model, new DecisionRule());

        final List<OutputClause> outputClauses = model.getOutput();
        assertThat(outputClauses.size()).isEqualTo(1);

        final OutputClause outputClause = outputClauses.get(0);

        assertEquals(DEFAULT_OUTPUT_NAME, outputClause.getName());
        assertEquals(tPersonTypeRef, outputClause.getTypeRef());
    }

    @Test
    public void testAddInputClauseRequirement() {

        final List<DecisionTableEditorDefinitionEnricher.ClauseRequirement> inputClauseRequirements = new ArrayList<>();
        final String inputData = "InputData";
        final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, null, itemDefinitionUtils);
        final ItemDefinition tPerson = mockTPersonStructure();

        enricher.addInputClauseRequirement(tPerson, inputClauseRequirements, inputData);

        assertEquals(2, inputClauseRequirements.size());

        final DecisionTableEditorDefinitionEnricher.ClauseRequirement inputClause1 = inputClauseRequirements.get(0);
        final DecisionTableEditorDefinitionEnricher.ClauseRequirement inputClause2 = inputClauseRequirements.get(1);

        assertEquals("InputData.name", inputClause1.text);
        assertEquals(STRING.getName(), inputClause1.typeRef.getLocalPart());

        assertEquals("InputData.age", inputClause2.text);
        assertEquals(NUMBER.getName(), inputClause2.typeRef.getLocalPart());
    }

    private ItemDefinition mockTPersonStructure() {
        final ItemDefinition tPerson = mock(ItemDefinition.class);
        final ItemDefinition name = mock(ItemDefinition.class);
        final ItemDefinition age = mock(ItemDefinition.class);

        /* === ItemDefinition ===
         * - tPerson (Structure)
         *   - name  (String)
         *   - age   (Number)
         * ======================
         */

        when(name.getName()).thenReturn(new Name("name"));
        when(name.getTypeRef()).thenReturn(STRING.asQName());
        when(name.getItemComponent()).thenReturn(emptyList());

        when(age.getName()).thenReturn(new Name("age"));
        when(age.getTypeRef()).thenReturn(NUMBER.asQName());
        when(age.getItemComponent()).thenReturn(emptyList());

        when(tPerson.getName()).thenReturn(new Name(TYPE_PERSON));
        when(tPerson.getTypeRef()).thenReturn(null);
        when(tPerson.getItemComponent()).thenReturn(asList(name, age));
        return tPerson;
    }

    @Test
    public void testAddInputClauseRequirementWhenDataTypeIsStructureAndDontHaveFields() {

        final ItemDefinition tPerson = mock(ItemDefinition.class);
        final String inputData = "InputData";
        final List<DecisionTableEditorDefinitionEnricher.ClauseRequirement> inputClauseRequirements = new ArrayList<>();
        final ItemDefinitionUtils itemDefinitionUtils = new ItemDefinitionUtils(mock(DMNGraphUtils.class));
        final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, null, itemDefinitionUtils);

        when(tPerson.getName()).thenReturn(new Name(TYPE_PERSON));
        when(tPerson.getTypeRef()).thenReturn(null);
        when(tPerson.getItemComponent()).thenReturn(emptyList());

        enricher.addInputClauseRequirement(tPerson, inputClauseRequirements, inputData);

        assertEquals(1, inputClauseRequirements.size());

        assertEquals("InputData", inputClauseRequirements.get(0).text);
        assertEquals(TYPE_PERSON, inputClauseRequirements.get(0).typeRef.getLocalPart());
    }

    @Test
    public void testComputingClauseNameWithoutModelRef() {
        final ItemDefinition itemComponent = new ItemDefinition();
        itemComponent.setName(new Name("model.age"));
        itemComponent.setAllowOnlyVisualChange(true);

        assertEquals("age", new DecisionTableEditorDefinitionEnricher(null, null, null)
                .computeClauseName(itemComponent));
    }

    @Test
    public void testComputingClauseNameWithoutModelRefWhenModelRefHasMultipleLevels() {
        final ItemDefinition itemComponent = new ItemDefinition();
        itemComponent.setName(new Name("a.b.c.age"));
        itemComponent.setAllowOnlyVisualChange(true);

        assertEquals("age", new DecisionTableEditorDefinitionEnricher(null, null, null)
                .computeClauseName(itemComponent));
    }

    @Test
    public void testComputingClauseNameWithoutModelRefWhenModelRefAlreadyMissing() {
        final ItemDefinition itemComponent = new ItemDefinition();
        itemComponent.setName(new Name("age"));
        itemComponent.setAllowOnlyVisualChange(true);

        assertEquals("age", new DecisionTableEditorDefinitionEnricher(null, null, null)
                .computeClauseName(itemComponent));
    }

    @Test
    public void testComputingClauseNameWithoutModelRefWhenLocalPartEndsWithDot() {
        final ItemDefinition itemComponent = new ItemDefinition();
        itemComponent.setName(new Name("age."));
        itemComponent.setAllowOnlyVisualChange(true);

        assertEquals("age.", new DecisionTableEditorDefinitionEnricher(null, null, null)
                .computeClauseName(itemComponent));
    }
}


text:
package cn.alandelip.teachingsupportapp.common.model;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author v-zhuxu on 6/19/2017.
 */
public class InternetModel {
    /**
     * Created by Alan on 2016/9/17.
     */
    private static final String BASE_URL = "http://115.29.184.56:8090/api/";
    private static final int DEFAULT_TIMEOUT = 10;
    protected Retrofit retrofit;

    protected InternetModel(String baseUrl) {
        OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
        httpClientBuilder.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);

        retrofit = new Retrofit.Builder()
                .client(httpClientBuilder.build())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .baseUrl(baseUrl)
                .build();
    }

    protected InternetModel() {
        OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
        httpClientBuilder.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);

        retrofit = new Retrofit.Builder()
                .client(httpClientBuilder.build())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .baseUrl(BASE_URL)
                .build();
    }
}

redpajama_set_name: RedPajamaGithub


text:
import os

import sublime
from sublime_plugin import WindowCommand, TextCommand

from ..git_command import GitCommand

COMMIT_HELP_TEXT = """

## To make a commit, type your commit message and press {key}-ENTER. To cancel
## the commit, close the window. To sign off the commit press {key}-S.

## You may also reference or close a GitHub issue with this commit.  To do so,
## type `#` followed by the `tab` key.  You will be shown a list of issues
## related to the current repo.  You may also type `owner/repo#` plus the `tab`
## key to reference an issue in a different GitHub repo.

""".format(key="CTRL" if os.name == "nt" else "SUPER")

COMMIT_SIGN_TEXT = """

Signed-off-by: {name} <{email}>
"""

COMMIT_TITLE = "COMMIT"

class GsCommitCommand(WindowCommand, GitCommand):

    """
    Display a transient window to capture the user's desired commit message.
    If the user is amending the previous commit, pre-populate the commit
    message area with the previous commit message.
    """

    def run(self, **kwargs):
        sublime.set_timeout_async(lambda: self.run_async(**kwargs), 0)

    def run_async(self, repo_path=None, include_unstaged=False, amend=False):
        repo_path = repo_path or self.repo_path
        view = self.window.new_file()
        view.settings().set("git_savvy.get_long_text_view", True)
        view.settings().set("git_savvy.commit_view.include_unstaged", include_unstaged)
        view.settings().set("git_savvy.commit_view.amend", amend)
        view.settings().set("git_savvy.repo_path", repo_path)
        view.set_syntax_file("Packages/GitSavvy/syntax/make_commit.tmLanguage")
        view.set_name(COMMIT_TITLE)
        view.set_scratch(True)
        view.run_command("gs_commit_initialize_view")

class GsCommitInitializeViewCommand(TextCommand, GitCommand):

    """
    Fill the view with the commit view help message, and optionally
    the previous commit message if amending.
    """

    def run(self, edit):
        merge_msg_path = os.path.join(self.repo_path, ".git", "MERGE_MSG")
        if self.view.settings().get("git_savvy.commit_view.amend"):
            last_commit_message = self.git("log", "-1", "--pretty=%B")
            initial_text = last_commit_message + COMMIT_HELP_TEXT
        elif os.path.exists(merge_msg_path):
            with open(merge_msg_path, "r") as f:
                initial_text = f.read() + COMMIT_HELP_TEXT
        else:
            initial_text = COMMIT_HELP_TEXT

        if sublime.load_settings("GitSavvy.sublime-settings").get("show_commit_diff"):
            stdout = self.git("diff", "--cached")
            initial_text = initial_text + stdout

        self.view.run_command("gs_replace_view_text", {
            "text": initial_text,
            "nuke_cursors": True
            })

class GsCommitViewDoCommitCommand(TextCommand, GitCommand):

    """
    Take the text of the current view (minus the help message text) and
    make a commit using the text for the commit message.
    """

    def run(self, edit):
        sublime.set_timeout_async(self.run_async, 0)

    def run_async(self):
        view_text = self.view.substr(sublime.Region(0, self.view.size()))
        commit_message = view_text.split(COMMIT_HELP_TEXT)[0]

        if self.view.settings().get("git_savvy.commit_view.include_unstaged"):
            self.add_all_tracked_files()

        if self.view.settings().get("git_savvy.commit_view.amend"):
            self.git("commit", "-q", "--amend", "-F", "-", stdin=commit_message)
        else:
            self.git("commit", "-q", "-F", "-", stdin=commit_message)

        self.view.window().focus_view(self.view)
        self.view.window().run_command("close_file")

class GsCommitViewSignCommand(TextCommand, GitCommand):

    """
    Sign off the commit with full name and email
    """

    def run(self, edit):
        view_text = self.view.substr(sublime.Region(0, self.view.size()))
        view_text_list = view_text.split(COMMIT_HELP_TEXT)

        config_name = self.git("config", "user.name").strip()
        config_email = self.git("config", "user.email").strip()

        sign_text = COMMIT_SIGN_TEXT.format(name=config_name, email=config_email)
        view_text_list[0] += sign_text

        self.view.run_command("gs_replace_view_text", {
            "text": COMMIT_HELP_TEXT.join(view_text_list),
            "nuke_cursors": True
            })


text:
<?xml version="1.0" ?>
<tei>
	<teiHeader>
		<fileDesc xml:id="55011710"/>
	</teiHeader>
	<text xml:lang="en">
		<front>
<lb/>
	<docTitle>
	<titlePart>Solder paste<lb/></titlePart>
	</docTitle>

	<note type="other">From Wikipedia, the free encyclopedia<lb/>This is an old revision of this page, as edited by Lightmouse (talk | contribs) at 22:50, 6 August<lb/> 2008. It may differ significantly from the current revision (//en.wikipedia.org/wiki/Solder_paste) .<lb/> (diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)<lb/></note>

		</front>
	</text>
</tei>


text:
'''
Written by Lijun An and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import pandas as pd
from utils.misc import create_folder

def merge_multiple_rounds(args,
                          bin,
                          round1_threshold,
                          round2_threshold,
                          name1='MACC',
                          name2='ADNI'):
    """
    Merge data (picked_adni.csv & picked_macc.csv) from multiple rounds

    Args:
        args (tuple): Parameters
        bin (int): Bin
        round1_threshold (int): Threshold for round 1 matching
        round2_threshold (int): Threshold for round 2 matching
        name1 (str, optional): Name for dataset1. Defaults to 'MACC'.
        name2 (str, optional): Name for dataset2. Defaults to 'ADNI'.
    """
    # read round1 data
    round1_step5_output_path = os.path.join(
        args.checkpoint_path, args.matching_pair,
        'matching_' + str(args.nb_bins) + 'BINs', 'BIN_' + str(bin), 'round_1',
        'step5_picking',
        'AGE' + str(args.age_penalty) + '_SEX' + str(args.sex_penalty) + '_DX'
        + str(args.dx_penalty) + '_MMSE' + str(args.mmse_penalty),
        'Threshold_' + str(round1_threshold))
    round1_macthed_dataset1 = pd.read_csv(
        os.path.join(round1_step5_output_path, 'picked_' + name1 + '.csv'))
    round1_macthed_dataset2 = pd.read_csv(
        os.path.join(round1_step5_output_path, 'picked_' + name2 + '.csv'))

    # read round 2 data
    threshold_name = 'Threshold_' + str(round1_threshold) + '-' + str(
        round2_threshold)
    round2_step5_output_path = os.path.join(
        args.checkpoint_path, args.matching_pair,
        'matching_' + str(args.nb_bins) + 'BINs', 'BIN_' + str(bin), 'round_2',
        'step5_picking',
        'AGE' + str(args.age_penalty) + '_SEX' + str(args.sex_penalty) + '_DX'
        + str(args.dx_penalty) + '_MMSE' + str(args.mmse_penalty),
        'Threshold_' + str(round2_threshold))
    round2_macthed_dataset1 = pd.read_csv(
        os.path.join(round2_step5_output_path, 'picked_' + name1 + '.csv'))
    round2_macthed_dataset2 = pd.read_csv(
        os.path.join(round2_step5_output_path, 'picked_' + name2 + '.csv'))

    merged_dataset1 = round1_macthed_dataset1.append(
        round2_macthed_dataset1, sort=False)
    merged_dataset2 = round1_macthed_dataset2.append(
        round2_macthed_dataset2, sort=False)

    output_path = os.path.join(
        args.checkpoint_path, args.matching_pair,
        'matching_' + str(args.nb_bins) + 'BINs', 'BIN_' + str(bin), 'merged',
        'AGE' + str(args.age_penalty) + '_SEX' + str(args.sex_penalty) + '_DX'
        + str(args.dx_penalty) + '_MMSE' + str(args.mmse_penalty),
        threshold_name)
    create_folder(output_path)
    # save merged data
    merged_dataset1.to_csv(
        os.path.join(output_path, 'picked_' + name1 + '.csv'),
        sep=',',
        index=False)
    merged_dataset2.to_csv(
        os.path.join(output_path, 'picked_' + name2 + '.csv'),
        sep=',',
        index=False)


text:
package auth_test

import (
	"errors"
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/concourse/concourse/atc/api/accessor"
	"github.com/concourse/concourse/atc/api/accessor/accessorfakes"
	"github.com/concourse/concourse/atc/api/auth"
	"github.com/concourse/concourse/atc/auditor/auditorfakes"
	"github.com/concourse/concourse/atc/db"
	"github.com/concourse/concourse/atc/db/dbfakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("CheckBuildReadAccessHandler", func() {
	var (
		response       *http.Response
		server         *httptest.Server
		delegate       *buildDelegateHandler
		buildFactory   *dbfakes.FakeBuildFactory
		handlerFactory auth.CheckBuildReadAccessHandlerFactory
		handler        http.Handler
		fakeAccessor   *accessorfakes.FakeAccessFactory
		fakeaccess     *accessorfakes.FakeAccess
		build          *dbfakes.FakeBuildForAPI
		pipeline       *dbfakes.FakePipeline
	)

	BeforeEach(func() {
		buildFactory = new(dbfakes.FakeBuildFactory)
		handlerFactory = auth.NewCheckBuildReadAccessHandlerFactory(buildFactory)
		fakeAccessor = new(accessorfakes.FakeAccessFactory)
		fakeaccess = new(accessorfakes.FakeAccess)

		delegate = &buildDelegateHandler{}

		build = new(dbfakes.FakeBuildForAPI)
		pipeline = new(dbfakes.FakePipeline)
		build.PipelineIDReturns(41)
		build.PipelineReturns(pipeline, true, nil)
		build.TeamIDReturns(42)
		build.TeamNameReturns("some-team")
		build.AllAssociatedTeamNamesReturns([]string{"some-team"})
		build.JobIDReturns(43)
		build.JobNameReturns("some-job")
	})

	JustBeforeEach(func() {
		fakeAccessor.CreateReturns(fakeaccess, nil)
		server = httptest.NewServer(handler)

		request, err := http.NewRequest("POST", server.URL+"?:build_id=55", nil)
		Expect(err).NotTo(HaveOccurred())

		response, err = new(http.Client).Do(request)
		Expect(err).NotTo(HaveOccurred())
	})

	var _ = AfterEach(func() {
		server.Close()
	})

	ItReturnsTheBuild := func() {
		It("returns 200 ok", func() {
			Expect(response.StatusCode).To(Equal(http.StatusOK))
		})

		It("calls delegate with the build context", func() {
			Expect(delegate.IsCalled).To(BeTrue())
			Expect(delegate.ContextBuild).To(BeIdenticalTo(build))
		})
	}

	WithExistingBuild := func(buildExistsFunc func()) {
		Context("when build exists", func() {
			BeforeEach(func() {
				buildFactory.BuildForAPIReturns(build, true, nil)
			})

			buildExistsFunc()
		})

		Context("when build is not found", func() {
			BeforeEach(func() {
				buildFactory.BuildReturns(nil, false, nil)
			})

			It("returns 404", func() {
				Expect(response.StatusCode).To(Equal(http.StatusNotFound))
			})
		})

		Context("when getting build fails", func() {
			BeforeEach(func() {
				buildFactory.BuildForAPIReturns(nil, false, errors.New("disaster"))
			})

			It("returns 503", func() {
				Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
			})
		})
	}

	Context("AnyJobHandler", func() {
		BeforeEach(func() {
			innerHandler := handlerFactory.AnyJobHandler(delegate, auth.UnauthorizedRejector{})

			handler = accessor.NewHandler(
				logger,
				"some-action",
				innerHandler,
				fakeAccessor,
				new(auditorfakes.FakeAuditor),
				map[string]string{},
			)
		})

		Context("when authenticated and accessing same team's build", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(true)
				fakeaccess.IsAuthorizedReturns(true)
			})

			WithExistingBuild(ItReturnsTheBuild)
		})

		Context("when authenticated but accessing different team's build", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(true)
				fakeaccess.IsAuthorizedReturns(false)
			})

			WithExistingBuild(func() {
				Context("when pipeline is public", func() {
					BeforeEach(func() {
						pipeline.PublicReturns(true)
						build.PipelineReturns(pipeline, true, nil)
					})

					ItReturnsTheBuild()
				})

				Context("when pipeline is private", func() {
					BeforeEach(func() {
						pipeline.PublicReturns(false)
						build.PipelineReturns(pipeline, true, nil)
					})

					It("returns 403", func() {
						Expect(response.StatusCode).To(Equal(http.StatusForbidden))
					})
				})
				Context("when fetching pipeline throws error", func() {
					BeforeEach(func() {
						build.PipelineReturns(pipeline, true, errors.New("some-error"))
					})
					It("return 500", func() {
						Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
					})
				})
				Context("when the build is not for a pipeline", func() {
					BeforeEach(func() {
						build.PipelineIDReturns(0)
					})
					It("return 403", func() {
						Expect(response.StatusCode).To(Equal(http.StatusForbidden))
					})
				})
				Context("when pipeline is not found", func() {
					BeforeEach(func() {
						build.PipelineReturns(nil, false, nil)
					})
					It("return 404", func() {
						Expect(response.StatusCode).To(Equal(http.StatusNotFound))
					})
				})
			})
		})

		Context("when not authenticated", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(false)
			})

			WithExistingBuild(func() {
				Context("when pipeline is public", func() {
					BeforeEach(func() {
						pipeline.PublicReturns(true)
						build.PipelineReturns(pipeline, true, nil)
					})

					ItReturnsTheBuild()
				})

				Context("when pipeline is private", func() {
					BeforeEach(func() {
						pipeline.PublicReturns(false)
						build.PipelineReturns(pipeline, true, nil)
					})

					It("returns 401", func() {
						Expect(response.StatusCode).To(Equal(http.StatusUnauthorized))
					})
				})
				Context("when fetching pipeline throws error", func() {
					BeforeEach(func() {
						build.PipelineReturns(pipeline, true, errors.New("some-error"))
					})
					It("return 500", func() {
						Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
					})
				})
				Context("when the build is not for a pipeline", func() {
					BeforeEach(func() {
						build.PipelineIDReturns(0)
					})
					It("return 401", func() {
						Expect(response.StatusCode).To(Equal(http.StatusUnauthorized))
					})
				})
				Context("when pipeline is not found", func() {
					BeforeEach(func() {
						build.PipelineReturns(nil, false, nil)
					})
					It("return 404", func() {
						Expect(response.StatusCode).To(Equal(http.StatusNotFound))
					})
				})
			})
		})
	})

	Context("CheckIfPrivateJobHandler", func() {
		var fakeJob *dbfakes.FakeJob

		BeforeEach(func() {
			fakeJob = new(dbfakes.FakeJob)
			innerHandler := handlerFactory.CheckIfPrivateJobHandler(delegate, auth.UnauthorizedRejector{})

			handler = accessor.NewHandler(
				logger,
				"some-action",
				innerHandler,
				fakeAccessor,
				new(auditorfakes.FakeAuditor),
				map[string]string{},
			)
		})

		ItChecksIfJobIsPrivate := func(status int) {
			Context("when pipeline is public", func() {
				BeforeEach(func() {
					pipeline.PublicReturns(true)
					build.PipelineReturns(pipeline, true, nil)
				})

				Context("when the build is not for a job", func() {
					BeforeEach(func() {
						build.JobIDReturns(0)
						build.JobNameReturns("")
					})

					It("returns "+fmt.Sprint(status), func() {
						Expect(response.StatusCode).To(Equal(status))
					})
				})

				Context("and job is public", func() {
					BeforeEach(func() {
						fakeJob.NameReturns("some-job")
						fakeJob.PublicReturns(true)

						pipeline.JobReturns(fakeJob, true, nil)
					})

					ItReturnsTheBuild()
				})

				Context("and job is private", func() {
					BeforeEach(func() {
						fakeJob.NameReturns("some-job")
						fakeJob.PublicReturns(false)

						pipeline.JobReturns(fakeJob, true, nil)
					})

					It("returns "+fmt.Sprint(status), func() {
						Expect(response.StatusCode).To(Equal(status))
					})
				})

				Context("getting the job fails", func() {
					BeforeEach(func() {
						pipeline.JobReturns(nil, false, errors.New("error"))
					})

					It("returns 500", func() {
						Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
					})
				})

				Context("when the job is not found", func() {
					BeforeEach(func() {
						pipeline.JobReturns(nil, false, nil)
					})

					It("return 404", func() {
						Expect(response.StatusCode).To(Equal(http.StatusNotFound))
					})
				})
			})

			Context("when pipeline is private", func() {
				BeforeEach(func() {
					pipeline.PublicReturns(false)
					build.PipelineReturns(pipeline, true, nil)
				})

				It("returns "+fmt.Sprint(status), func() {
					Expect(response.StatusCode).To(Equal(status))
				})
			})
		}

		Context("when authenticated and accessing same team's build", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(true)
				fakeaccess.IsAuthorizedReturns(true)
			})

			WithExistingBuild(ItReturnsTheBuild)
		})

		Context("when authenticated but accessing different team's build", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(true)
				fakeaccess.IsAuthorizedReturns(false)
			})

			WithExistingBuild(func() {
				ItChecksIfJobIsPrivate(http.StatusForbidden)
			})
		})

		Context("when not authenticated", func() {
			BeforeEach(func() {
				fakeaccess.IsAuthenticatedReturns(false)
			})

			WithExistingBuild(func() {
				ItChecksIfJobIsPrivate(http.StatusUnauthorized)
			})
		})
	})
})

type buildDelegateHandler struct {
	IsCalled     bool
	ContextBuild db.BuildForAPI
}

func (handler *buildDelegateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	handler.IsCalled = true
	handler.ContextBuild = r.Context().Value(auth.BuildContextKey).(db.BuildForAPI)
}


text:
using namespace ciri;

GLIndexBuffer::GLIndexBuffer()
	: IIndexBuffer(), _evbo(0), _indexCount(0) {
}

GLIndexBuffer::~GLIndexBuffer() {
	destroy();
}

ErrorCode GLIndexBuffer::set( int* indices, int indexCount, bool dynamic ) {
	if( nullptr == indices || indexCount <= 0 ) {
		return ErrorCode::CIRI_INVALID_ARGUMENT;
	}

	// todo: add remapping (updating) support
	if( _evbo != 0 ) {
		return ErrorCode::CIRI_NOT_IMPLEMENTED;
	}

	_indexCount = indexCount;

	glGenBuffers(1, &_evbo);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _evbo);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int) * indexCount, indices, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

	// todo: check for fail

	return ErrorCode::CIRI_OK;
}

void GLIndexBuffer::destroy() {
	if( _evbo != 0 ) {
		glDeleteBuffers(1, &_evbo);
		_evbo = 0;
	}
}

int GLIndexBuffer::getIndexCount() const {
	return _indexCount;
}

GLuint GLIndexBuffer::getEvbo() const {
	return _evbo;
}


text:
require 'test_helper'

class LoveyotubesControllerTest < ActionController::TestCase
  setup do
    @loveyotube = loveyotubes(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:loveyotubes)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create loveyotube" do
    assert_difference('Loveyotube.count') do
      post :create, loveyotube: { loveword: @loveyotube.loveword }
    end

    assert_redirected_to loveyotube_path(assigns(:loveyotube))
  end

  test "should show loveyotube" do
    get :show, id: @loveyotube
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @loveyotube
    assert_response :success
  end

  test "should update loveyotube" do
    patch :update, id: @loveyotube, loveyotube: { loveword: @loveyotube.loveword }
    assert_redirected_to loveyotube_path(assigns(:loveyotube))
  end

  test "should destroy loveyotube" do
    assert_difference('Loveyotube.count', -1) do
      delete :destroy, id: @loveyotube
    end

    assert_redirected_to loveyotubes_path
  end
end


text:
import import_export as inex
from laminate_properties import *

print('LaminateTools v.0.1.0\n (c) Matthew Cowan 2015 \n Released under the Apache v2 License \n')

fileIn = raw_input('Enter laminate XML file name:\n')
dataIn = inex.fromXML(laminate_file=fileIn)

if (dataIn['type'] == 'continuum'):
	def analysis(lam_in):
		return Laminate3D(lam=lam_in)
elif (dataIn['type'] == 'plate'):
	def analysis(lam_in):
		x = Laminate2D(lam=lam_in)
		try:
			x.getEffectiveProperties()
		except AssertionError:
			print('Laminate not symmetric. Effective properties will not be included.')
		return x
elif (dataIn['type'] == 'beam'):
	def analysis(lam_in):
		return Laminate1D(lam=lam_in)

for lam in dataIn['lams'].keys():
	print('Processing laminate: '+lam)
	#print(str(dataIn['lams'][lam]))
	nameout = lam + '_properties.txt'
	props = analysis(lam_in=dataIn['lams'][lam])
	inex.toText(props, nameout)

print('Analysis Complete')


text:
description: This template deploys an Elasticsearch cluster and Kibana and Logstash VMs. Logstash is configured with an input plugin to pull diagnostics data from existing Azure Storage Tables.
page_type: sample
products:
- azure
- azure-resource-manager
urlFragment: diagnostics-with-elk
languages:
- json
---
# Elasticsearch cluster, Kibana and Logstash for Diagnostics

![Azure Public Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/PublicLastTestDate.svg)
![Azure Public Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/PublicDeployment.svg)

![Azure US Gov Last Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/FairfaxLastTestDate.svg)
![Azure US Gov Last Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/FairfaxDeployment.svg)

![Best Practice Check](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/BestPracticeResult.svg)
![Cred Scan Check](https://azurequickstartsservice.blob.core.windows.net/badges/application-workloads/elk/diagnostics-with-elk/CredScanResult.svg)

[![Deploy To Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fapplication-workloads%2Felk%2Fdiagnostics-with-elk%2Fazuredeploy.json)
[![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fapplication-workloads%2Felk%2Fdiagnostics-with-elk%2Fazuredeploy.json)

This template deploys an Elasticsearch cluster, Logstash and Kibana.
You can specify a custom Logstash configuration using the encodedConfigString parameter.
To create a custom Logstash configuration visit http://codepen.io/skkandia/pen/mPjOdR.
If you don't want to enter a custom Logstash configuration and would like to use the logstash-input-azurewadtable plugin to
input diagnostics data from Azure Table storage, then set the encodedConfigString parameter to 'na' and provide values for the
existingDiagnosticsStorageAccountName, existingDiagnosticsStorageAccountKey and existingDiagnosticsStorageTableNames parameters.

To ensure there are no conflicts deploy to a new resource group.

After the deployment completes you can view the diagnostics data in Kibana. To get the public IP for Kibana, visit the Azure Portal, navigate to the resource group used for the deployment and look for the Public IP address resource named "elasticsearch-kibana-pip". Then point your browser to "http://insert.kibana.ip.here:5601". Under Kibana configure an index pattern with name "wad".

## Notes

- This template uses the Elasticsearch template from: azure-quickstart-templates/elasticsearch/
- It installs the Logstash input plugin for WAD table from: logstash-input-azurewadtable

`Tags: Microsoft.Resources/deployments, Microsoft.Network/networkSecurityGroups, Microsoft.Network/publicIPAddresses, Microsoft.Network/networkInterfaces, Microsoft.Storage/storageAccounts, Microsoft.Compute/virtualMachines, Microsoft.Compute/virtualMachines/extensions, CustomScript`


text:
require_relative "../lib/tty-pager"

ENV["PAGER"]="less"

pager = TTY::Pager.new
pager.page(path: File.join(__dir__, "temp.txt"))


text:
package org.apache.ignite.internal.processors.cache.distributed.near;

import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;

import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;

/**
 * Multi-node tests for partitioned cache.
 */
public class GridCacheAtomicMultiNodeFullApiSelfTest extends GridCachePartitionedMultiNodeFullApiSelfTest {
    /**
     * @return Write order mode for atomic cache.
     */
    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
        return CLOCK;
    }

    /** {@inheritDoc} */
    @Override protected CacheAtomicityMode atomicityMode() {
        return ATOMIC;
    }

    /** {@inheritDoc} */
    @Override protected NearCacheConfiguration nearConfiguration() {
        return null;
    }

    /** {@inheritDoc} */
    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
        CacheConfiguration cc = super.cacheConfiguration(gridName);

        cc.setRebalanceMode(SYNC);
        cc.setBackups(1);
        cc.setAtomicWriteOrderMode(atomicWriteOrderMode());

        return cc;
    }

    /** {@inheritDoc} */
    @Override protected boolean lockingEnabled() {
        return false;
    }

    /** {@inheritDoc} */
    @Override protected boolean txEnabled() {
        return false;
    }
}


text: package github


text:
#include <esp/gpio.h>

void gpio_enable(const uint8_t gpio_num, const gpio_direction_t direction)
{
    uint32_t iomux_flags;

    switch(direction) {
    case GPIO_INPUT:
        iomux_flags = 0;
        break;
    case GPIO_OUTPUT:
        iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
        break;
    case GPIO_OUT_OPEN_DRAIN:
        iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
        break;
    case GPIO_INPUT_PULLUP:
        iomux_flags = IOMUX_PIN_PULLUP;
        break;
    default:
        return; /* Invalid direction flag */
    }
    iomux_set_gpio_function(gpio_num, iomux_flags);
    if(direction == GPIO_OUT_OPEN_DRAIN)
        GPIO.CONF[gpio_num] |= GPIO_CONF_OPEN_DRAIN;
    else
        GPIO.CONF[gpio_num] &= ~GPIO_CONF_OPEN_DRAIN;
    if (iomux_flags & IOMUX_PIN_OUTPUT_ENABLE)
        GPIO.ENABLE_OUT_SET = BIT(gpio_num);
    else
        GPIO.ENABLE_OUT_CLEAR = BIT(gpio_num);
}


text:
// Import the bullshit module
var bs = require('nabg');
// Import the Twitter API module - see https://www.npmjs.com/package/twitter
var Twitter = require('twit');
// Import the Cron module for post scheduling.
var cron = require('cron').CronJob;
// HTTP server module to serve profile page redirect
var http = require('http');

/* NABGBot Configuration:
 *	TWITTER_API_KEYS - Fill this in with the API keys you get from https://apps.twitter.com/
 *  RESPONSE_API_KEYS - You can generate another set of API keys for the response stream, or you can
 *  use the first set of keys, instead. I like to use 2 different sets so that if the response keys hit the quota
 *  and become disabled temporarily, the bot can still post statuses without interruption.
 * 	IP and PORT - These are automatically determined while on Openshift, but will default to 127.0.0.1:8082
 * 	TWITTER_URL - The full URL to your bot's twitter page. Used for the redirect
 *  BOT_NAME: the Twitter username of your bot. This is needed to track replies.
 *	CRON - Posting schedule (standard Cron syntax)
 */
var CONFIG = {
                TWITTER_API_KEYS: {
                           consumer_key: ' ',
                           consumer_secret: ' ',
                           access_token: ' ',
                           access_token_secret: ' '
                },
                RESPONSE_API_KEYS: {
                           consumer_key: ' ',
                           consumer_secret: ' ',
                           access_token: ' ',
                           access_token_secret: ' '
                },
		BOT_NAME: 'changeme',
		IP: process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1",
		PORT: process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || 8082,
		TWITTER_URL: "https://twitter.com/nabgbot",
    CRON: {
        TIME: '00 0,30 * * * *',
        TIMEZONE: 'America/New_York'
    }
};

console.info('NABG_INFO: Starting '+CONFIG.TWITTER_URL+' on '+CONFIG.IP+':'+CONFIG.PORT);

// Create Twitter API client instances
var client = new Twitter(CONFIG.TWITTER_API_KEYS);
var tweetResponses = new Twitter(CONFIG.RESPONSE_API_KEYS);

var responseStream = tweetResponses.stream('statuses/filter', {
    track: '@' + CONFIG.BOT_NAME
});

responseStream.on('tweet', postReply);

responseStream.on('disconnect', function(disconnectMessage) {
    console.info('RESPONSE STREAM DISCONNECT: ' + JSON.stringify(disconnectMessage));
    responseStream.start();
});

// Generates a post that is less than 140 chars long
function generatePost() {
  // Generate post with between 1 or 2 sentences by default.
  var post = bs.ionize(Math.floor(Math.random()*2)+1);

  // Ensure that posts are <= 140 characters and are NOT empty.
  while(post.length > 140 || typeof post === 'undefined' || post.length === 0)
    post = bs.ionize(1);

  return post;
}

function getUsers(tweet) {
    var mentions = '@' + tweet.user.screen_name + ' ';

    for (var i = 0; i < tweet.entities.user_mentions.length; i++)
        if (tweet.entities.user_mentions[i].screen_name != CONFIG.BOT_NAME)
            mentions += '@' + tweet.entities.user_mentions[i].screen_name + ' ';

    return mentions;
}

/* Will attempt to resend tweet until success.
 * Failure here is fairly rare. No worries regarding flooding the API because:
	 a) API rate limiting will kick in, then reset in 15 minutes (see https://dev.twitter.com/rest/public/rate-limiting/)
	 b) Though generatePost occasionally returns an empty string, the twitter API will not accept this and so a new post gets generated anyways ¯\_(ツ)_/¯
	 c) generatePost always returns a valid post in less than 3 attempts at maximum.
 */
function sendPost() {
 client.post('statuses/update', {status: generatePost()}, function(error, tweet, response){
   // Rerun this method on failure (see above).
   if (error)
     console.error('NABG_DEBUG: '+CONFIG.TWITTER_URL+' Twitter returned an error: '+JSON.stringify(response));
 });
}

function postReply(tweet) {
    try {
        //Never reply to self.
        if (tweet.user.screen_name == CONFIG.BOT_NAME)
            return;

	var mentions = getUsers(tweet);
        var tweetContent = mentions + generatePost();
	var numTries = 30;  // Max # of generation attempts

        while (tweetContent.length > 140 && numTries > 0) {
            tweetContent = mentions + generatePost();
            numTries--;
        }

	if(numTries <= 0)
		tweetContent = mentions + ", open your heart to spiritualism";

        var params = {
            status: tweetContent,
            in_reply_to_status_id: tweet.id_str
        };

        tweetResponses.post('statuses/update', params, function(err, data, response) {
            if (err)
                console.info('NABGBOT_DEBUG: ' + JSON.stringify(err));
        });
    } catch (e) {
        console.info('NABGBOT_DEBUG: ' + CONFIG.TWITTER_URL + ' Caught ' + e.name + ': ' + e.message);
    }
}

// Make Twitter API calls at a configurable interval, with graceful error handling and logging
var sched = new cron({
    cronTime: CONFIG.CRON.TIME,
    onTick: function() {
      try {
        sendPost();
      } catch(err) {
        console.error('NABG_DEBUG: '+CONFIG.TWITTER_URL+' Caught '+err.name+': '+err.message);
      }
    },
    start: false,
    timeZone: CONFIG.CRON.TIMEZONE
});

sched.start();
sendPost();

// HTTP requests made to the application's external URL will redirect to the bot's twitter profile.
http.createServer(function(req, res) {
    res.writeHead(301, {Location: CONFIG.TWITTER_URL});
    res.end();
}).listen(CONFIG.PORT, CONFIG.IP);


text:
// A front-end component to provide meaningful feedback when users verify their accounts using /api/user/verify/:code
/* global fluid, jQuery */
(function ($) {
    "use strict";
    var gpii = fluid.registerNamespace("gpii");
    fluid.registerNamespace("gpii.express.couchuser.frontend.verify");

    // Try to log in and display the results
    gpii.express.couchuser.frontend.verify.submit = function (that, event) {
        if (event) { event.preventDefault(); }

        if (!that.model || !that.model.code) {
            that.displayError(null, null, "
Cannot continue without a verification code.  Please check your email for a verification link or contact a system administrator for assistance.
");
            return;
        }
        else {
            var settings = {
                type:    "GET",
                url:     that.options.apiUrl + "/verify/" + that.model.code,
                success: that.displayReceipt,
                error:   that.displayError
            };

            $.ajax(settings);
        }
    };

    // TODO: move this to a general module type that everyone inherits from
    gpii.express.couchuser.frontend.verify.displayError = function (that, jqXHR, textStatus, errorThrown) {
        var message = errorThrown;
        try {
            var jsonData = JSON.parse(jqXHR.responseText);
            if (jsonData.message) { message = jsonData.message; }
        }
        catch (e) {
            console.log("jQuery.ajax call returned meaningless jqXHR.responseText payload. Using 'errorThrown' instead.");
        }

        that.templates.html(that.locate("message"), that.options.templates.error, { message: message });
    };

    gpii.express.couchuser.frontend.verify.displayReceipt = function (that, responseData) {
        var jsonData = JSON.parse(responseData);
        if (jsonData && jsonData.ok) {
            that.applier.change("user", jsonData.user);

            that.templates.html(that.locate("message"), that.options.templates.success, { message: "You have successfully verified your account." });
        }
        else {
            that.templates.html(that.locate("message"), that.options.templates.error, { message: jsonData.message });
        }
    };

    // We have to do this because templates need to be loaded before we initialize our own code.
    gpii.express.couchuser.frontend.verify.init = function (that) {
        that.templates.loadTemplates();
    };

    fluid.defaults("gpii.express.couchuser.frontend.verify", {
        gradeNames: ["fluid.viewRelayComponent", "autoInit"],
        model: {
            code: null
        },
        templates: {
            success: "common-success",
            error:   "common-error"
        },
        components: {
            templates: {
                "type": "gpii.templates.hb.client"
            }
        },
        apiUrl: "/api/user",
        selectors: {
            "viewport": ".verify-viewport",
            "message":  ".verify-message"
        },
        events: {
            "submit":       "preventable",
            "markupLoaded": "preventable"
        },
        invokers: {
            "submit": {
                funcName: "gpii.express.couchuser.frontend.verify.submit",
                args: [ "{that}", "{arguments}.0"]
            },
            "displayError": {
                funcName: "gpii.express.couchuser.frontend.verify.displayError",
                args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"]
            },
            "displayReceipt": {
                funcName: "gpii.express.couchuser.frontend.verify.displayReceipt",
                args: ["{that}", "{arguments}.0", "{arguments}.1", "{arguments}.2"]
            },
            "init": {
                funcName: "{templates}.loadTemplates"
            }
        },
        listeners: {
            onCreate: {
                "funcName": "gpii.express.couchuser.frontend.verify.init",
                "args":     "{that}"
            },
            "{templates}.events.templatesLoaded": {
                "funcName": "gpii.express.couchuser.frontend.verify.submit",
                "args":     "{that}"
            }
        }
    });
})(jQuery);


text:
Stops corectld

### Synopsis

Stops corectld

```
corectld stop [flags]
```

### Options

```
  -h, --help   help for stop
```

### Options inherited from parent commands

```
  -d, --debug   adds additional verbosity, and options, directed at debugging purposes and power users
```

### SEE ALSO
* [corectld](corectld.md)	 - CoreOS over macOS made simple.


text:
EESec hacks
===========

A collection of simple `NodeJS` based services to communicate with an `EESec` via `iOS Siri`.

Requirements
============

* an `EESec` within the local LAN
* an `iOS` device with `Siri` support
* `iCloud` enabled for `Notes` so that new `Notes` created via `Siri` get automatically synced with `iCloud`
* in order to receive `push notifications` on your `iOS` device(s) you need to install the `prowl` app and generate a `prowl API key`.

Setup
=====

* create a file `config_siri.js` with your `iCloud` credentials and if available your `prowl API key`; see [here](../../blob/master/eesec-siri.es6.js#L9-L23) for a description about the file structure.
* create a file `config_eesec.js` with your `EESec` credentials; see [here](../../blob/master/eesec-siri.es6.js#L26-L31) for a description about the file structure.
* install the `babel` `npm` module globally: `npm install -g babel`
* install all other missing `npm` modules: `npm install`
* start the service: `DEBUG="eesec:*" babel-node eesec-hacks.es6.js`

Usage
=====

Supported `Siri` commands (in German):

* `Neue Notiz Alarmanlage aus`
* `Neue Notiz Alarmanlage an`
* `Neue Notiz Alarmanlage home`
* `Neue Notiz Alarmanlage status` => delivers current status via `prowl` to your iOS device(s)
* `Neue Notiz Wer ist an der Tür` => requests a new image from the camera and delivers it via `prowl`

And every `EESec mode` change and new `EESec image` will be automatically reported via a `prowl` push notification within a timeframe of 15 seconds.

Misc
====

The basic idea about the `Siri` control mechanism via the `iCloud` synced `Notes` is coming from [HcDevel/SiriAPI8](https://github.com/HcDevel/SiriAPI8).


text:
CREATE OR REPLACE VIEW almacen.vwsalidas AS
 SELECT sds.id,
    sds.folio,
    sds.fecha,
    sds.tipoentradaid,
    sds.ejercicioid,
    sds.nombrequienrecibe,
    sds.programaid,
    pgs.clave AS programaclave,
    pgs.nombre AS programanombre,
    sds.activo
   FROM almacen.salidas sds
     JOIN almacen.programas pgs ON sds.programaid = pgs.id
  ORDER BY sds.id, sds.folio DESC;

ALTER TABLE almacen.vwsalidas
  OWNER TO almacen;


text:
import pickle
import xmlrpclib
import pprint
client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')

with open('python2only','r') as f:

    py2onlylist = pickle.load(f)

#print len(py2onlylist)
py2onlylist = list(py2onlylist)

py2gitlist =[]

#print py2onlylist[0]

for i in py2onlylist:
    rel = client.package_releases(i)
    if rel:
        link = client.release_data(i,rel[0])["home_page"]
        if "github" in link:
            py2gitlist.append(link)
            print link

with open('python2gitlist','w') as f:
    pickle.dump(py2gitlist,f)


text:
using Xunit;

[Collection(nameof(PubsubFixture))]
public class CreateProtoSchemaTest
{
    private readonly PubsubFixture _pubsubFixture;
    private readonly CreateProtoSchemaSample _createProtoSchemaSample;

    public CreateProtoSchemaTest(PubsubFixture pubsubFixture)
    {
        _pubsubFixture = pubsubFixture;
        _createProtoSchemaSample = new CreateProtoSchemaSample();
    }

    [Fact]
    public void CreateProtoSchema()
    {
        string schemaId = "testProtoSchemaForSchemaCreation" + _pubsubFixture.RandomName();
        var newlyCreatedSchema = _createProtoSchemaSample.CreateProtoSchema(_pubsubFixture.ProjectId, schemaId, _pubsubFixture.ProtoSchemaFile);
        _pubsubFixture.TempSchemaIds.Add(schemaId);
        var schema = _pubsubFixture.GetSchema(schemaId);
        Assert.Equal(newlyCreatedSchema, schema);
    }
}


text:
 Edit City/Area

                        <?php foreach($edit as $res){ }?>
                        <form class="" method="post" action="<?php echo base_url();?>city/update_city" id="cityform" name="cityform" onSubmit='return check();'>

                              Country *

                                 <select class="form-control" name="countryid"  onchange="getstatename(this.value)">
                                     <option value="">Select Country </option>
                                     <?php foreach($countyr_list as $cntry){ ?>
                                                <option value="<?php echo $cntry->id; ?>"><?php echo $cntry->country_name; ?></option>
                                     <?php } ?>
                                 </select>

                              State *

                                 <select class="form-control" name="newstateid" id="staname">
                                  <?php foreach($edit as $res){ ?>
                                     <option value="<?php echo $res->staid; ?>"><?php echo $res->state_name; ?></option>
                                     <?php } ?>
                                 </select>

                              City/Area *

                                 <input class="form-control" type="text"  name="cityname" id="city_id" value="<?php echo $res->city_name; ?>" id="example-text-input" maxlength="50">
                                  <input class="form-control" type="hidden"  name="cityid" value="<?php echo $res->id; ?>" id="example-text-input" >

                            City/Area Latitude *

                                <input class="form-control" type="text" name="txtLatitude"  id="latu" value="<?php echo $res->city_latitude; ?>" maxlength="30">

                              City/Area Longitude *

                                <input class="form-control" type="text" name="txtLongitude" id="lon" value="<?php echo $res->city_longitude; ?>" maxlength="30">

                              Status *

                                 <select class="form-control"  name="eventsts">
                                    <option value="Y">Active</option>
                                    <option value="N">Inactive</option>
                                 </select>

                              <button type="submit" id="save" class="btn btn-success waves-effect waves-light">
                              Save </button>

                     </form>


text:
using System.Collections.ObjectModel;
using System.Diagnostics;
using Microsoft.VisualStudio.Debugger.Clr;
using Microsoft.VisualStudio.Debugger.Evaluation;
using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;
using Microsoft.VisualStudio.Debugger.Metadata;
using Type = Microsoft.VisualStudio.Debugger.Metadata.Type;

namespace Microsoft.CodeAnalysis.ExpressionEvaluator
{
    internal sealed class ResultsViewExpansion : Expansion
    {
        private const string ResultsFormatSpecifier = "results";

        internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspectionContext, DkmClrValue value, Formatter formatter)
        {
            var enumerableType = GetEnumerableType(value);
            if (enumerableType == null)
            {
                return null;
            }
            return CreateExpansion(inspectionContext, value, enumerableType, formatter);
        }

        internal static EvalResultDataItem CreateResultsOnlyRow(
            DkmInspectionContext inspectionContext,
            string name,
            DkmClrType declaredType,
            DkmClrCustomTypeInfo declaredTypeInfo,
            DkmClrValue value,
            Formatter formatter)
        {
            string errorMessage;
            if (value.IsError())
            {
                errorMessage = (string)value.HostObjectValue;
            }
            else if (value.HasExceptionThrown())
            {
                errorMessage = value.GetExceptionMessage(name, formatter);
            }
            else
            {
                var enumerableType = GetEnumerableType(value);
                if (enumerableType != null)
                {
                    var expansion = CreateExpansion(inspectionContext, value, enumerableType, formatter);
                    if (expansion != null)
                    {
                        return expansion.CreateResultsViewRow(
                            inspectionContext,
                            name,
                            new TypeAndCustomInfo(declaredType.GetLmrType(), declaredTypeInfo),
                            value,
                            includeResultsFormatSpecifier: true,
                            formatter: formatter);
                    }
                    errorMessage = Resources.ResultsViewNoSystemCore;
                }
                else
                {
                    errorMessage = Resources.ResultsViewNotEnumerable;
                }
            }

            Debug.Assert(errorMessage != null);
            return new EvalResultDataItem(name, errorMessage);
        }

        /// <summary>
        /// Generate a Results Only row if the value is a synthesized
        /// value declared as IEnumerable or IEnumerable<T>.
        /// </summary>
        internal static EvalResultDataItem CreateResultsOnlyRowIfSynthesizedEnumerable(
            DkmInspectionContext inspectionContext,
            string name,
            DkmClrType declaredType,
            DkmClrCustomTypeInfo declaredTypeInfo,
            DkmClrValue value,
            Formatter formatter)
        {
            if ((value.ValueFlags & DkmClrValueFlags.Synthetic) == 0)
            {
                return null;
            }

            // Must be declared as IEnumerable or IEnumerable<T>, not a derived type.
            var enumerableType = GetEnumerableType(value, declaredType, requireExactInterface: true);
            if (enumerableType == null)
            {
                return null;
            }

            var expansion = CreateExpansion(inspectionContext, value, enumerableType, formatter);
            if (expansion == null)
            {
                return null;
            }

            return expansion.CreateResultsViewRow(
                inspectionContext,
                name,
                new TypeAndCustomInfo(declaredType.GetLmrType(), declaredTypeInfo),
                value,
                includeResultsFormatSpecifier: false,
                formatter: formatter);
        }

        private static DkmClrType GetEnumerableType(DkmClrValue value)
        {
            return GetEnumerableType(value, value.Type, requireExactInterface: false);
        }

        private static bool IsEnumerableCandidate(DkmClrValue value)
        {
            Debug.Assert(!value.IsError());

            if (value.IsNull || value.HasExceptionThrown())
            {
                return false;
            }

            // Do not support Results View for strings
            // or arrays. (Matches legacy EE.)
            var type = value.Type.GetLmrType();
            return !type.IsString() && !type.IsArray;
        }

        private static DkmClrType GetEnumerableType(DkmClrValue value, DkmClrType valueType, bool requireExactInterface)
        {
            if (!IsEnumerableCandidate(value))
            {
                return null;
            }

            var type = valueType.GetLmrType();
            Type enumerableType;
            if (requireExactInterface)
            {
                if (!type.IsIEnumerable() && !type.IsIEnumerableOfT())
                {
                    return null;
                }
                enumerableType = type;
            }
            else
            {
                enumerableType = type.GetIEnumerableImplementationIfAny();
                if (enumerableType == null)
                {
                    return null;
                }
            }

            return DkmClrType.Create(valueType.AppDomain, enumerableType);
        }

        private static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType enumerableType, Formatter formatter)
        {
            var proxyValue = value.InstantiateResultsViewProxy(inspectionContext, enumerableType);
            // InstantiateResultsViewProxy may return null (if required assembly is missing, for instance).
            if (proxyValue == null)
            {
                return null;
            }

            var proxyMembers = MemberExpansion.CreateExpansion(
                inspectionContext,
                new TypeAndCustomInfo(proxyValue.Type),
                proxyValue,
                flags: ExpansionFlags.None,
                predicate: TypeHelpers.IsPublic,
                formatter: formatter);
            return new ResultsViewExpansion(proxyValue, proxyMembers);
        }

        private readonly DkmClrValue _proxyValue;
        private readonly Expansion _proxyMembers;

        private ResultsViewExpansion(DkmClrValue proxyValue, Expansion proxyMembers)
        {
            Debug.Assert(proxyValue != null);
            Debug.Assert(proxyMembers != null);

            _proxyValue = proxyValue;
            _proxyMembers = proxyMembers;
        }

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResultDataItem> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            if (InRange(startIndex, count, index))
            {
                rows.Add(CreateResultsViewRow(inspectionContext, parent, resultProvider.Formatter));
            }

            index++;
        }

        private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, EvalResultDataItem parent, Formatter formatter)
        {
            Debug.Assert(parent != null);
            var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
            var fullName = parent.ChildFullNamePrefix;
            bool unused;
            var childFullNamePrefix = (fullName == null) ?
                null :
                formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out unused), fullName);
            return new EvalResultDataItem(
                ExpansionKind.ResultsView,
                Resources.ResultsView,
                typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                declaredTypeAndInfo: proxyTypeAndInfo,
                parent: null,
                value: _proxyValue,
                displayValue: Resources.ResultsViewValueWarning,
                expansion: _proxyMembers,
                childShouldParenthesize: false,
                fullName: fullName,
                childFullNamePrefixOpt: childFullNamePrefix,
                formatSpecifiers: Formatter.AddFormatSpecifier(parent.FormatSpecifiers, ResultsFormatSpecifier),
                category: DkmEvaluationResultCategory.Method,
                flags: DkmEvaluationResultFlags.ReadOnly,
                editableValue: null,
                inspectionContext: inspectionContext);
        }

        private EvalResultDataItem CreateResultsViewRow(
            DkmInspectionContext inspectionContext,
            string name,
            TypeAndCustomInfo declaredTypeAndInfo,
            DkmClrValue value,
            bool includeResultsFormatSpecifier,
            Formatter formatter)
        {
            var proxyTypeAndInfo = new TypeAndCustomInfo(_proxyValue.Type);
            ReadOnlyCollection<string> formatSpecifiers;
            var fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);
            if (includeResultsFormatSpecifier)
            {
                formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, ResultsFormatSpecifier);
            }
            bool unused;
            var childFullNamePrefix = formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out unused), fullName);
            return new EvalResultDataItem(
                ExpansionKind.Default,
                name,
                typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                declaredTypeAndInfo: declaredTypeAndInfo,
                parent: null,
                value: value,
                displayValue: null,
                expansion: new IndirectExpansion(_proxyValue, _proxyMembers),
                childShouldParenthesize: false,
                fullName: fullName,
                childFullNamePrefixOpt: childFullNamePrefix,
                formatSpecifiers: formatSpecifiers,
                category: DkmEvaluationResultCategory.Method,
                flags: DkmEvaluationResultFlags.ReadOnly,
                editableValue: null,
                inspectionContext: inspectionContext);
        }

        private sealed class IndirectExpansion : Expansion
        {
            private readonly DkmClrValue _proxyValue;
            private readonly Expansion _expansion;

            internal IndirectExpansion(DkmClrValue proxyValue, Expansion expansion)
            {
                _proxyValue = proxyValue;
                _expansion = expansion;
            }

            internal override void GetRows(
                ResultProvider resultProvider,
                ArrayBuilder<EvalResultDataItem> rows,
                DkmInspectionContext inspectionContext,
                EvalResultDataItem parent,
                DkmClrValue value,
                int startIndex,
                int count,
                bool visitAll,
                ref int index)
            {
                _expansion.GetRows(
                    resultProvider,
                    rows,
                    inspectionContext,
                    parent,
                    _proxyValue,
                    startIndex: startIndex,
                    count: count,
                    visitAll: visitAll,
                    index: ref index);
            }
        }
    }
}