text:
package renesca.schema.macros

trait Generators extends Context with Patterns with Parameters {
  import Helpers._
  import context.universe._

  trait Named {
    def pattern: NamePattern
    def name = pattern.name

    def name_type = TypeName(name)
    def name_term = TermName(name)
    def name_label = nameToLabel(name)
    def name_plural = nameToPlural(name)
    def name_plural_term = TermName(name_plural)
  }

  trait SuperTypes {
    def pattern: SuperTypesPattern
    def externalSuperTypes: List[String]
    def externalSuperTypes_type = externalSuperTypes.map(TypeName(_))

    //TODO: should filter external super types here.
    //currently the pattern is copied before instantiating this. Because some
    //functions in this file rely on pattern.superTypes to be correct.
    def superTypes = pattern.superTypes
    def superTypes_type = superTypes.map(TypeName(_))
  }

  trait StartEndNode {
    def pattern: StartEndNodePattern
    def startNode = pattern.startNode
    def endNode = pattern.endNode

    def startNode_type = TypeName(startNode)
    def startNode_term = TermName(startNode)
    def endNode_type = TypeName(endNode)
    def endNode_term = TermName(endNode)
  }

  trait StartEndRelation extends StartEndNode with Named {
    def pattern: StartEndNodePattern with NamePattern

    def startRelation = hyperStartRelationName(name)
    def startRelation_type = TypeName(startRelation)
    def startRelation_term = TermName(startRelation)
    def startRelation_label = nameToLabel(startRelation)
    def endRelation = hyperEndRelationName(name)
    def endRelation_type = TypeName(endRelation)
    def endRelation_term = TermName(endRelation)
    def endRelation_label = nameToLabel(endRelation)
  }

  trait HasOwnFactory {
    val hasOwnFactory: Option[Boolean]
    val parameterList: ParameterList
  }

  trait Statements {
    def pattern: StatementsPattern
    def statements = pattern.statements
  }

  trait HasParameterList {
    val parameterList: ParameterList
  }

  trait HasTraitFactoryParameterList {
    def traitFactoryParameterList: List[ParameterList]
  }

  object Schema {
    def apply(schemaPattern: SchemaPattern): Schema = {
      import schemaPattern._
      //TODO: dry collect
      val nodePatterns: List[NodePattern] = schemaPattern.statements.collect { case NodePattern(node) => node }
      val relationPatterns: List[RelationPattern] = schemaPattern.statements.collect { case RelationPattern(relationPattern) => relationPattern }
      val hyperRelationPatterns: List[HyperRelationPattern] = schemaPattern.statements.collect { case HyperRelationPattern(hyperRelationPattern) => hyperRelationPattern }
      val nodeTraitPatterns: List[NodeTraitPattern] = schemaPattern.statements.collect { case NodeTraitPattern(nodeTraitpattern) => nodeTraitpattern }
      val relationTraitPatterns: List[RelationTraitPattern] = schemaPattern.statements.collect { case RelationTraitPattern(nodeTraitpattern) => nodeTraitpattern }
      val graphPatterns: List[GraphPattern] = schemaPattern.statements.collect { case GraphPattern(graphPattern) => graphPattern }
      val allRelationPatterns = relationPatterns ::: hyperRelationPatterns

      def abortIfInheritsFrom(childItem: String, childType: String, child: NamePattern with SuperTypesPattern, parentItem: String, parentType: String, parents: List[NamePattern]): Unit = {
        for(childSuperTypeName <- child.superTypes; parentName <- parents.map(_.name) if childSuperTypeName == parentName)
          abort(s"$childItem $childType `${ child.name }` cannot inherit from $parentItem $parentType `$parentName`.")
      }

      val nodeTraits = nodeTraitPatterns.map { rawNodeTraitPattern =>
        abortIfInheritsFrom("Node", "trait", rawNodeTraitPattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("Node", "trait", rawNodeTraitPattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("Node", "trait", rawNodeTraitPattern, "Relation", "trait", relationTraitPatterns)
        abortIfInheritsFrom("Node", "trait", rawNodeTraitPattern, "Graph", "trait", graphPatterns)

        NodeTrait(rawNodeTraitPattern, nodeTraitPatterns, relationTraitPatterns, nodePatterns, hyperRelationPatterns, relationPatterns, hyperRelationPatterns)
      }

      nodeTraits.foreach { nodeTrait =>
        nodeTrait.traitFactoryParameterList = findSuperFactoryParameterList(nodeTraitPatterns, nodeTrait.pattern, nodeTraits)
      }

      val relationTraits = relationTraitPatterns.map { rawRelationTraitPattern =>
        abortIfInheritsFrom("Relation", "trait", rawRelationTraitPattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("Relation", "trait", rawRelationTraitPattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("Relation", "trait", rawRelationTraitPattern, "Node", "trait", nodeTraitPatterns)
        abortIfInheritsFrom("Relation", "trait", rawRelationTraitPattern, "Graph", "trait", graphPatterns)

        val externalSuperTypes = rawRelationTraitPattern.superTypes diff relationTraitPatterns.map(_.name)
        val relationTraitPattern = rawRelationTraitPattern.copy(_superTypes = rawRelationTraitPattern.superTypes diff externalSuperTypes)
        RelationTrait(relationTraitPattern,
          externalSuperTypes = externalSuperTypes,
          flatSuperStatements(relationTraitPatterns, relationTraitPattern),
          traitCanHaveOwnFactory(allRelationPatterns ::: relationTraitPatterns, rawRelationTraitPattern))
      }

      // create special nodepatterns for creating matches class for nodetraits
      val (traitImplementationPattern, traitImplementationMap) = {
        val (pattern, mapping) = nodeTraits.map(nodeTrait => {
          import nodeTrait._
          val implName = traitMatchesClassName(name)
          (NodePattern(implName, List(name), List.empty), implName -> nodeTrait)
        }).unzip

        (pattern, mapping.toMap)
      }

      val nodes = (traitImplementationPattern ++ nodePatterns).map { rawNodePattern =>
        abortIfInheritsFrom("Node", "class", rawNodePattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("Node", "class", rawNodePattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("Node", "class", rawNodePattern, "Relation", "trait", relationTraitPatterns)
        abortIfInheritsFrom("Node", "class", rawNodePattern, "Graph", "trait", graphPatterns)

        val externalSuperTypes = rawNodePattern.superTypes diff nodeTraitPatterns.map(_.name)
        val nodePattern = rawNodePattern.copy(_superTypes = rawNodePattern.superTypes diff externalSuperTypes)
        Node(nodePattern,
          flatSuperTypesWithSelf = patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodePattern).map(_.name) intersect (nodePattern.name :: nodeTraits.map(_.name)),
          externalSuperTypes = externalSuperTypes,
          neighbours = neighbours(nodePattern, allRelationPatterns, nodePatterns, nodeTraitPatterns),
          rev_neighbours = rev_neighbours(nodePattern, allRelationPatterns, nodePatterns, nodeTraitPatterns),
          outRelationsToTrait = allRelationPatterns.filter { r =>
            (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodePattern).map(_.name) contains r.startNode) &&
              (nodeTraitPatterns.map(_.name) contains r.endNode)
          }.map(r => (r.name, r.endNode)),
          inRelationsFromTrait = allRelationPatterns.filter { r =>
            // endNode is this node or one of its supertypes
            // and startNode is a Node Trait
            (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodePattern).map(_.name) contains r.endNode) &&
              (nodeTraitPatterns.map(_.name) contains r.startNode)
          }.map(r => (r.name, r.startNode)),
          flatStatements = flatSuperStatements(nodeTraitPatterns, nodePattern),
          traitFactoryParameterList = findSuperFactoryParameterList(nodeTraitPatterns, nodePattern, nodeTraits),
          implementedTrait = traitImplementationMap.get(nodePattern.name))
      }

      val wholeGraph = GraphPattern("Whole" + schemaPattern.name, Nil, nodePatterns.map(_.name) ::: nodeTraitPatterns.map(_.name))

      val graphs = (wholeGraph :: graphPatterns).map { graphPattern =>
        abortIfInheritsFrom("Graph", "trait", graphPattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("Graph", "trait", graphPattern, "Node", "trait", nodeTraitPatterns)
        abortIfInheritsFrom("Graph", "trait", graphPattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("Graph", "trait", graphPattern, "Relation", "trait", relationTraitPatterns)
        // We do not allow HyperRelations to be explicitly added to the Graph.
        // They should always be implied by their start/end nodes.
        val notAllowed = graphPattern.nodes.distinct diff (nodePatterns ++ nodeTraitPatterns).map(_.name)
        if(notAllowed.nonEmpty) abort(s"Graph `${ graphPattern.name }` cannot contain ${ notAllowed.mkString("`", "`, `", "`") }. Only Node classes and traits are allowed.")

        // explicit Nodes: Nodes, NodeTraits but no HyperRelations
        val explicitNodes = graphToNodes(graphPatterns, graphPattern).distinct
        val traits = explicitNodes intersect nodeTraits.map(_.name)
        val expandedTraits = traits.flatMap(t => patternToFlatSubTypesWithoutSelf(nodeTraitPatterns ::: nodePatterns, nameToPattern(nodeTraitPatterns, t))).map(_.name)
        val nodes = (explicitNodes ++ expandedTraits).distinct diff nodeTraits.map(_.name)
        val connectedHyperRelations = inducedRelations(nodes, nodePatterns ::: hyperRelationPatterns, nodeTraitPatterns, hyperRelationPatterns, hyperRelationPatterns)
        val nodesWithHyperRelations = nodes ++ connectedHyperRelations
        val graphedNodePatterns = nodesWithHyperRelations.map(nameToPattern(nodePatterns ::: hyperRelationPatterns, _))
        val graphedTraits = graphedNodePatterns.flatMap(patternToFlatSuperTypesWithoutSelf(nodeTraitPatterns, _)).distinct

        Graph(graphPattern,
          nodes = nodes.map(nameToPattern(nodePatterns, _)).collect { case n: NamePattern => n.name },
          nodesWithHyperRelations = nodesWithHyperRelations,
          relations = inducedRelations(nodesWithHyperRelations, nodePatterns ::: hyperRelationPatterns, nodeTraitPatterns, hyperRelationPatterns, relationPatterns),
          relationsWithHyperRelations = inducedRelations(nodesWithHyperRelations, nodePatterns ::: hyperRelationPatterns, nodeTraitPatterns, hyperRelationPatterns, allRelationPatterns),
          hyperRelations = connectedHyperRelations,
          nodeTraits = graphedTraits.map(nodeTraitPattern => {
            NodeTrait(nodeTraitPattern, nodeTraitPatterns, relationTraitPatterns,
              nodesWithHyperRelations.filter((nodePatterns ::: hyperRelationPatterns).map(_.name).toSet).distinct.map(nameToPattern(nodePatterns ::: hyperRelationPatterns, _)), //TODO: use intersect?
              connectedHyperRelations.filter(hyperRelationPatterns.map(_.name).toSet).distinct.map(nameToPattern(hyperRelationPatterns, _)),
              relationPatterns,
              hyperRelationPatterns)
          })
        )
      }

      val hyperRelations = hyperRelationPatterns.map { rawHyperRelationPattern =>
        abortIfInheritsFrom("HyperRelation", "class", rawHyperRelationPattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("HyperRelation", "class", rawHyperRelationPattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("HyperRelation", "class", rawHyperRelationPattern, "Graph", "trait", graphPatterns)
        if(graphPatterns.map(_.name) contains rawHyperRelationPattern.startNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs startNode `${ rawHyperRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Graph.")
        if(relationPatterns.map(_.name) contains rawHyperRelationPattern.startNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs startNode `${ rawHyperRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Relation.")
        if(relationTraitPatterns.map(_.name) contains rawHyperRelationPattern.startNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs startNode `${ rawHyperRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Relation trait.")
        if(graphPatterns.map(_.name) contains rawHyperRelationPattern.endNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs endNode `${ rawHyperRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Graph.")
        if(relationPatterns.map(_.name) contains rawHyperRelationPattern.endNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs endNode `${ rawHyperRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Relation.")
        if(relationTraitPatterns.map(_.name) contains rawHyperRelationPattern.endNode) abort(s"HyperRelation class `${ rawHyperRelationPattern.name }` needs endNode `${ rawHyperRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Relation trait.")

        val externalSuperTypes = rawHyperRelationPattern.superTypes diff (nodeTraitPatterns.map(_.name) ++ relationTraitPatterns.map(_.name))
        val hyperRelationPattern = rawHyperRelationPattern.copy(_superTypes = rawHyperRelationPattern.superTypes diff externalSuperTypes)
        HyperRelation(
          pattern = hyperRelationPattern,
          superNodeTypes = filterSuperTypes(nodeTraitPatterns, hyperRelationPattern),
          flatSuperNodeTypesWithSelf = patternToFlatSuperTypesWithSelf(nodeTraitPatterns, hyperRelationPattern).map(_.name) intersect (hyperRelationPattern.name :: nodeTraits.map(_.name)),
          externalSuperTypes = externalSuperTypes,
          superRelationTypes = filterSuperTypes(relationTraitPatterns, hyperRelationPattern),
          neighbours = neighbours(hyperRelationPattern, allRelationPatterns, nodePatterns, nodeTraitPatterns),
          rev_neighbours = rev_neighbours(hyperRelationPattern, allRelationPatterns, nodePatterns, nodeTraitPatterns),
          outRelationsToTrait = allRelationPatterns.filter { r =>
            (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, hyperRelationPattern).map(_.name) contains r.startNode) &&
              (nodeTraitPatterns.map(_.name) contains r.endNode)
          }.map(r => (r.name, r.endNode)),
          inRelationsFromTrait = allRelationPatterns.filter { r =>
            // endNode is this node or one of its supertypes
            // and startNode is a Node Trait
            (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, hyperRelationPattern).map(_.name) contains r.endNode) &&
              (nodeTraitPatterns.map(_.name) contains r.startNode)
          }.map(r => (r.name, r.startNode)),
          flatSuperStatements = flatSuperStatements(nodeTraitPatterns ::: relationTraitPatterns, hyperRelationPattern),
          traitFactoryParameterList = findSuperFactoryParameterList(nodeTraitPatterns ::: relationTraitPatterns, hyperRelationPattern, nodeTraits ::: relationTraits))
      }

      val relations = relationPatterns.map { rawRelationPattern =>
        abortIfInheritsFrom("Relation", "class", rawRelationPattern, "Relation", "class", relationPatterns)
        abortIfInheritsFrom("Relation", "class", rawRelationPattern, "Node", "class", nodePatterns)
        abortIfInheritsFrom("Relation", "class", rawRelationPattern, "Node", "trait", nodeTraitPatterns)
        abortIfInheritsFrom("Relation", "class", rawRelationPattern, "Graph", "trait", graphPatterns)
        if(graphPatterns.map(_.name) contains rawRelationPattern.startNode) abort(s"Relation class `${ rawRelationPattern.name }` needs startNode `${ rawRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Graph.")
        if(relationPatterns.map(_.name) contains rawRelationPattern.startNode) abort(s"Relation class `${ rawRelationPattern.name }` needs startNode `${ rawRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Relation.")
        if(relationTraitPatterns.map(_.name) contains rawRelationPattern.startNode) abort(s"Relation class `${ rawRelationPattern.name }` needs startNode `${ rawRelationPattern.startNode }` to be a Node, Node trait, or HyperRelation. Not a Relation trait.")
        if(graphPatterns.map(_.name) contains rawRelationPattern.endNode) abort(s"Relation class `${ rawRelationPattern.name }` needs endNode `${ rawRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Graph.")
        if(relationPatterns.map(_.name) contains rawRelationPattern.endNode) abort(s"Relation class `${ rawRelationPattern.name }` needs endNode `${ rawRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Relation.")
        if(relationTraitPatterns.map(_.name) contains rawRelationPattern.endNode) abort(s"Relation class `${ rawRelationPattern.name }` needs endNode `${ rawRelationPattern.endNode }` to be a Node, Node trait, or HyperRelation. Not a Relation trait.")

        val externalSuperTypes = rawRelationPattern.superTypes diff relationTraitPatterns.map(_.name)
        val relationPattern = rawRelationPattern.copy(_superTypes = rawRelationPattern.superTypes diff externalSuperTypes)
        Relation(
          pattern = relationPattern,
          externalSuperTypes = externalSuperTypes,
          flatStatements = flatSuperStatements(relationTraitPatterns, relationPattern),
          traitFactoryParameterList = findSuperFactoryParameterList(relationTraitPatterns, relationPattern, relationTraits))
      }

      Schema(schemaPattern, nodes, relations, hyperRelations, nodeTraits, relationTraits, graphs, statements)
    }

    def findSuperFactoryParameterList[P <: NamePattern with SuperTypesPattern, Q <: Named with HasOwnFactory](patterns: List[_ <: P], pattern: P, nameClasses: List[Q]): List[ParameterList] = {
      patternToNameClasses(patternToFlatSuperTypesWithoutSelf(patterns, pattern), nameClasses).map(_.parameterList)
    }

    def patternToNameClasses[P <: Named with HasOwnFactory](patterns: List[_ <: NamePattern], nameClasses: List[P]): List[P] = nameClasses.filter(nameClass => patterns.map(_.name).contains(nameClass.name))

    def filterSuperTypes(patterns: List[_ <: NamePattern], pattern: SuperTypesPattern): List[String] = {
      pattern.superTypes intersect patterns.map(_.name)
    }

    def flatSuperStatements[P <: NamePattern with SuperTypesPattern with StatementsPattern](superTypePatterns: List[NamePattern with SuperTypesPattern with StatementsPattern], pattern: P): List[Tree] = {
      val superTypes: List[StatementsPattern with NamePattern with SuperTypesPattern] = pattern.superTypes.map(superType => nameToPattern(superTypePatterns, superType))
      val flatSuperTypes: List[StatementsPattern] = patternToFlatSuperTypesWithSelf(superTypePatterns, pattern)
      flatSuperTypes.flatMap(_.statements)
    }

    def nameToPattern[NP <: NamePattern, P <: NP](patterns: List[NP], name: String): NP = {
      val found = patterns.find(_.name == name)
      if(found.isEmpty)
        abort(s"nameToPattern: Cannot find `$name` in `${ patterns.map(_.name).mkString(", ") }`.")
      else
        found.get
    }

    def neighbours(nodePattern: NamePattern with SuperTypesPattern, relations: List[NamePattern with StartEndNodePattern], nodePatterns: List[NamePattern with SuperTypesPattern with StatementsPattern], nodeTraitPatterns: List[NodeTraitPattern]): List[(String, String, String)] = {
      val sources = patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodePattern).map(_.name)
      relations.filter(sources contains _.startNode).flatMap { r =>
        if(nodeTraitPatterns.map(_.name) contains r.endNode) {
          // if r.endNode is a trait
          // generate accessors for all childNodes
          val childNodes = childNodesOfNodeTrait(nodeTraitPatterns, nodePatterns, nameToPattern(nodeTraitPatterns, r.endNode))
          childNodes.map { childNode =>
            val accessorName = nameToPlural(r.name + childNode)
            (accessorName, r.name, childNode)
          }
        }
        else {
          val accessorName = nameToPlural(r.name)
          List((accessorName, r.name, r.endNode))
        }
      }
    }

    def rev_neighbours(nodePattern: NamePattern with SuperTypesPattern, relations: List[NamePattern with StartEndNodePattern], nodePatterns: List[NamePattern with SuperTypesPattern with StatementsPattern], nodeTraitPatterns: List[NodeTraitPattern]): List[(String, String, String)] = {
      val targets = patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodePattern).map(_.name)
      relations.filter(targets contains _.endNode).flatMap { r =>
        if(nodeTraitPatterns.map(_.name) contains r.startNode) {
          // if r.startNode is a trait
          val childNodes = childNodesOfNodeTrait(nodeTraitPatterns, nodePatterns, nameToPattern(nodeTraitPatterns, r.startNode))
          childNodes.map { childNode =>
            val accessorName = rev(nameToPlural(r.name + childNode))
            (accessorName, r.name, childNode)
          }
        }
        else {
          val accessorName = rev(nameToPlural(r.name))
          List((accessorName, r.name, r.startNode))
        }
      }
    }

    def isDeepSuperType[P <: NamePattern with SuperTypesPattern](patterns: List[P], subPattern: P, superPattern: P): Boolean = {
      subPattern.superTypes match {
        case Nil        => false
        case superTypes => superTypes.exists { name =>
          superPattern.name == name || (patterns.exists(_.name == name) && isDeepSuperType(patterns, nameToPattern(patterns, name), superPattern))
        }
      }
    }

    def patternToSuperTypes[P <: NamePattern with SuperTypesPattern](patterns: List[P], pattern: P): List[P] = pattern.superTypes.map(nameToPattern(patterns, _))

    def patternToFlatSuperTypesWithoutSelf[P <: NamePattern with SuperTypesPattern, SUPER <: P](patterns: List[SUPER], pattern: P): List[SUPER] = {
      patterns.filter { superPattern => isDeepSuperType(patterns, pattern, superPattern) }
    }

    def patternToFlatSuperTypesWithSelf[P <: NamePattern with SuperTypesPattern, SUPER <: P](patterns: List[SUPER], pattern: P): List[P] = {
      pattern :: patternToFlatSuperTypesWithoutSelf(patterns, pattern)
    }

    def patternToSubTypes[P <: NamePattern with SuperTypesPattern](patterns: List[P], pattern: P): List[P] = patterns.filter(_.superTypes.contains(pattern.name))

    def patternToFlatSubTypesWithoutSelf[P <: NamePattern with SuperTypesPattern, SUB <: P](patterns: List[SUB], pattern: P): List[SUB] = {
      patterns.filter { subPattern => isDeepSuperType(patterns, subPattern, pattern) }
    }

    def patternToFlatSubTypesWithSelf[P <: NamePattern with SuperTypesPattern, SUB <: P](patterns: List[SUB], pattern: P): List[P] = {
      pattern :: patternToFlatSubTypesWithoutSelf(patterns, pattern)
    }

    // TODO: check usages if other callers also need intermediate traits
    def childNodesOfNodeTrait(nodeTraits: List[NodeTraitPattern], nodePatterns: List[NamePattern with SuperTypesPattern], nodeTrait: NodeTraitPattern): List[String] = {
      patternToFlatSubTypesWithSelf(nodeTraits, nodeTrait).flatMap { subTrait =>
        nodePatterns.filter(_.superTypes contains subTrait.name)
      }.distinct.map(_.name)
    }

    def childNodesOfNodeTraitsWithTraits(nodeTraits: List[NodeTraitPattern], nodePatterns: List[NamePattern with SuperTypesPattern], nodeTrait: NodeTraitPattern): List[String] = {
      (nodeTrait :: patternToFlatSubTypesWithoutSelf(nodeTraits, nodeTrait)).flatMap { subTrait =>
        subTrait :: nodePatterns.filter(_.superTypes contains subTrait.name)
      }.distinct.map(_.name)
    }

    def nodeNamesToRelations[R <: StartEndNodePattern](nodeNames: List[String], relations: List[R]): List[R] = {
      relations.filter(relation => nodeNames.contains(relation.startNode) && nodeNames.contains(relation.endNode))
    }

    def nodeTraitToCommonHyperRelationTraits[P <: NamePattern with SuperTypesPattern]
    (nodeTraitPatterns: List[NodeTraitPattern], middleNodeTraitPatterns: List[P], nodePatterns: List[NamePattern with SuperTypesPattern],
     hyperRelationPatterns: List[HyperRelationPattern], nodeTrait: NodeTraitPattern): List[String] = {
      val nodes = childNodesOfNodeTraitsWithTraits(nodeTraitPatterns, nodePatterns ::: hyperRelationPatterns, nodeTrait)
      val subHyperRelations = nodeNamesToRelations(nodes, hyperRelationPatterns)
      val flatSuperTypes: List[List[String]] = subHyperRelations.map(hyperRelation => patternToFlatSuperTypesWithoutSelf(middleNodeTraitPatterns, hyperRelation).map(_.name))
      if(flatSuperTypes.isEmpty) Nil
      else if(flatSuperTypes.size == 1) flatSuperTypes.head
      else flatSuperTypes.reduce(_ intersect _)
    }

    def graphToNodes(graphPatterns: List[GraphPattern], graphPattern: GraphPattern): List[String] = {
      // return explicitely named nodes in @Graph (including traits, but no HyperRelations)
      patternToFlatSuperTypesWithSelf(graphPatterns, graphPattern).flatMap(_.nodes).distinct
    }

    def inducedRelations(nodes: List[String], nodeNamePatterns: List[NamePattern with SuperTypesPattern],
                         nodeTraitPatterns: List[NodeTraitPattern], hyperRelationPatterns: List[HyperRelationPattern],
                         relations: List[NamePattern with StartEndNodePattern]): List[String] = {
      val traits = nodes.map(nameToPattern(nodeNamePatterns, _)).flatMap(patternToFlatSuperTypesWithSelf(nodeTraitPatterns, _)).distinct.map(_.name)
      nodeNamesToRelations(nodes ::: traits ::: hyperRelationPatterns.map(_.name), relations).map(_.name)
    }

    def traitCanHaveOwnFactory(hierarchyPatterns: List[NamePattern with SuperTypesPattern with StatementsPattern], currentTrait: NamePattern with SuperTypesPattern): Option[Boolean] = {
      val children = patternToFlatSubTypesWithoutSelf(hierarchyPatterns, currentTrait)
      val childrenWithFlatParents = children.flatMap(patternToFlatSuperTypesWithSelf(hierarchyPatterns, _)).distinct
      val subWithoutSuper = childrenWithFlatParents diff patternToFlatSuperTypesWithSelf(hierarchyPatterns, currentTrait)
      // if we currently are at NodeTrait, we need to check whether one of its
      // children is a HyperRelation. If that is the case, a factory cannot be
      // generated, as the HyperRelation additionally needs Start-/EndNode in
      // its create-method.
      val isNodeTrait = currentTrait.isInstanceOf[NodeTraitPattern]
      val hasHyperRelationChild = children.exists(_.isInstanceOf[HyperRelationPattern])
      //TODO: should return something else for matches without start/end
      if(isNodeTrait && hasHyperRelationChild)
        return None

      //TODO: anything we can do to avoid repeating outselves here all over again?
      val statements = subWithoutSuper.flatMap(_.statements)
      Some(statements.forall {
        case q"val $x:Option[$propertyType]"         => true
        case q"var $x:Option[$propertyType]"         => true
        case q"val $x:$propertyType = $y"            => true
        case q"var $x:$propertyType = $y"            => true
        case q"val $x:$propertyType"                 => false
        case q"var $x:$propertyType"                 => false
        case q"@unique val $x:Option[$propertyType]" => true
        case q"@unique var $x:Option[$propertyType]" => true
        case q"@unique val $x:$propertyType = $y"    => true
        case q"@unique var $x:$propertyType = $y"    => true
        case q"@unique val $x:$propertyType"         => false
        case q"@unique var $x:$propertyType"         => false
        case _                                       => true // custom statements
      })
    }
  }

  case class Schema(
                     pattern: SchemaPattern,
                     nodes: List[Node],
                     relations: List[Relation],
                     hyperRelations: List[HyperRelation],
                     nodeTraits: List[NodeTrait],
                     relationTraits: List[RelationTrait],
                     graphs: List[Graph],
                     statements: List[Tree]
                     ) extends Named with SuperTypes {
    val externalSuperTypes = List.empty
  }

  case class Graph(
                    pattern: GraphPattern,
                    nodesWithHyperRelations: List[String],
                    nodes: List[String],
                    relationsWithHyperRelations: List[String],
                    relations: List[String],
                    hyperRelations: List[String],
                    nodeTraits: List[NodeTrait]
                    ) extends Named with SuperTypes {
    val externalSuperTypes = List.empty
  }

  case class NodeTrait(
                        pattern: NodeTraitPattern,
                        flatSuperTypesWithSelf: List[String], // only self and nodeTraits without external traits
                        externalSuperTypes: List[String],
                        neighbours: List[(String, String, String)], // accessorName, relation, endNode
                        rev_neighbours: List[(String, String, String)], // accessorName, relation, startNode
                        outRelationsToTrait: List[(String, String)],
                        inRelationsFromTrait: List[(String, String)],
                        subNodes: List[String],
                        subRelations: List[String],
                        subHyperRelations: List[String],
                        commonHyperRelationNodeTraits: List[String],
                        commonHyperRelationRelationTraits: List[String],
                        flatStatements: List[Tree],
                        hasOwnFactory: Option[Boolean]
                        ) extends Named with SuperTypes with Statements with HasOwnFactory with HasParameterList with HasTraitFactoryParameterList {

    def commonHyperRelationNodeTraits_type = commonHyperRelationNodeTraits.map(TypeName(_))
    def commonHyperRelationRelationTraits_type = commonHyperRelationRelationTraits.map(TypeName(_))

    def neighbours_terms = neighbours.map { case (accessorName, relation, endNode) =>
      (TermName(accessorName), TermName(relation), TypeName(endNode), TermName(endNode))
    }

    def rev_neighbours_terms = rev_neighbours.map { case (rev_accessorName, relation, startNode) =>
      (TermName(rev_accessorName), TermName(relation), TypeName(startNode), TermName(startNode))
    }

    val parameterList = ParameterList.create(flatStatements, name, representsNode = true, hasOwnFactory)

    var traitFactoryParameterList: List[ParameterList] = null
  }

  object NodeTrait {
    def apply(
               rawNodeTraitPattern: NodeTraitPattern,
               nodeTraitPatterns: List[NodeTraitPattern],
               relationTraitPatterns: List[RelationTraitPattern],
               selectedNodePatterns: List[NamePattern with SuperTypesPattern with StatementsPattern],
               selectedHyperRelationPatterns: List[HyperRelationPattern],
               relationPatterns: List[RelationPattern],
               hyperRelationPatterns: List[HyperRelationPattern]
               ) = {

      import Schema.{childNodesOfNodeTrait, flatSuperStatements, nodeNamesToRelations, nodeTraitToCommonHyperRelationTraits, patternToFlatSuperTypesWithSelf, traitCanHaveOwnFactory}

      val allRelationPatterns = relationPatterns ::: hyperRelationPatterns

      val externalSuperTypes = rawNodeTraitPattern.superTypes diff nodeTraitPatterns.map(_.name)
      val nodeTraitPattern = rawNodeTraitPattern.copy(_superTypes = rawNodeTraitPattern.superTypes diff externalSuperTypes)

      val childNodes = childNodesOfNodeTrait(nodeTraitPatterns, selectedNodePatterns ::: selectedHyperRelationPatterns, nodeTraitPattern)
      val childTraits = childNodesOfNodeTrait(nodeTraitPatterns, nodeTraitPatterns, nodeTraitPattern)
      new NodeTrait(
        nodeTraitPattern,
        flatSuperTypesWithSelf = patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodeTraitPattern).map(_.name) intersect nodeTraitPatterns.map(_.name),
        externalSuperTypes = externalSuperTypes,

        neighbours = Schema.neighbours(nodeTraitPattern, allRelationPatterns, selectedNodePatterns, nodeTraitPatterns),
        rev_neighbours = Schema.rev_neighbours(nodeTraitPattern, allRelationPatterns, selectedNodePatterns, nodeTraitPatterns),
        outRelationsToTrait = allRelationPatterns.filter { r =>
          (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodeTraitPattern).map(_.name) contains r.startNode) &&
          (nodeTraitPatterns.map(_.name) contains r.endNode)
        }.map(r => (r.name, r.endNode)),
        inRelationsFromTrait = allRelationPatterns.filter { r =>
          // endNode is this node or one of its supertypes
          // and startNode is a Node Trait
          (patternToFlatSuperTypesWithSelf(nodeTraitPatterns, nodeTraitPattern).map(_.name) contains r.endNode) &&
          (nodeTraitPatterns.map(_.name) contains r.startNode)
        }.map(r => (r.name, r.startNode)),

        subNodes = childNodes,
        subRelations = nodeNamesToRelations(nodeTraitPattern.name :: childNodes ::: childTraits, hyperRelationPatterns ::: relationPatterns).map(_.name),
        subHyperRelations = nodeNamesToRelations(nodeTraitPattern.name :: childNodes ::: childTraits, hyperRelationPatterns).map(_.name),
        commonHyperRelationNodeTraits = nodeTraitToCommonHyperRelationTraits(nodeTraitPatterns, nodeTraitPatterns, selectedNodePatterns, hyperRelationPatterns, nodeTraitPattern),
        commonHyperRelationRelationTraits = nodeTraitToCommonHyperRelationTraits(nodeTraitPatterns, relationTraitPatterns, selectedNodePatterns, hyperRelationPatterns, nodeTraitPattern),
        flatStatements = flatSuperStatements(nodeTraitPatterns, nodeTraitPattern),
        hasOwnFactory = traitCanHaveOwnFactory(selectedNodePatterns ::: hyperRelationPatterns ::: relationTraitPatterns ::: nodeTraitPatterns, rawNodeTraitPattern)
      )
    }
  }

  case class RelationTrait(
                            pattern: RelationTraitPattern,
                            externalSuperTypes: List[String],
                            flatStatements: List[Tree],
                            hasOwnFactory: Option[Boolean]
                            ) extends Named with SuperTypes with Statements with HasOwnFactory with HasParameterList {

    val parameterList = ParameterList.create(flatStatements, name, representsNode = false, hasOwnFactory)
  }

  case class Node(
                   pattern: NodePattern,
                   flatSuperTypesWithSelf: List[String], // only self and nodeTraits without external traits
                   externalSuperTypes: List[String],
                   neighbours: List[(String, String, String)], // accessorName, relation, endNode
                   rev_neighbours: List[(String, String, String)], // accessorName, relation, startNode
                   outRelationsToTrait: List[(String, String)],
                   inRelationsFromTrait: List[(String, String)],
                   flatStatements: List[Tree],
                   traitFactoryParameterList: List[ParameterList],
                   implementedTrait: Option[NodeTrait]
                   ) extends Named with SuperTypes with Statements with HasParameterList with HasTraitFactoryParameterList {

    val parameterList = ParameterList.create(flatStatements, name, representsNode = true)

    def isTraitImplementation = implementedTrait.isDefined

    def neighbours_terms = neighbours.map { case (accessorName, relation, endNode) =>
      (TermName(accessorName), TermName(relation), TypeName(endNode), TermName(endNode))
    }

    def rev_neighbours_terms = rev_neighbours.map { case (rev_accessorName, relation, startNode) =>
      (TermName(rev_accessorName), TermName(relation), TypeName(startNode), TermName(startNode))
    }
  }

  case class Relation(
                       pattern: RelationPattern,
                       externalSuperTypes: List[String],
                       flatStatements: List[Tree], // TODO: rename to flatSuperStatements (same for node etc)
                       traitFactoryParameterList: List[ParameterList]
                       ) extends Named with StartEndNode with SuperTypes with Statements with HasParameterList with HasTraitFactoryParameterList {

    val parameterList = ParameterList.create(flatStatements, name, representsNode = false)
  }

  case class HyperRelation(
                            pattern: HyperRelationPattern,
                            superNodeTypes: List[String],
                            flatSuperNodeTypesWithSelf: List[String], // only self and nodeTraits without external traits
                            externalSuperTypes: List[String],
                            superRelationTypes: List[String],
                            neighbours: List[(String, String, String)], // accessorName, relation, endNode
                            rev_neighbours: List[(String, String, String)], // accessorName, relation, startNode
                            outRelationsToTrait: List[(String, String)],
                            inRelationsFromTrait: List[(String, String)],
                            flatSuperStatements: List[Tree],
                            traitFactoryParameterList: List[ParameterList]
                            ) extends Named with SuperTypes with StartEndNode with Statements with StartEndRelation with HasParameterList with HasTraitFactoryParameterList {

    val parameterList = ParameterList.create(flatSuperStatements, name, representsNode = true)

    //TODO: share code with Node
    def neighbours_terms = neighbours.map { case (accessorName, relation, endNode) =>
      (TermName(accessorName), TermName(relation), TypeName(endNode), TermName(endNode))
    }

    def rev_neighbours_terms = rev_neighbours.map { case (rev_accessorName, relation, startNode) =>
      (TermName(rev_accessorName), TermName(relation), TypeName(startNode), TermName(startNode))
    }
  }

}


text:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

namespace XNA3
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class BossZombie : Microsoft.Xna.Framework.DrawableGameComponent
    {
        protected Texture2D texture;
        protected Rectangle spriteRectangle;
        protected Vector2 position;
        protected Vector2 velocity;
        float rotation;

        protected const int PLAYERWIDTH = 100;
        protected const int PLAYERHEIGHT = 100;
        protected const int speed = 4;

        protected Rectangle screenBounds;

        protected bool show = true;

        Random random;

        Survivor survivor;

        //MouseComponent myMouse;

        public BossZombie(Game game, ref Texture2D theTexture, ref Survivor s)
            : base(game)
        {

            // TODO: Construct any child components here
            texture = theTexture;
            position = new Vector2();
            random = new Random(this.GetHashCode());
            survivor = s;

            spriteRectangle = new Rectangle(0, 0, PLAYERWIDTH, PLAYERHEIGHT);

            screenBounds = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);

            //myMouse = mouse;
        }

        public void PutinStartPosition(int x, int y)
        {
            position.X = x;
            position.Y = y;
        }
        public void PutonRandomWall()
        {
            int wall = random.Next(4);

            if (wall == 0)
                PutRandomNorthWall();
            else if (wall == 1)
                PutRandomSouthWall();
            else if (wall == 2)
                PutRandomEastWall();
            else if (wall == 3)
                PutRandomWestWall();
        }
        public void PutinRandomPosition()
        {
            int x = random.Next(Game.Window.ClientBounds.Width - PLAYERWIDTH);
            int y = random.Next(Game.Window.ClientBounds.Height - PLAYERHEIGHT);

            position.X = x;
            position.Y = y;
        }

        public void PutRandomNorthWall()
        {
            int x = random.Next(Game.Window.ClientBounds.Width - PLAYERWIDTH);
            int y = 0;

            position.X = x;
            position.Y = y;
        }
        public void PutRandomSouthWall()
        {
            int x = random.Next(Game.Window.ClientBounds.Width - PLAYERWIDTH);
            int y = Game.Window.ClientBounds.Height - PLAYERHEIGHT;

            position.X = x;
            position.Y = y;
        }
        public void PutRandomEastWall()
        {
            int x = Game.Window.ClientBounds.Width - PLAYERWIDTH;
            int y = random.Next(Game.Window.ClientBounds.Height - PLAYERHEIGHT);

            position.X = x;
            position.Y = y;
        }
        public void PutRandomWestWall()
        {
            int x = 0;
            int y = random.Next(Game.Window.ClientBounds.Height - PLAYERHEIGHT);

            position.X = x;
            position.Y = y;
        }

        public void setPos(BossZombie s)
        {
            position.X = s.position.X;
            position.Y = s.position.Y;
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            random = new Random(this.GetHashCode());
            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            if(show)
            {
                float XDistance = position.X - survivor.getPosition().X;
                float YDistance = position.Y - survivor.getPosition().Y;

                rotation = (float)Math.Atan2(YDistance, XDistance);

                double angle = Math.Atan2(((double)(survivor.getPosition().Y - position.Y)), (double)(survivor.getPosition().X - position.X));
                velocity = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
                velocity.X = velocity.X * speed;
                velocity.Y = velocity.Y * speed;

                position += velocity;
            }
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            //get current sprite batch
            SpriteBatch sBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            //Draw the survivor
            if (show)
            {
                //Draw the sprite with required rotation and origin (centre of rotation) set to the centre of the sprite
                sBatch.Draw(texture, position, spriteRectangle, Color.White, rotation, new Vector2(texture.Width / 2, texture.Height / 2), 1, SpriteEffects.None, 0);
            }
            base.Draw(gameTime);
        }

        public Rectangle GetBounds()
        {
            return new Rectangle((int)position.X, (int)position.Y, PLAYERWIDTH, PLAYERHEIGHT);
        }

        public bool CheckCollision(Rectangle rect)
        {
            Rectangle spriterect = new Rectangle((int)position.X, (int)position.Y, PLAYERWIDTH, PLAYERHEIGHT);

            return spriterect.Intersects(rect);
        }

        public void Show()
        {
            show = true;
        }
        public void Hide()
        {
            show = false;
        }
        public void goAway()
        {
            position.X = 5000;
            position.Y = 5000;
            Hide();
        }

        public Vector2 getPosition()
        {
            return position;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of Person in UD_Romanian-ArT</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Romanian-ArT: Features: Person

This feature is universal.
It occurs with 3 different values: 1, 2, 3.

196 tokens (34%) have a non-empty value of Person.
157 types (53%) occur at least once with a non-empty value of Person.
89 lemmas (40%) occur at least once with a non-empty value of Person.
The feature is used with 4 part-of-speech tags: <tt>VERB</tt> (110; 19% instances), <tt>PRON</tt> (71; 12% instances), <tt>AUX</tt> (9; 2% instances), <tt>DET</tt> (6; 1% instances).

VERB

110 <tt>VERB</tt> tokens (96% of all VERB tokens) have a non-empty value of Person.

The most frequent other feature values with which VERB and Person co-occurred: <tt>VerbForm</tt><tt>=Fin</tt> (110; 100%), <tt>Number</tt><tt>=Sing</tt> (89; 81%), <tt>Mood</tt><tt>=Ind</tt> (78; 71%).

VERB tokens may have the following values of Person:

1 (7; 6% of non-empty Person): aduc, aĝut, dipun, escu, fum, vineam, ýin

2 (14; 13% of non-empty Person): adu, aflaşi, afli, agudişi, asuń, aştepţ, bati, dipuńi, intrai, misură

3 (89; 81% of non-empty Person): adară, ascapă, ascăpă, aştipta, facă, feaţi, fudzirâ, imna, lucra, mutreaşte

EMPTY (5): ascăpată, faptă, minduit, niapirită, nidată

Paradigm aduc	<tt>1</tt>	<tt>2</tt>	<tt>3</tt>

<tt><tt>Mood</tt><tt>=Imp</tt></tt>		adu

<tt><tt>Mood</tt><tt>=Ind</tt>|<tt>Tense</tt><tt>=Past</tt></tt>			aduse

<tt><tt>Mood</tt><tt>=Ind</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	aduc

PRON

71 <tt>PRON</tt> tokens (100% of all PRON tokens) have a non-empty value of Person.

The most frequent other feature values with which PRON and Person co-occurred: <tt>PronType</tt><tt>=Prs</tt> (59; 83%), <tt>Reflex</tt><tt>=EMPTY</tt> (52; 73%), <tt>Gender</tt><tt>=EMPTY</tt> (49; 69%), <tt>Strength</tt><tt>=Weak</tt> (45; 63%), <tt>Variant</tt><tt>=EMPTY</tt> (45; 63%), <tt>Case</tt><tt>=Acc</tt> (39; 55%), <tt>Number</tt><tt>=Sing</tt> (39; 55%).

PRON tokens may have the following values of Person:

1 (7; 10% of non-empty Person): mi, io, ma, mine

2 (9; 13% of non-empty Person): ti, tine, te-, ţ, ț-

3 (55; 77% of non-empty Person): s-, u, nâsă, si, ţi, -ĺi, cari, lu, se-, vârnu

Person seems to be lexical feature of PRON. 100% lemmas (14) occur only with one value of Person.

AUX

9 <tt>AUX</tt> tokens (100% of all AUX tokens) have a non-empty value of Person.

The most frequent other feature values with which AUX and Person co-occurred: <tt>Number</tt><tt>=Sing</tt> (7; 78%), <tt>VerbForm</tt><tt>=Fin</tt> (6; 67%), <tt>Mood</tt><tt>=Ind</tt> (5; 56%), <tt>Tense</tt><tt>=Imp</tt> (5; 56%).

AUX tokens may have the following values of Person:

3 (9; 100% of non-empty Person): era, va, avea, hibă

DET

6 <tt>DET</tt> tokens (40% of all DET tokens) have a non-empty value of Person.

The most frequent other feature values with which DET and Person co-occurred: <tt>Poss</tt><tt>=EMPTY</tt> (5; 83%), <tt>Case</tt><tt>=Acc,Nom</tt> (4; 67%), <tt>Position</tt><tt>=EMPTY</tt> (4; 67%).

DET tokens may have the following values of Person:

3 (6; 100% of non-empty Person): -su, Aestu, alti, câte, multu, ndoauă

EMPTY (9): un, nă, Ună, a

Relations with Agreement in Person

The 10 most frequent relations where parent and child node agree in Person:
<tt>VERB –[<tt>advcl</tt>]–> VERB</tt> (20; 69%),
<tt>VERB –[<tt>expl:pv</tt>]–> PRON</tt> (19; 100%),
<tt>VERB –[<tt>conj</tt>]–> VERB</tt> (15; 88%),
<tt>VERB –[<tt>nsubj</tt>]–> PRON</tt> (15; 100%),
<tt>VERB –[<tt>expl</tt>]–> PRON</tt> (9; 82%),
<tt>VERB –[<tt>ccomp</tt>]–> VERB</tt> (8; 100%),
<tt>VERB –[<tt>aux</tt>]–> AUX</tt> (4; 67%),
<tt>VERB –[<tt>iobj</tt>]–> PRON</tt> (3; 60%),
<tt>VERB –[<tt>ccomp:pmod</tt>]–> VERB</tt> (2; 100%),
<tt>VERB –[<tt>obl:pmod</tt>]–> PRON</tt> (2; 100%).

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
package com.asakusafw.dag.runtime.data;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.List;
import java.util.RandomAccess;

import org.junit.Test;

import com.asakusafw.runtime.value.IntOption;

/**
 * Test for {@link HeapListBuilder}.
 */
public class HeapListBuilderTest {

    /**
     * simple case.
     * @throws Exception if failed
     */
    @Test
    public void simple() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 1;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list, instanceOf(RandomAccess.class));
            assertThat(list.size(), is(size));
            for (int i = 0, n = end - begin; i < n; i++) {
                IntOption value = list.get(i);
                assertThat(value, is(new IntOption(i + begin)));
            }
        }
    }

    /**
     * w/ multiple records.
     * @throws Exception if failed
     */
    @Test
    public void multiple() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 10;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            for (int i = 0, n = end - begin; i < n; i++) {
                IntOption value = list.get(i);
                assertThat(value, is(new IntOption(i + begin)));
            }
        }
    }

    /**
     * w/ multiple records.
     * @throws Exception if failed
     */
    @Test
    public void large() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 1_000_000;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            for (int i = 0, n = end - begin; i < n; i++) {
                IntOption value = list.get(i);
                assertEquals(i + begin, value.get());
            }
        }
    }

    /**
     * w/ multiple records.
     * @throws Exception if failed
     */
    @Test
    public void reuse() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 1_000_000;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            for (int i = 0, n = end - begin; i < n; i++) {
                IntOption value = list.get(i);
                assertEquals(i + begin, value.get());
            }
        }
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 2_000_000;
            int end = 3_000_000;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            for (int i = 0, n = end - begin; i < n; i++) {
                IntOption value = list.get(i);
                assertEquals(i + begin, value.get());
            }
        }
    }

    /**
     * w/ for-each.
     * @throws Exception if failed
     */
    @Test
    public void forEach() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 10;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            int index = begin;
            for (IntOption value : list) {
                assertThat(value, is(new IntOption(index++)));
            }
        }
    }

    /**
     * w/ for-each.
     * @throws Exception if failed
     */
    @Test
    public void forEach_replay() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            int begin = 0;
            int end = 10;
            int size = end - begin;
            List<IntOption> list = builder.build(IntOptionAdapter.range(begin, end));
            assertThat(list.size(), is(size));
            int index = begin;
            for (IntOption value : list) {
                assertThat(value, is(new IntOption(index++)));
            }
            index = begin;
            for (IntOption value : list) {
                assertThat(value, is(new IntOption(index++)));
            }
            index = begin;
            for (IntOption value : list) {
                assertThat(value, is(new IntOption(index++)));
            }
        }
    }

    /**
     * w/ out of lower bounds.
     * @throws Exception if failed
     */
    @Test(expected = IndexOutOfBoundsException.class)
    public void bounds_lower() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            builder.build(IntOptionAdapter.range(0, 10)).get(-1);
        }
    }

    /**
     * w/ out of upper bounds.
     * @throws Exception if failed
     */
    @Test(expected = IndexOutOfBoundsException.class)
    public void bounds_upper() throws Exception {
        try (HeapListBuilder<IntOption> builder = new HeapListBuilder<>(new IntOptionAdapter())) {
            builder.build(IntOptionAdapter.range(0, 10)).get(10);
        }
    }
}


text:
"---
title: 'QGIS add an auto-incrementing ID field'
layout: post
tags: []
category:
Uncategoried
---

Sometimes it is useful to reference values in another table, in an expression. For example, when you want to use a value from a lookup table.

To achieve this use two functions together, 'attribute' and 'get feature'.

The syntax is as follows: attribute(get_feature('VALUE_LAYER_NAME', 'KEY_FIELD', KEY), 'VALUE_FIELD')

<img src=""https://i.stack.imgur.com/KrsjL.png"" />"


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Puccinia eatoniae var. ranunculi Mains

### Remarks
null


text:
import re
import collections

from enum import Enum

from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST,     REFERENCE_IDENTITY_CLASS, REFERENCE_ENUM_CLASS, REFERENCE_BITS, REFERENCE_UNION, ANYXML_CLASS

from ydk.errors import YPYError, YPYModelError
from ydk.providers._importer import _yang_ns
_meta_table = {
    'VxlanUdpPortEnumEnum' : _MetaInfoEnum('VxlanUdpPortEnumEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_tunnel_nve_cfg',
        {
            'ietf-udp-port':'ietf_udp_port',
            'ivx-lan-udp-port':'ivx_lan_udp_port',
        }, 'Cisco-IOS-XR-tunnel-nve-cfg', _yang_ns._namespaces['Cisco-IOS-XR-tunnel-nve-cfg']),
    'OverlayEncapEnumEnum' : _MetaInfoEnum('OverlayEncapEnumEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_tunnel_nve_cfg',
        {
            'vx-lan-encapsulation':'vx_lan_encapsulation',
            'soft-gre-encapsulation':'soft_gre_encapsulation',
        }, 'Cisco-IOS-XR-tunnel-nve-cfg', _yang_ns._namespaces['Cisco-IOS-XR-tunnel-nve-cfg']),
    'LoadBalanceEnumEnum' : _MetaInfoEnum('LoadBalanceEnumEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_tunnel_nve_cfg',
        {
            'per-evi':'per_evi',
        }, 'Cisco-IOS-XR-tunnel-nve-cfg', _yang_ns._namespaces['Cisco-IOS-XR-tunnel-nve-cfg']),
    'UnknownUnicastFloodingEnumEnum' : _MetaInfoEnum('UnknownUnicastFloodingEnumEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_tunnel_nve_cfg',
        {
            'suppress-uuf':'suppress_uuf',
        }, 'Cisco-IOS-XR-tunnel-nve-cfg', _yang_ns._namespaces['Cisco-IOS-XR-tunnel-nve-cfg']),
    'HostReachProtocolEnum' : _MetaInfoEnum('HostReachProtocolEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_tunnel_nve_cfg',
        {
            'bgp':'bgp',
        }, 'Cisco-IOS-XR-tunnel-nve-cfg', _yang_ns._namespaces['Cisco-IOS-XR-tunnel-nve-cfg']),
}


text:
void no_analyze_fun() NO_SANITIZE_THREAD;

void no_analyze_alt() __attribute__((__no_sanitize_thread__));

void no_analyze_args() __attribute__((no_sanitize_thread(1))); // \
  // expected-error {{'no_sanitize_thread' attribute takes no arguments}}

int no_analyze_testfn(int y) NO_SANITIZE_THREAD;

int no_analyze_testfn(int y) {
  int x NO_SANITIZE_THREAD = y; // \
    // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
  return x;
}

int no_analyze_test_var NO_SANITIZE_THREAD; // \
  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}

class NoAnalyzeFoo {
 private:
  int test_field NO_SANITIZE_THREAD; // \
    // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
  void test_method() NO_SANITIZE_THREAD;
};

class NO_SANITIZE_THREAD NoAnalyzeTestClass { // \
  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
};

void no_analyze_params(int lvar NO_SANITIZE_THREAD); // \
  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}


text:
package org.apache.camel.component.telegram;

import org.apache.camel.Endpoint;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.telegram.model.OutgoingTextMessage;
import org.apache.camel.component.telegram.util.TelegramTestSupport;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;

import static org.mockito.ArgumentMatchers.eq;

/**
 * Tests a producer route with a fixed destination.
 */
public class TelegramProducerChatIdResolutionTest extends TelegramTestSupport {

    @EndpointInject(uri = "direct:telegram")
    private Endpoint endpoint;

    @Test
    public void testRouteWithFixedChatId() throws Exception {

        TelegramService api = mockTelegramService();

        context().createProducerTemplate().sendBody(endpoint, "Hello");

        ArgumentCaptor<OutgoingTextMessage> captor = ArgumentCaptor.forClass(OutgoingTextMessage.class);

        Mockito.verify(api).sendMessage(eq("mock-token"), captor.capture());
        assertEquals("my-id", captor.getValue().getChatId());
        assertEquals("Hello", captor.getValue().getText());
        assertNull(captor.getValue().getParseMode());
    }

    @Test
    public void testRouteWithOverridenChatId() throws Exception {

        TelegramService api = mockTelegramService();

        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("Hello 2");
        exchange.getIn().setHeader(TelegramConstants.TELEGRAM_CHAT_ID, "my-second-id");

        context().createProducerTemplate().send(endpoint, exchange);

        ArgumentCaptor<OutgoingTextMessage> captor = ArgumentCaptor.forClass(OutgoingTextMessage.class);

        Mockito.verify(api).sendMessage(eq("mock-token"), captor.capture());
        assertEquals("my-second-id", captor.getValue().getChatId());
        assertEquals("Hello 2", captor.getValue().getText());
        assertNull(captor.getValue().getParseMode());

    }

    @Override
    protected RoutesBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:telegram").to("telegram:bots/mock-token?chatId=my-id");
            }
        };
    }

}


text:
Toto
===============
Toto is a small framework intended to accelerate web service development. It is
built on top of [Tornado][tornado] and can currently use [MySQL][mysql], [MongoDB][mongodb], [PostgreSQL][postgres] or
[Redis][redis] as a backing database.

[![Build Status](https://travis-ci.org/JeremyOT/Toto.svg)](https://travis-ci.org/JeremyOT/Toto)

Features
--------
* Uses JSON (or BSON or msgpack) for easy consumption by clients on any platform
* Easy to add new methods
* Simple authentication built in with HMAC-SHA1 verification for authenticated requests
* Session state persistence for authenticated requests
* Sessions stored in database to simplify scaling across servers

Installation
------------
The simplest way to install Toto is with pip. Simply run `pip install -e git+git://github.com/JeremyOT/Toto.git#egg=Toto`
to install the latest version of the Toto module on your machine.

Documentation
-------------
Complete documentation is available here: [http://toto.li/docs/][docs].

Usage
-----

Getting started with Toto is easy, all you need to do is make a new instance of `toto.TotoServer`
and call `run()`. Toto needs a root module to use for method lookup. By default, a `TotoServer`
will look for a module called `methods`. The `method_module` parameter can be used to specify
another module by name.

Configuration
-------------
By default, Toto is configured to run on port 8888 and connect to a MongoDB server
running on localhost. Configuration can be performed in three ways with each overriding the last:

1. By passing options as named parameters to the `TotoServer` constructor.
2. Through a configuration file by passing the path to the config file as the first parameter to
   the `TotoServer` constructor.
3. With command line parameters (`--option='string value' --option=1234`)

Combining the configuration methods can be useful when debugging. Run your script with `--help`
to see a full list of available parameters.

Methods
-------

Methods are referenced by name in each request. `a.b.c` (or `a/b/c`) maps to `methods.a.b.c`. To add new
methods, add modules and packages to the `methods` (or specified) package (see the account package for
reference) and ensure that each callable module defines `invoke(handler, parameters)`
where `handler` is the `TotoHandler` (subclass of `tornado.web.RequestHandler`) handling
the current request.

`handler.connection.db` provides direct access to the database used by the sessions and
accounts framework.

`handler.session` provides access to the current session or `None` if not authenticated.
Available properties:

* `session.user_id` - the current user ID
* `session.expires` - the unix timestamp when the session will expire
* `session.session_id` - the current session ID
* `session.state` - a python dict containing the current state, you must call
`session.save_state()` to persist any changes. The session object acts like a proxy to state so
you can use dictionary accessors on it directly.

To enforce authentication for any method, decorate the `invoke()` function with
`@toto.invocation.authenticated`. Unauthorized attempts to call authenticated methods
will return a not authorized error.

Required parameters can be specified by decorating an `invoke()` function with
`@toto.invocation.requires(param1, param2,...)`.

Method modules can take advantage of [Tornado's][tornado] non-blocking features by decorating
an `invoke()` function with `@toto.invocation.asynchronous`. Data can be sent
to the client with `handler.respond()` and `handler.raw_respond()`. Optionally, modules can
implement `on_connection_close()` to clean up any resources if the client closes the
connection. See `RequestHandler.on_connection_close()` in the [Tornado][tornado] documentation
for more information.

It is important to remember that [Tornado][tornado] requires that all calls to `respond()`, `respond_raw()`, `write()`,
`flush()` and `finish()` are performed on the main thread. You can schedule a function to
run on the main thread with `IOLoop.instance().add_callback(callback)`.

_Note: Any data returned from a call to `method.invoke()` will be sent to the client as
JSON data and be used to generate the `x-toto-hmac` header for verification. This may cause
issues with asynchronous methods. If `method.invoke()` returns `None`, a response will not
automatically be sent to the client and no `x-toto-hmac` header will be generated._

Requests
-----------
Non-authenticated methods:

1. Call service with JSON object in the form: `{"method": "a.b.c", "parameters": <parameters>}`. Instead of passing
the "method" argument in the request body, it is also possible to call methods by URL. The URL equivalent to the
above call is `http://service.com/service/a/b/c`.
2. Parse response JSON.

Account Creation:

1. Call `account.create` method with `{"user_id": <user_id>, "password": <password>}`.
2. Verify that the base64 encoded HMAC-SHA1 of the response body with `<user_id>` as the key matches the `x-toto-hmac`
header in the response.
3. Parse response JSON.
4. Read and store `session_id` from the response object.

Login:

1. Call `account.login` method with `{"user_id": <user_id>, "password": <password>}`.
2. Verify that the base64 encoded HMAC-SHA1 of the response body with `<user_id>` as the key matches the `x-toto-hmac`
header in the response.
3. Parse response JSON.
4. Read and store `session_id` from the response object.

Authenticated methods:

1. Login (see-above).
2. Call service with JSON object in the form: `{"method": "a.b.c", "parameters": <parameters>}`
with the `x-toto-session-id` header set to the session ID returned from login and the `x-toto-hmac` header
set to the base64 encoded HMAC-SHA1 generated with `<user_id>` as the key and the JSON request string as
the message.
3. Verify that the base64 encoded HMAC-SHA1 of the response body with `<user_id>` as the key matches the `x-toto-hmac`
header in the response.
4. Parse response JSON.

_Note: These instructions assume that `method.invoke()` returns an object to be serialized
and sent to the client. Methods that return None can be used the send any data and must be
handled accordingly._

Events
======
Sometimes you may need to send events from one request to another. Toto's `toto.events.EventManager` makes this easy.

To send an event use `EventManager.instance().send('eventname', args)`. EventManager uses python's `cPickle` module
for serialization so you can pass anything cPickle can handle as `args`.

To receive an event, you must register a handler with `TotoHandler.register_event_handler('eventname', handler)`.
`handler` is a function that takes one parameters and will be called with `args` when the `EventManager` sends an event
with 'eventname'. Toto's events were primarily designed to be combined with tornado's support for non-blocking requests.
See the "chat" template for an example.

_Toto's event system supports sending events across multiple instances both on the same machine and in a distributed
system. Run your server with --help for more configuration options_

Daemonization
=============
The Toto server can be run as a daemon by passing the argument `--start`. To stop any running processes pass
`--stop`. This will stop any processes that share the specified pid file format (default `toto.pid`). The
`--processes=<n>` option may be used to specify the number of server instances to run. Multiple instances will be run
on sequential ports starting at the port specified by `--port`. If `0` is used as the argument to `--processes`, Toto
will run one process per cpu as detected by Python's `multiprocessing` module. Additional daemonization options can
be viewed from `--help`.

Clients
=======
To help you get started, JavaScript and iOS client libraries are in development at [https://github.com/JeremyOT/TotoClient-JS](https://github.com/JeremyOT/TotoClient-JS)
and [https://github.com/JeremyOT/TotoClient-iOS](https://github.com/JeremyOT/TotoClient-iOS) respectively.

[tornado]:http://www.tornadoweb.org
[mysql]:http://www.mysql.com
[mongodb]:http://www.mongodb.org
[docs]:http://toto.li/docs/ "http://toto.li/docs/"
[postgres]:http://www.postgresql.org/
[redis]:http://redis.io/


text:
package org.xtuml.bp.core.common;

import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;

import org.xtuml.bp.ui.preference.BasePlugin;
import org.xtuml.bp.ui.preference.IPreferenceModel;
import org.xtuml.bp.ui.preference.IPreferenceModelStore;

public class BridgePointPreferencesStore implements IPreferenceModelStore {
    private static final String PREFIX = "bridgepoint_prefs_";  //$NON-NLS-1$

    public static final String PARSE_ALL_ON_RESOURCE_CHANGE = PREFIX + "parse_all_on_resource_change"; //$NON-NLS-1$
    public static final String ALLOW_INT_TO_REAL_PROMOTION = PREFIX + "allow_int_to_real_promotion"; //$NON-NLS-1$
    public static final String ALLOW_REAL_TO_INT_COERCION = PREFIX + "allow_real_to_int_coercion"; //$NON-NLS-1$
    public static final String ALLOW_OPERATIONS_IN_WHERE = PREFIX + "allow_operations_in_where"; //$NON-NLS-1$
    public static final String ALLOW_IMPLICIT_COMPONENT_ADDRESSING = PREFIX + "allow_implicit_component_addressing"; //$NON-NLS-1$
    public static final String ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE = PREFIX + "enable_error_for_empty_synchronous_message"; //$NON-NLS-1$
    public static final String ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED = PREFIX + "enable_error_for_empty_synchronous_message_realized"; //$NON-NLS-1$
    public static final String DISABLE_GRADIENTS = PREFIX + "disable_gradients"; //$NON-NLS-1$
    public static final String INVERT_GRADIENTS = PREFIX + "invert_gradients"; //$NON-NLS-1$
    public static final String GRADIENT_BASE_COLOR = PREFIX + "gradient_base_color"; //$NON-NLS-1$
    public static final String EXPORT_OAL = PREFIX + "export_oal"; //$NON-NLS-1$
    public static final String EXPORT_GRAPHICS = PREFIX + "export_graphics"; //$NON-NLS-1$
    public static final String MESSAGE_DIRECTION = PREFIX + "message_direction";
    public static final String SHOW_TRANSITION_ACTIONS = PREFIX + "show_transition_actions"; //$NON-NLS-1$
    public static final String SHOW_EVENT_PARAMETERS = PREFIX + "show_event_parameters"; //$NON-NLS-1$
    public static final String ENABLE_FIXED_LENGTH_ARRAYS = PREFIX + "enable_fixed_length_arrays"; //$NON-NLS-1$
    public static final String ENABLE_DYNAMICALLY_SIZED_ARRAYS = PREFIX + "enable_dynamically_sized_arrays"; //$NON-NLS-1$
    public static final String ENABLE_DETERMINISTIC_VERIFIER = PREFIX + "enable_deterministic_verifier"; //$NON-NLS-1$
    public static final String ENABLE_INSTANCE_REFERENCES = PREFIX + "enable_instance_references"; //$NON-NLS-1$
    public static final String ENABLE_VERIFIER_AUDIT = PREFIX + "enable_verifier_audit"; //$NON-NLS-1$
    public static final String ENABLE_SELECT_AUDIT = PREFIX + "enable_select_audit"; //$NON-NLS-1$
    public static final String ENABLE_RELATE_AUDIT = PREFIX + "enable_relate_audit"; //$NON-NLS-1$
    public static final String ENABLE_UNRELATE_AUDIT = PREFIX + "enable_unrelate_audit"; //$NON-NLS-1$
    public static final String ENABLE_DELETE_AUDIT = PREFIX + "enable_delete_audit"; //$NON-NLS-1$
    public static final String START_UP_TIME = PREFIX + "start_up_time"; //$NON-NLS-1$
    public static final String SHOW_GRID = PREFIX + "showGrid"; //$NON-NLS-1$
    public static final String SNAP_TO_GRID = PREFIX + "snapToGrid"; //$NON-NLS-1$
    public static final String GRID_SPACING = PREFIX + "gridSpacing"; //$NON-NLS-1$
    public static final String EMIT_RTO_DATA = PREFIX + "emit_rto_data"; //$NON-NLS-1$
	public static final String DEFAULT_ROUTING_STYLE = PREFIX + "defaultRoutingStyle"; //$NON-NLS-1$
    public static final String SHOW_SYNC_DELETION_DIALOG = PREFIX + "show_reference_delete_warning"; //$NON-NLS-1$
    public static final String SHOW_SYNC_REPORT = PREFIX + "show_reference_sync_report"; //$NON-NLS-1$
    public static final String USE_DEFAULT_NAME_FOR_CREATION = PREFIX + "use_default_name_for_new_element_creation"; //$NON-NLS-1$

	public static final String RECTILINEAR_ROUTING = "RECTILINEAR_ROUTING"; //$NON-NLS-1$

	public static final String OBLIQUE_ROUTING = "OBLIQUE_ROUTING"; //$NON-NLS-1$

	public static final String TO_PROVIDER = "to provider"; //$NON-NLS-1$

    public Class getModelClass() {
        return BridgePointPreferencesModel.class;
    }

    public void saveModel(IPreferenceStore store, IPreferenceModel model) {
        if (!(model instanceof BridgePointPreferencesModel)) {
            throw new IllegalArgumentException("Cannot save instance of " + model.getClass().getName());
        }

        BridgePointPreferencesModel prefs = (BridgePointPreferencesModel) model;

        store.setValue(PARSE_ALL_ON_RESOURCE_CHANGE, prefs.parseAllOnResourceChange);
        store.setValue(ALLOW_INT_TO_REAL_PROMOTION, prefs.allowIntToRealPromotion);
        store.setValue(ALLOW_REAL_TO_INT_COERCION, prefs.allowRealToIntCoercion);
        store.setValue(ALLOW_IMPLICIT_COMPONENT_ADDRESSING, prefs.allowImplicitComponentAddressing);
        store.setValue(ALLOW_OPERATIONS_IN_WHERE, prefs.allowOperationsInWhere);
        store.setValue(ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE, prefs.enableErrorForEmptySynchronousMessage);
        store.setValue(ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED, prefs.enableErrorForEmptySynchronousMessageRealized);
        store.setValue(DISABLE_GRADIENTS, prefs.disableGradients);
        store.setValue(INVERT_GRADIENTS, prefs.invertGradients);
        store.setValue(GRADIENT_BASE_COLOR, prefs.gradientBaseColor);
        store.setValue(EXPORT_OAL, prefs.exportOAL);
        store.setValue(EXPORT_GRAPHICS, prefs.exportGraphics);
        store.setValue(MESSAGE_DIRECTION, prefs.messageDirection);
        store.setValue(SHOW_TRANSITION_ACTIONS, prefs.showTransitionActions);
        store.setValue(SHOW_EVENT_PARAMETERS, prefs.showEventParameters);
        store.setValue(ENABLE_FIXED_LENGTH_ARRAYS, prefs.enableFLAs);
        store.setValue(ENABLE_DYNAMICALLY_SIZED_ARRAYS, prefs.enableDSAs);
        store.setValue(ENABLE_DETERMINISTIC_VERIFIER, prefs.enableDeterministicVerifier);
        store.setValue(ENABLE_INSTANCE_REFERENCES, prefs.enableInstanceReferences);

        store.setValue(ENABLE_VERIFIER_AUDIT, prefs.enableVerifierAudit);
        store.setValue(ENABLE_SELECT_AUDIT, prefs.enableSelectAudit);
        store.setValue(ENABLE_RELATE_AUDIT, prefs.enableRelateAudit);
        store.setValue(ENABLE_UNRELATE_AUDIT, prefs.enableUnrelateAudit);
        store.setValue(ENABLE_DELETE_AUDIT, prefs.enableDeleteAudit);
        store.setValue(START_UP_TIME, prefs.startUpTime);

        store.setValue(SHOW_GRID, prefs.showGrid);
        store.setValue(SNAP_TO_GRID, prefs.snapToGrid);
        store.setValue(GRID_SPACING, prefs.gridSpacing);
        store.setValue(DEFAULT_ROUTING_STYLE, prefs.defaultRoutingStyle);
        store.setValue(EMIT_RTO_DATA, prefs.emitRTOData);
        store.setValue(SHOW_SYNC_DELETION_DIALOG, prefs.showReferenceRemovalDialog);
        store.setValue(SHOW_SYNC_REPORT, prefs.showReferenceSyncReport);
        store.setValue(USE_DEFAULT_NAME_FOR_CREATION, prefs.useDefaultNamesForNewModelElements);
    }

    public IPreferenceModel loadModel(IPreferenceStore store, BasePlugin plugin, IPreferenceModel model) {
        BridgePointPreferencesModel prefs = null;

        if (model == null)
            prefs = new BridgePointPreferencesModel();
        else {
            if (!(model instanceof BridgePointPreferencesModel)) {
                throw new IllegalArgumentException("Cannot load instance of " + model.getClass().getName());
            }
            prefs = (BridgePointPreferencesModel) model;
        }

        prefs.parseAllOnResourceChange =
            store.getString(BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE);
        prefs.allowIntToRealPromotion =
            store.getString(BridgePointPreferencesStore.ALLOW_INT_TO_REAL_PROMOTION);
        prefs.allowRealToIntCoercion =
            store.getString(BridgePointPreferencesStore.ALLOW_REAL_TO_INT_COERCION);
        prefs.allowImplicitComponentAddressing =
            store.getBoolean(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING);
        prefs.allowOperationsInWhere =
            store.getBoolean(BridgePointPreferencesStore.ALLOW_OPERATIONS_IN_WHERE);
		prefs.enableErrorForEmptySynchronousMessage = store
				.getBoolean(BridgePointPreferencesStore.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE);
		prefs.enableErrorForEmptySynchronousMessageRealized = store
				.getBoolean(BridgePointPreferencesStore.ENABLE_ERROR_FOR_EMPTY_SYNCHRONOUS_MESSAGE_REALIZED);
        prefs.disableGradients =
            store.getBoolean(BridgePointPreferencesStore.DISABLE_GRADIENTS);
        prefs.invertGradients =
            store.getBoolean(BridgePointPreferencesStore.INVERT_GRADIENTS);
        prefs.gradientBaseColor =
            store.getLong(BridgePointPreferencesStore.GRADIENT_BASE_COLOR);
        if ( prefs.gradientBaseColor == 0L ) {
            prefs.gradientBaseColor = 0xc8c8c8;
        }
        prefs.exportOAL =
            store.getString(BridgePointPreferencesStore.EXPORT_OAL);
        prefs.exportGraphics =
            store.getString(BridgePointPreferencesStore.EXPORT_GRAPHICS);
        prefs.messageDirection =
            store.getString(BridgePointPreferencesStore.MESSAGE_DIRECTION);
        prefs.showTransitionActions =
            store.getBoolean(BridgePointPreferencesStore.SHOW_TRANSITION_ACTIONS);
        prefs.showEventParameters =
            store.getBoolean(BridgePointPreferencesStore.SHOW_EVENT_PARAMETERS);

    	prefs.enableFLAs =
    		store.getBoolean(BridgePointPreferencesStore.ENABLE_FIXED_LENGTH_ARRAYS);
        prefs.enableDSAs =
            store.getBoolean(BridgePointPreferencesStore.ENABLE_DYNAMICALLY_SIZED_ARRAYS);

        prefs.enableDeterministicVerifier =
            store.getBoolean(BridgePointPreferencesStore.ENABLE_DETERMINISTIC_VERIFIER);

        prefs.enableInstanceReferences =
            store.getBoolean(BridgePointPreferencesStore.ENABLE_INSTANCE_REFERENCES);

        prefs.enableVerifierAudit =
          store.getBoolean(BridgePointPreferencesStore.ENABLE_VERIFIER_AUDIT);
        prefs.enableSelectAudit =
          store.getInt(BridgePointPreferencesStore.ENABLE_SELECT_AUDIT);
        prefs.enableRelateAudit =
          store.getInt(BridgePointPreferencesStore.ENABLE_RELATE_AUDIT);
        prefs.enableUnrelateAudit =
          store.getInt(BridgePointPreferencesStore.ENABLE_UNRELATE_AUDIT);
        prefs.enableDeleteAudit =
          store.getInt(BridgePointPreferencesStore.ENABLE_DELETE_AUDIT);
        prefs.startUpTime =
          store.getInt(BridgePointPreferencesStore.START_UP_TIME);

        prefs.showGrid = store.getBoolean(BridgePointPreferencesStore.SHOW_GRID);
        prefs.snapToGrid = store.getBoolean(BridgePointPreferencesStore.SNAP_TO_GRID);
        prefs.gridSpacing = store.getInt(BridgePointPreferencesStore.GRID_SPACING);
        prefs.defaultRoutingStyle = store.getString(BridgePointPreferencesStore.DEFAULT_ROUTING_STYLE);
        prefs.emitRTOData = store.getBoolean(BridgePointPreferencesStore.EMIT_RTO_DATA);
        prefs.showReferenceRemovalDialog = store.getBoolean(BridgePointPreferencesStore.SHOW_SYNC_DELETION_DIALOG);
        prefs.showReferenceSyncReport = store.getBoolean(BridgePointPreferencesStore.SHOW_SYNC_REPORT);

        prefs.useDefaultNamesForNewModelElements =
            store.getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION);

        return prefs;
    }

    public void restoreModelDefaults(IPreferenceModel model) {

        if (model == null)
            throw new IllegalArgumentException("Cannot restore a null model");
        else if (!(model instanceof BridgePointPreferencesModel)) {
            throw new IllegalArgumentException("Cannot load instance of " + model.getClass().getName());
        }

        BridgePointPreferencesModel prefs = (BridgePointPreferencesModel) model;

        prefs.parseAllOnResourceChange = MessageDialogWithToggle.NEVER;
        prefs.allowIntToRealPromotion = MessageDialogWithToggle.ALWAYS;
        prefs.allowRealToIntCoercion = MessageDialogWithToggle.ALWAYS;
        prefs.allowImplicitComponentAddressing = false;
        prefs.allowOperationsInWhere = false;
        prefs.enableErrorForEmptySynchronousMessage = true;
        prefs.enableErrorForEmptySynchronousMessageRealized = false;
        prefs.disableGradients = true;
        prefs.invertGradients = false;
        prefs.gradientBaseColor = 0xc8c8c8;
        prefs.showTransitionActions = false;
        prefs.showEventParameters = true;
        prefs.enableFLAs = true;
        prefs.enableDSAs = true;
        prefs.enableInstanceReferences = true;
        prefs.emitRTOData = true;
        prefs.exportOAL = MessageDialogWithToggle.NEVER;
        prefs.exportGraphics = MessageDialogWithToggle.ALWAYS;
        prefs.messageDirection = TO_PROVIDER;

        prefs.enableVerifierAudit = false;
        prefs.enableSelectAudit = 1;
        prefs.enableRelateAudit = 1;
        prefs.enableUnrelateAudit = 1;
        prefs.enableDeleteAudit = 1;

        prefs.startUpTime = 5;

        prefs.showGrid = false;
        prefs.snapToGrid = true;
        prefs.gridSpacing = 12;
        prefs.defaultRoutingStyle = OBLIQUE_ROUTING;
        prefs.enableDeterministicVerifier = true;
        prefs.showReferenceRemovalDialog = true;
        prefs.showReferenceSyncReport = true;
        prefs.useDefaultNamesForNewModelElements = false;
    }
}


text:
package org.apache.apex.malhar.python;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import org.apache.apex.malhar.python.base.ApexPythonEngine;
import org.apache.apex.malhar.python.base.ApexPythonInterpreterException;
import org.apache.apex.malhar.python.base.BasePythonExecutionOperator;
import org.apache.apex.malhar.python.base.PythonInterpreterConfig;
import org.apache.apex.malhar.python.base.WorkerExecutionMode;
import org.apache.apex.malhar.python.base.jep.SpinPolicy;
import org.apache.apex.malhar.python.base.requestresponse.PythonInterpreterRequest;
import org.apache.apex.malhar.python.base.requestresponse.PythonRequestResponse;
import org.apache.apex.malhar.python.base.util.NDimensionalArray;
import org.apache.apex.malhar.python.base.util.PythonRequestResponseUtil;

public class SimplePythonOpOperator extends BasePythonExecutionOperator<PythonProcessingPojo>
{
  private Map<String,PythonRequestResponse<NDimensionalArray>> lastKnownResponse;

  @Override
  public Map<PythonInterpreterConfig, Object> getPreInitConfigurations()
  {
    Map<PythonInterpreterConfig,Object> preInitConfigs = new HashMap<>();
    Set<String> sharedLibsList = new HashSet<>();
    sharedLibsList.add("numpy");
    preInitConfigs.put(PythonInterpreterConfig.PYTHON_SHARED_LIBS, sharedLibsList);
    // Next two configs allow for a very low latency mode wherein the cost of CPU is sacrificed for low latencies
    // Defaults are saner and the following config is overriding
    preInitConfigs.put(PythonInterpreterConfig.IDLE_INTERPRETER_SPIN_POLICY, "" + SpinPolicy.BUSY_SPIN.name());
    preInitConfigs.put(PythonInterpreterConfig.REQUEST_QUEUE_WAIT_SPIN_POLICY,
        com.conversantmedia.util.concurrent.SpinPolicy.SPINNING);
    return preInitConfigs;
  }

  @Override
  public PythonRequestResponse processPythonCodeForIncomingTuple(PythonProcessingPojo input, ApexPythonEngine pythonEngineRef)
    throws ApexPythonInterpreterException
  {
    Map<String,Object> evalParams = new HashMap<>();
    evalParams.put("intArrayToAdd",input.getNumpyIntArray());
    evalParams.put("floatArrayToAdd",input.getNumpyFloatArray());
    // Not assigning to any var as this results in output printed on the console which can be a validation of redirect
    String evalCommand = "npval=np.add(intMatrix,intArrayToAdd)";
    //String evalCommand = "print(type(intArrayToAdd))";
    PythonInterpreterRequest<NDimensionalArray> request = PythonRequestResponseUtil.buildRequestForEvalCommand(
        evalCommand,evalParams,"intMatrix",false, 20,
        TimeUnit.MILLISECONDS, NDimensionalArray.class);
    lastKnownResponse = pythonEngineRef.eval(
        WorkerExecutionMode.ANY,currentWindowId, requestCounterForThisWindow,request);
    for ( String evalCommandSubmitted: lastKnownResponse.keySet()) {
      return lastKnownResponse.get(evalCommandSubmitted); // we just need one of the N workers response.
    }
    return null;
  }

  @Override
  public void processPostSetUpPythonInstructions(ApexPythonEngine pythonEngineRef) throws ApexPythonInterpreterException
  {
    List<String> commandsToRun = new ArrayList<>();
    commandsToRun.add("import sys");
    commandsToRun.add("import numpy as np");
    commandsToRun.add("intMatrix = np.ones((2,2),dtype=int)");
    commandsToRun.add("floatMatrix = np.ones((2,2),dtype=float)");
    pythonEngineRef.runCommands(WorkerExecutionMode.BROADCAST,0L,0L,
        PythonRequestResponseUtil.buildRequestObjectForRunCommands(commandsToRun,1, TimeUnit.SECONDS));
  }

  public Map<String, PythonRequestResponse<NDimensionalArray>> getLastKnownResponse()
  {
    return lastKnownResponse;
  }

  public void setLastKnownResponse(Map<String, PythonRequestResponse<NDimensionalArray>> lastKnownResponse)
  {
    this.lastKnownResponse = lastKnownResponse;
  }
}


text:
typedef struct pci_ident {
    uint32_t class, class_mask; //class << 24 | subclass << 16 | progif << 8 | revision
    uint16_t vendor, device;
} pci_ident_t;

typedef struct pci_loc {
    uint8_t bus, device, function;
} pci_loc_t;

typedef struct pci_device {
    device_t device;
    pci_ident_t ident;
    pci_loc_t loc;
    volatile uint8_t interrupt;
    uint32_t bar[6];
} pci_device_t;

typedef struct pci_driver {
    driver_t driver;
    pci_ident_t *supported;
    uint32_t supported_len;
} pci_driver_t;

extern bus_t pci_bus;

uint32_t pci_readl(pci_loc_t loc, uint16_t offset);
uint16_t pci_readw(pci_loc_t loc, uint16_t offset);
uint8_t pci_readb(pci_loc_t loc, uint16_t offset);

void pci_writel(pci_loc_t loc, uint16_t offset, uint32_t val);

#endif


text:
<?php

namespace Application\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * NmtInventorySerial
 *
 * @ORM\Table(name="nmt_inventory_serial", uniqueConstraints={@ORM\UniqueConstraint(name="serial_number_UNIQUE", columns={"serial_number"})}, indexes={@ORM\Index(name="nmt_inventory_serial_FK1_idx", columns={"created_by"}), @ORM\Index(name="nmt_inventory_serial_FK2_idx", columns={"lastchange_by"}), @ORM\Index(name="nmt_inventory_serial_FK3_idx", columns={"item_id"})})
 * @ORM\Entity
 */
class NmtInventorySerial
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="token", type="string", length=45, nullable=true)
     */
    private $token;

    /**
     * @var string
     *
     * @ORM\Column(name="serial_number", type="string", length=45, nullable=true)
     */
    private $serialNumber;

    /**
     * @var boolean
     *
     * @ORM\Column(name="is_active", type="boolean", nullable=true)
     */
    private $isActive;

    /**
     * @var string
     *
     * @ORM\Column(name="remarks", type="string", length=255, nullable=true)
     */
    private $remarks;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created_on", type="datetime", nullable=true)
     */
    private $createdOn;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="consumed_on", type="datetime", nullable=true)
     */
    private $consumedOn;

    /**
     * @var string
     *
     * @ORM\Column(name="mfg_serial_number", type="string", length=45, nullable=true)
     */
    private $mfgSerialNumber;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="mfg_date", type="datetime", nullable=true)
     */
    private $mfgDate;

    /**
     * @var string
     *
     * @ORM\Column(name="lot_number", type="string", length=45, nullable=true)
     */
    private $lotNumber;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="mfg_warranty_start", type="datetime", nullable=true)
     */
    private $mfgWarrantyStart;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="mfg_warranty_end", type="datetime", nullable=true)
     */
    private $mfgWarrantyEnd;

    /**
     * @var string
     *
     * @ORM\Column(name="item_name", type="string", length=100, nullable=true)
     */
    private $itemName;

    /**
     * @var string
     *
     * @ORM\Column(name="location", type="string", length=45, nullable=true)
     */
    private $location;

    /**
     * @var string
     *
     * @ORM\Column(name="category", type="string", length=45, nullable=true)
     */
    private $category;

    /**
     * @var string
     *
     * @ORM\Column(name="mfg_name", type="string", length=100, nullable=true)
     */
    private $mfgName;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="lastchange_on", type="datetime", nullable=true)
     */
    private $lastchangeOn;

    /**
     * @var integer
     *
     * @ORM\Column(name="revision_no", type="integer", nullable=true)
     */
    private $revisionNo;

    /**
     * @var \Application\Entity\MlaUsers
     *
     * @ORM\ManyToOne(targetEntity="Application\Entity\MlaUsers")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="created_by", referencedColumnName="id")
     * })
     */
    private $createdBy;

    /**
     * @var \Application\Entity\MlaUsers
     *
     * @ORM\ManyToOne(targetEntity="Application\Entity\MlaUsers")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="lastchange_by", referencedColumnName="id")
     * })
     */
    private $lastchangeBy;

    /**
     * @var \Application\Entity\NmtInventoryItem
     *
     * @ORM\ManyToOne(targetEntity="Application\Entity\NmtInventoryItem")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="item_id", referencedColumnName="id")
     * })
     */
    private $item;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set token
     *
     * @param string $token
     *
     * @return NmtInventorySerial
     */
    public function setToken($token)
    {
        $this->token = $token;

        return $this;
    }

    /**
     * Get token
     *
     * @return string
     */
    public function getToken()
    {
        return $this->token;
    }

    /**
     * Set serialNumber
     *
     * @param string $serialNumber
     *
     * @return NmtInventorySerial
     */
    public function setSerialNumber($serialNumber)
    {
        $this->serialNumber = $serialNumber;

        return $this;
    }

    /**
     * Get serialNumber
     *
     * @return string
     */
    public function getSerialNumber()
    {
        return $this->serialNumber;
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return NmtInventorySerial
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Set remarks
     *
     * @param string $remarks
     *
     * @return NmtInventorySerial
     */
    public function setRemarks($remarks)
    {
        $this->remarks = $remarks;

        return $this;
    }

    /**
     * Get remarks
     *
     * @return string
     */
    public function getRemarks()
    {
        return $this->remarks;
    }

    /**
     * Set createdOn
     *
     * @param \DateTime $createdOn
     *
     * @return NmtInventorySerial
     */
    public function setCreatedOn($createdOn)
    {
        $this->createdOn = $createdOn;

        return $this;
    }

    /**
     * Get createdOn
     *
     * @return \DateTime
     */
    public function getCreatedOn()
    {
        return $this->createdOn;
    }

    /**
     * Set consumedOn
     *
     * @param \DateTime $consumedOn
     *
     * @return NmtInventorySerial
     */
    public function setConsumedOn($consumedOn)
    {
        $this->consumedOn = $consumedOn;

        return $this;
    }

    /**
     * Get consumedOn
     *
     * @return \DateTime
     */
    public function getConsumedOn()
    {
        return $this->consumedOn;
    }

    /**
     * Set mfgSerialNumber
     *
     * @param string $mfgSerialNumber
     *
     * @return NmtInventorySerial
     */
    public function setMfgSerialNumber($mfgSerialNumber)
    {
        $this->mfgSerialNumber = $mfgSerialNumber;

        return $this;
    }

    /**
     * Get mfgSerialNumber
     *
     * @return string
     */
    public function getMfgSerialNumber()
    {
        return $this->mfgSerialNumber;
    }

    /**
     * Set mfgDate
     *
     * @param \DateTime $mfgDate
     *
     * @return NmtInventorySerial
     */
    public function setMfgDate($mfgDate)
    {
        $this->mfgDate = $mfgDate;

        return $this;
    }

    /**
     * Get mfgDate
     *
     * @return \DateTime
     */
    public function getMfgDate()
    {
        return $this->mfgDate;
    }

    /**
     * Set lotNumber
     *
     * @param string $lotNumber
     *
     * @return NmtInventorySerial
     */
    public function setLotNumber($lotNumber)
    {
        $this->lotNumber = $lotNumber;

        return $this;
    }

    /**
     * Get lotNumber
     *
     * @return string
     */
    public function getLotNumber()
    {
        return $this->lotNumber;
    }

    /**
     * Set mfgWarrantyStart
     *
     * @param \DateTime $mfgWarrantyStart
     *
     * @return NmtInventorySerial
     */
    public function setMfgWarrantyStart($mfgWarrantyStart)
    {
        $this->mfgWarrantyStart = $mfgWarrantyStart;

        return $this;
    }

    /**
     * Get mfgWarrantyStart
     *
     * @return \DateTime
     */
    public function getMfgWarrantyStart()
    {
        return $this->mfgWarrantyStart;
    }

    /**
     * Set mfgWarrantyEnd
     *
     * @param \DateTime $mfgWarrantyEnd
     *
     * @return NmtInventorySerial
     */
    public function setMfgWarrantyEnd($mfgWarrantyEnd)
    {
        $this->mfgWarrantyEnd = $mfgWarrantyEnd;

        return $this;
    }

    /**
     * Get mfgWarrantyEnd
     *
     * @return \DateTime
     */
    public function getMfgWarrantyEnd()
    {
        return $this->mfgWarrantyEnd;
    }

    /**
     * Set itemName
     *
     * @param string $itemName
     *
     * @return NmtInventorySerial
     */
    public function setItemName($itemName)
    {
        $this->itemName = $itemName;

        return $this;
    }

    /**
     * Get itemName
     *
     * @return string
     */
    public function getItemName()
    {
        return $this->itemName;
    }

    /**
     * Set location
     *
     * @param string $location
     *
     * @return NmtInventorySerial
     */
    public function setLocation($location)
    {
        $this->location = $location;

        return $this;
    }

    /**
     * Get location
     *
     * @return string
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * Set category
     *
     * @param string $category
     *
     * @return NmtInventorySerial
     */
    public function setCategory($category)
    {
        $this->category = $category;

        return $this;
    }

    /**
     * Get category
     *
     * @return string
     */
    public function getCategory()
    {
        return $this->category;
    }

    /**
     * Set mfgName
     *
     * @param string $mfgName
     *
     * @return NmtInventorySerial
     */
    public function setMfgName($mfgName)
    {
        $this->mfgName = $mfgName;

        return $this;
    }

    /**
     * Get mfgName
     *
     * @return string
     */
    public function getMfgName()
    {
        return $this->mfgName;
    }

    /**
     * Set lastchangeOn
     *
     * @param \DateTime $lastchangeOn
     *
     * @return NmtInventorySerial
     */
    public function setLastchangeOn($lastchangeOn)
    {
        $this->lastchangeOn = $lastchangeOn;

        return $this;
    }

    /**
     * Get lastchangeOn
     *
     * @return \DateTime
     */
    public function getLastchangeOn()
    {
        return $this->lastchangeOn;
    }

    /**
     * Set revisionNo
     *
     * @param integer $revisionNo
     *
     * @return NmtInventorySerial
     */
    public function setRevisionNo($revisionNo)
    {
        $this->revisionNo = $revisionNo;

        return $this;
    }

    /**
     * Get revisionNo
     *
     * @return integer
     */
    public function getRevisionNo()
    {
        return $this->revisionNo;
    }

    /**
     * Set createdBy
     *
     * @param \Application\Entity\MlaUsers $createdBy
     *
     * @return NmtInventorySerial
     */
    public function setCreatedBy(\Application\Entity\MlaUsers $createdBy = null)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return \Application\Entity\MlaUsers
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set lastchangeBy
     *
     * @param \Application\Entity\MlaUsers $lastchangeBy
     *
     * @return NmtInventorySerial
     */
    public function setLastchangeBy(\Application\Entity\MlaUsers $lastchangeBy = null)
    {
        $this->lastchangeBy = $lastchangeBy;

        return $this;
    }

    /**
     * Get lastchangeBy
     *
     * @return \Application\Entity\MlaUsers
     */
    public function getLastchangeBy()
    {
        return $this->lastchangeBy;
    }

    /**
     * Set item
     *
     * @param \Application\Entity\NmtInventoryItem $item
     *
     * @return NmtInventorySerial
     */
    public function setItem(\Application\Entity\NmtInventoryItem $item = null)
    {
        $this->item = $item;

        return $this;
    }

    /**
     * Get item
     *
     * @return \Application\Entity\NmtInventoryItem
     */
    public function getItem()
    {
        return $this->item;
    }
}