text:
@interface JLModuleViewController ()
@property (nonatomic,strong) NSMutableArray *modules;
@property (nonatomic,strong) NSMutableArray *showingModules;
@property (nonatomic,strong) NSMutableDictionary *showingSectionHeaderModules;
@property (nonatomic,strong) NSMutableDictionary *showingSectionFooterModules;
@property (nonatomic,strong) NSArray *moduleNames;
@end

@implementation JLModuleViewController
@synthesize viewModel = _viewModel;

- (instancetype)initWithStyle:(UITableViewStyle)style
{
    if (self = [super init]) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:style];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _moduleNames = [self setupModuleNames];
        _modules     = [[NSMutableArray alloc] init];
        _showingSectionHeaderModules     = [[NSMutableDictionary alloc] init];
        _showingSectionFooterModules     = [[NSMutableDictionary alloc] init];
    }
    return self;
}

- (instancetype)initWithStyle:(UITableViewStyle)style withViewModel:(id)viewModel
{
    if (self = [super init]) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:style];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _viewModel = viewModel;
        _moduleNames = [self setupModuleNames];
        _modules     = [[NSMutableArray alloc] init];
        _showingSectionHeaderModules     = [[NSMutableDictionary alloc] init];
        _showingSectionFooterModules     = [[NSMutableDictionary alloc] init];
    }
    return self;
}

- (instancetype)init
{
    return [self initWithStyle:UITableViewStyleGrouped];
}

- (instancetype)initWithViewModel:(id)viewModel
{
    return [self initWithStyle:UITableViewStyleGrouped withViewModel:viewModel];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    self.tableView.frame = self.view.frame;
    for (NSArray *nameSection in self.moduleNames) {
        NSMutableArray *muduleSection = [[NSMutableArray alloc] init];
        for (Class class in nameSection) {
            JLBaseModule *module = [[class alloc] init];
            module.moduleContainer = self;
            [module onStart];
            [muduleSection addObject:module];
        }
        [self.modules addObject:muduleSection];
    }
    [self reloadModules];
}

- (NSArray *)setupModuleNames
{
    return @[];
}

- (void)reloadModules
{
    self.showingModules = [[NSMutableArray alloc] init];
    self.showingSectionHeaderModules     = [[NSMutableDictionary alloc] init];
    self.showingSectionFooterModules     = [[NSMutableDictionary alloc] init];
    NSInteger sectionIndex = 0;
    for (NSArray *secion in self.modules) {
        NSMutableArray *showingSection = [[NSMutableArray alloc] init];
        BOOL hasSectionHeaderOrFooter = NO;
        for (JLBaseModule  *module in secion) {
            if (module.commonViewModel == nil && self.viewModel != nil) {
                [module setCommonViewModel:self.viewModel];
                [module didSetViewModel];

            }
            if ([module shouldShow]) {
                if ([module isHeader]) {//section header
                    hasSectionHeaderOrFooter = YES;
                    [self.showingSectionHeaderModules setObject:module forKey:[NSString stringWithFormat:@"header@%@",@(sectionIndex)]];
                }else if([module isFooter]){//section footer
                    hasSectionHeaderOrFooter = YES;
                    [self.showingSectionFooterModules setObject:module forKey:[NSString stringWithFormat:@"footer@%@",@(sectionIndex)]];
                }else{//section cell
                    for (NSInteger i = 0; i < [module numberOfRows]; i ++) {
                        [showingSection addObject:module];
                    }
                }
            }
        }
        if (showingSection.count > 0 || hasSectionHeaderOrFooter) {
            [self.showingModules addObject:showingSection];
        }
        sectionIndex ++;
    }
    [self.tableView reloadData];
}

- (JLBaseModule *)moduleFromeClase:(Class)moduleClass
{
    JLBaseModule *module = [[moduleClass alloc] init];
    return module;
}

- (void)sendMsg:(id)msg to:(Class)receiver callBack:(void (^)(id))callBack
{
    for (NSArray *secion in self.modules) {
        for (JLBaseModule *m in secion) {
            if ([m isKindOfClass:receiver]) {
                [m getMsg:msg reply:callBack];
                break;
            }
        }
    }
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return self.showingModules.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.showingModules[section] count];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    JLBaseModule *module = [self.showingSectionHeaderModules objectForKey:[NSString stringWithFormat:@"header@%@",@(section)]];
    return [module headerOrFooterViewForSection:section];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    JLBaseModule *module = self.showingModules[indexPath.section][indexPath.row];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[module reuseIdentifier:indexPath]];
    if (cell == nil) {
        cell = [module cellForIndexPath:indexPath];
    }
    [module didAddCell:cell forIndexPath:indexPath];
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    JLBaseModule *module = [self.showingSectionFooterModules objectForKey:[NSString stringWithFormat:@"footer@%@",@(section)]];
    return [module headerOrFooterViewForSection:section];
}

#pragma mark - Table view data delegate

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    JLBaseModule *module = self.showingModules[indexPath.section][indexPath.row];
    return [module height:indexPath];
}

- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    JLBaseModule *module = [self.showingSectionHeaderModules objectForKey:[NSString stringWithFormat:@"header@%@",@(section)]];
    if (module == nil) {
        return 20;
    }
    return [module headerOrFooterViewHeightForSection:section];
}

- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    JLBaseModule *module = [self.showingSectionFooterModules objectForKey:[NSString stringWithFormat:@"footer@%@",@(section)]];
    if (module == nil) {
        return 0.1;
    }
    return [module headerOrFooterViewHeightForSection:section];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    JLBaseModule *module = self.showingModules[indexPath.section][indexPath.row];
    [module didSelect:indexPath];
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    JLBaseModule *module = self.showingModules[indexPath.section][indexPath.row];
    [module willDisplayCell:cell forIndexPath:indexPath];
}
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath
{
    //    IABaseModule *module = self.showingModules[indexPath.section][indexPath.row];
    //    [module didEndDisplayingCell:cell forIndexPath:indexPath];
}

@end


text:
"""RPC XML base parser.

Contains base parser for SDLRPC v1/v2 and JSON RPC XML format.

"""

import collections
import xml.etree.ElementTree

from generator import Model

class ParseError(Exception):

    """Parse error.

    This exception is raised when XML contains errors and can't be parsed.

    """

    pass

class Parser(object):

    """RPC XML Parser base.

    This class must not be used directly. One of its subclasses must be used
    instead.

    """

    def __init__(self):
        """Constructor."""
        self._types = {}
        self._enums = collections.OrderedDict()
        self._structs = collections.OrderedDict()
        self._functions = collections.OrderedDict()
        self._params = {}

    def parse(self, filename):
        """Parse XML.

        Returns an instance of generator.Model.Interface containing parsed
        interface or raises ParseError if input XML contains errors
        and can't be parsed.

        Keyword arguments:
        filename -- name of input XML file.

        """

        tree = xml.etree.ElementTree.parse(filename)
        root = tree.getroot()

        self._enums = self._initialize_enums()
        self._structs = collections.OrderedDict()
        self._functions = collections.OrderedDict()
        self._params = {}

        self._types = dict(self._enums.items())

        self._parse_root(root)

        return Model.Interface(enums=self._enums, structs=self._structs,
                               functions=self._functions, params=self._params)

    def _initialize_enums(self):
        """Initialize enums.

        The default implementation returns an OrderedDict with two empty
        enums: "FunctionID" and "messageType". Required for formats where
        these enums must be generated automatically according to the declared
        in the XML functions.

        These enums are filled during the parsing of the functions.

        """
        return collections.OrderedDict(
            [("FunctionID", Model.Enum(name="FunctionID")),
             ("messageType", Model.Enum(name="messageType"))])

    def _check_enum_name(self, enum):
        """Check enum name.

        This method is called to check whether the newly parsed enum's name
        conflicts with some predefined enum.

        This implementation raises an error if enum name is one of the
        predefined enums "FunctionID" or "messageType" which must not be
        declared explicitly in the XML.

        """
        if enum.name in ["FunctionID", "messageType"]:
            raise ParseError(
                "Enum '" + enum.name +
                "' is generated automatically in SDLRPCV1 and"
                " must not be declared in xml file")

    def _check_function_param_name(self, function_param_name):
        """Check function param name.

        This method is called to check whether the newly parsed function
        parameter name conflicts with some predefined name.

        This implementation doesn't check anything because there is no
        predefined names in base RPC XML.
        """

        pass

    def _parse_root(self, root):
        """Parse root XML element.

        Default implementation parses root as interface element without a
        prefix.

        Keyword arguments:
        root -- root element.

        """

        self._parse_interface(root, "")

    def _parse_interface(self, interface, prefix):
        """Parse interface element.

        Keyword arguments:
        interface -- interface element.
        prefix -- string prefix for all types of the interface.

        """
        if interface.tag != "interface":
            raise ParseError("Invalid interface tag: " + interface.tag)

        params, subelements, attrib = self._parse_base_item(interface, "")

        for param in ["description", "design_description", "todos"]:
            if 0 != len(params[param]):
                attrib[param] = "\n".join(params[param])

        if 0 != len(params["issues"]):
            attrib["issues"] = "\n".join(i.value for i in params["issues"])

        self._params = dict(
            self._params.items() +
            [(prefix + p[0], p[1]) for p in attrib.items()])

        for element in subelements:
            if element.tag == "enum":
                enum = self._parse_enum(element, prefix)
                self._check_enum_name(enum)
                self._add_item(self._enums, enum)
                self._add_type(enum)
            elif element.tag == "struct":
                struct = self._parse_struct(element, prefix)
                self._add_item(self._structs, struct)
                self._add_type(struct)
            elif element.tag == "function":
                function = self._parse_function(element, prefix)
                self._add_item(self._functions, function,
                               (function.function_id, function.message_type))
            else:
                raise ParseError("Unexpected element: " + element.tag)

    @staticmethod
    def _add_item(items, item, key=None):
        """Add new item in the items dictionary with given key.

        Performs additional check for presence in the dictionary and throws
        ParseError exception if key already exist.

        """
        if key is None:
            key = item.name

        if key in items:
            raise ParseError(type(item).__name__ + " '" + str(key) +
                             "' is declared more than once")
        items[key] = item

    def _add_type(self, _type):
        """Add new type in the internal types dictionary.

        Performs additional check for presence type with same name in the
        dictionary and throws ParseError exception if key already exist.

        """
        if _type.name in self._types:
            raise ParseError("Type '" + _type.name +
                             "' is declared as both struct and enum")

        self._types[_type.name] = _type

    def _parse_enum(self, element, prefix):
        """Parse element as enumeration.

        Returns an instance of generator.Model.Enum

        """
        params, subelements, attributes = \
            self._parse_base_item(element, prefix)

        internal_scope = None
        scope = None
        for attribute in attributes:
            if attribute == "internal_scope":
                internal_scope = attributes[attribute]
            elif attribute == "scope":
                scope = attributes[attribute]
            else:
                raise ParseError("Unexpected attribute '" + attribute +
                                 "' in enum '" + params["name"] + "'")
        params["internal_scope"] = internal_scope
        params["scope"] = scope

        elements = collections.OrderedDict()
        for subelement in subelements:
            if subelement.tag == "element":
                self._add_item(elements, self._parse_enum_element(subelement))
            else:
                raise ParseError("Unexpected element '" + subelement.tag +
                                 "' in enum '" + params["name"] + "'")
        params["elements"] = elements

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.Enum(**params)

    def _parse_struct(self, element, prefix):
        """Parse element as structure.

        Returns an instance of generator.Model.Struct

        """
        params, subelements, attrib = self._parse_base_item(element, prefix)

        scope = None
        for attribute in attrib:
            if attribute == "scope":
                scope = attrib[attribute]
            else:
                raise ParseError("Unexpected attribute '" + attribute +
                                 "' in struct '" + params["name"] + "'")
        params["scope"] = scope

        members = collections.OrderedDict()
        for subelement in subelements:
            if subelement.tag == "param":
                self._add_item(members, self._parse_param(subelement, prefix))
            else:
                raise ParseError("Unexpected subelement '" + subelement.name +
                                 "' in struct '" + params["name"] + "'")
        params["members"] = members

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.Struct(**params)

    def _parse_function(self, element, prefix):
        """Parse element as function.

        Returns an instance of generator.Model.Function

        """
        params, subelements, attributes = \
            self._parse_base_item(element, prefix)

        function_id, message_type = self._parse_function_id_type(
            params["name"],
            attributes)

        scope = None
        for attribute in attributes:
            if attribute == "scope":
                scope = attributes[attribute]

        params["function_id"] = function_id
        params["message_type"] = message_type
        params["scope"] = scope

        function_params = collections.OrderedDict()
        for subelement in subelements:
            if subelement.tag == "param":
                function_param = self._parse_function_param(subelement,
                                                            prefix)
                self._check_function_param_name(function_param.name)
                if function_param.name in function_params:
                    raise ParseError("Parameter '" + function_param.name +
                                     "' is specified more than once" +
                                     " for function '" + params["name"] + "'")
                function_params[function_param.name] = function_param
            else:
                raise ParseError("Unexpected subelement '" + subelement.tag +
                                 "' in function '" + params["name"] + "'")
        params["params"] = function_params

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.Function(**params)

    def _parse_function_id_type(self, function_name, attrib):
        """Parse function id and message type according to XML format.

        This implementation takes function name as function id and extracts
        attribute "messagetype" as message type and searches them in enums
        "FunctionID" and "messageType" adding the missing elements if
        necessary.

        Returns function id and message type as an instances of EnumElement.

        """
        if "messagetype" not in attrib:
            raise ParseError("No messagetype specified for function '" +
                             function_name + "'")

        function_id = self._provide_enum_element_for_function(
            "FunctionID",
            function_name)

        message_type = self._provide_enum_element_for_function(
            "messageType",
            self._extract_attrib(attrib, "messagetype"))

        return function_id, message_type

    def _provide_enum_element_for_function(self, enum_name, element_name):
        """Provide enum element for functions.

        Search an element in an enum and add it if it is missing.

        Returns EnumElement.

        """
        if enum_name not in self._types:
            raise ParseError("Enum '" + enum_name +
                             "' is not initialized")

        enum = self._types[enum_name]

        if not isinstance(enum, Model.Enum):
            raise ParseError("'" + enum_name + "' is not an enum")

        if element_name not in enum.elements:
            enum.elements[element_name] = Model.EnumElement(name=element_name)

        return enum.elements[element_name]

    def _parse_base_item(self, element, prefix):
        """Parse element as base item.

        Returns an params, sub-elements and attributes of the element

        """
        params = {}

        description = []
        design_description = []
        issues = []
        todos = []
        subelements = []

        if "name" not in element.attrib:
            raise ParseError("Name is not specified for " + element.tag)

        params["name"] = prefix + element.attrib["name"]
        attrib = dict(element.attrib.items())
        del attrib["name"]

        params["platform"] = self._extract_attrib(attrib, "platform")

        for subelement in element:
            if subelement.tag == "description":
                description.append(self._parse_simple_element(subelement))
            elif subelement.tag == "designdescription":
                design_description.append(
                    self._parse_simple_element(subelement))
            elif subelement.tag == "todo":
                todos.append(self._parse_simple_element(subelement))
            elif subelement.tag == "issue":
                issues.append(self._parse_issue(subelement))
            else:
                subelements.append(subelement)

        params["description"] = description
        params["design_description"] = design_description
        params["issues"] = issues
        params["todos"] = todos

        return params, subelements, attrib

    @staticmethod
    def _parse_simple_element(element):
        """Parse element as simple element and returns it's text.

        Element is simple when it contains no subelements and attributes.

        Returns element text if present or empty string if not

        """
        if len(element) != 0:
            raise ParseError("Unexpected subelements in '" +
                             element.tag + "'")
        if len(element.attrib) != 0:
            raise ParseError("Unexpected attributes in '" +
                             element.tag + "'")
        return element.text if element.text is not None else ""

    @staticmethod
    def _parse_issue(element):
        """Parse element as issue.

        Issue must not contain subelements and attributes.

        Returns an instance of generator.Model.Issue

        """
        if len(element) != 0:
            raise ParseError("Unexpected subelements in issue")
        if "creator" not in element.attrib:
            raise ParseError("No creator in issue")
        if len(element.attrib) != 1:
            raise ParseError("Unexpected attributes in issue")

        return Model.Issue(
            creator=element.attrib["creator"],
            value=element.text if element.text is not None else "")

    def _parse_enum_element(self, element):
        """Parse element as element of enumeration.

        Returns an instance of generator.Model.EnumElement

        """
        params, subelements, attributes = self._parse_base_item(element, "")

        if len(subelements) != 0:
            raise ParseError("Unexpected subelements in enum element")

        self._ignore_attribute(attributes, "hexvalue")
        self._ignore_attribute(attributes, "scope")
        self._ignore_attribute(attributes, "rootscreen")

        internal_name = None
        value = None
        for attribute in attributes:
            if attribute == "internal_name":
                internal_name = attributes[attribute]
            elif attribute == "value":
                try:
                    value = int(attributes[attribute])
                except:
                    raise ParseError("Invalid value for enum element: '" +
                                     attributes[attribute] + "'")
        params["internal_name"] = internal_name
        params["value"] = value

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.EnumElement(**params)

    def _parse_param(self, element, prefix):
        """Parse element as structure parameter.

        Returns an instance of generator.Model.Param

        """
        params, subelements, attrib = \
            self._parse_param_base_item(element, prefix)

        if len(attrib) != 0:
            raise ParseError("""Unknown attribute(s) {0} in param {1}
                """.format(attrib, params["name"]))

        if len(subelements) != 0:
            raise ParseError("Unknown subelements in param '" +
                             params["name"] + "'")

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.Param(**params)

    def _parse_function_param(self, element, prefix):
        """Parse element as function parameter.

        Returns an instance of generator.Model.FunctionParam

        """
        params, subelements, attrib = \
            self._parse_param_base_item(element, prefix)

        default_value = None
        default_value_string = self._extract_attrib(attrib, "defvalue")
        if default_value_string is not None:
            param_type = params["param_type"]
            if type(param_type) is Model.Boolean:
                default_value = \
                    self._get_bool_from_string(default_value_string)
            elif type(param_type) is Model.Integer:
                try:
                    default_value = int(default_value_string)
                except:
                    raise ParseError("Invalid value for integer: '" +
                                     default_value_string + "'")
            elif type(param_type) is Model.Double:
                try:
                    default_value = float(default_value_string)
                except:
                    raise ParseError("Invalid value for float: '" +
                                     default_value_string + "'")
            elif type(param_type) is Model.String:
                default_value = default_value_string
            elif type(param_type) is Model.Enum or \
                    type(param_type) is Model.EnumSubset:
                if type(param_type) is Model.EnumSubset:
                    allowed_elements = param_type.allowed_elements
                else:
                    allowed_elements = param_type.elements
                if default_value_string not in allowed_elements:
                    raise ParseError("Default value '" + default_value_string +
                                     "' for parameter '" + params["name"] +
                                     "' is not a member of " +
                                     type(param_type).__name__ +
                                     "'" + params["name"] + "'")
                default_value = allowed_elements[default_value_string]
            else:
                raise ParseError("Default value specified for " +
                                 type(param_type).__name__)
        params["default_value"] = default_value

        if len(attrib) != 0:
            raise ParseError("Unexpected attributes in parameter '" +
                             params["name"] + "'")

        if len(subelements) != 0:
            raise ParseError("Unexpected subelements in parameter '" +
                             params["name"] + "'")

        # Magic usage is correct
        # pylint: disable=W0142
        return Model.FunctionParam(**params)

    def _parse_param_base_item(self, element, prefix):
        """Parse base param items.

        Returns params, other subelements and attributes.

        """
        params, subelements, attrib = self._parse_base_item(element, "")

        is_mandatory = self._extract_attrib(attrib, "mandatory")
        if is_mandatory is None:
            raise ParseError("'mandatory' is not specified for parameter '" +
                             params["name"] + "'")

        params["is_mandatory"] = self._get_bool_from_string(is_mandatory)

        scope = self._extract_attrib(attrib, "scope")
        if scope is not None:
            params["scope"] = scope

        default_value = None;
        param_type = None
        type_name = self._extract_attrib(attrib, "type")
        if type_name is None:
            raise ParseError("Type is not specified for parameter '" +
                             params["name"] + "'")
        if type_name == "Boolean":
            default_value = self._extract_attrib(
                attrib, "defvalue")
            if default_value != None:
                default_value = self._get_bool_from_string(default_value);
            param_type = Model.Boolean(default_value=default_value)
        elif type_name == "Integer" or \
                type_name == "Float" or \
                type_name == "Double" :
            min_value = self._extract_optional_number_attrib(
                attrib, "minvalue", int if type_name == "Integer" else float)
            max_value = self._extract_optional_number_attrib(
                attrib, "maxvalue", int if type_name == "Integer" else float)
            default_value = self._extract_optional_number_attrib(
                attrib, "defvalue", int if type_name == "Integer" else float)

            param_type = \
                (Model.Integer if type_name == "Integer" else Model.Double)(
                    min_value=min_value,
                    max_value=max_value,
                    default_value=default_value)
        elif type_name == "String":
            min_length = self._extract_optional_number_attrib(
                attrib, "minlength")
            # if minlength is not defined default value is 1
            if min_length is None:
                min_length = 1
            max_length = self._extract_optional_number_attrib(
                attrib, "maxlength")
            default_value = self._extract_attrib(attrib, "defvalue")
            param_type = Model.String(min_length=min_length, max_length=max_length, default_value=default_value)
        else:
            if 1 == type_name.count("."):
                custom_type_name = type_name.replace(".", "_")
            else:
                custom_type_name = prefix + type_name

            if custom_type_name in self._types:
                param_type = self._types[custom_type_name]
                default_value = self._extract_attrib(attrib, "defvalue")
                if default_value != None:
                    if default_value not in param_type.elements:
                        raise ParseError("Default value '" + default_value +
                                     "' for parameter '" + params["name"] +
                                     "' is not a member of " +
                                     type(param_type).__name__ +
                                     "'" + params["name"] + "'")
                    default_value = param_type.elements[default_value]
            else:
                raise ParseError("Unknown type '" + type_name + "'")

        if self._extract_optional_bool_attrib(attrib, "array", False):
            min_size = self._extract_optional_number_attrib(attrib,
                                                            "minsize")
            max_size = self._extract_optional_number_attrib(attrib,
                                                            "maxsize")
            param_type = Model.Array(element_type=param_type,
                                     min_size=min_size,
                                     max_size=max_size)

        base_type = \
            param_type.element_type if isinstance(param_type, Model.Array) \
            else param_type

        other_subelements = []
        for subelement in subelements:
            if subelement.tag == "element":
                if type(base_type) is not Model.Enum and \
                   type(base_type) is not Model.EnumSubset:
                    raise ParseError("Elements specified for parameter '" +
                                     params["name"] + "' of type " +
                                     type(base_type).__name__)
                if type(base_type) is Model.Enum:
                    base_type = Model.EnumSubset(
                        name=params["name"],
                        enum=base_type,
                        description=params["description"],
                        design_description=params["design_description"],
                        issues=params["issues"],
                        todos=params["todos"],
                        allowed_elements={})
                if "name" not in subelement.attrib:
                    raise ParseError(
                        "Element name is not specified for parameter '" +
                        params["name"] + "'")
                element_name = subelement.attrib["name"]
                if len(subelement.attrib) != 1:
                    raise ParseError("Unexpected attributes for element '" +
                                     element_name + "' of parameter '" +
                                     params["name"])
                children = subelement.getchildren()
                for child in children:
                    if child.tag == "description":
                        children.remove(child)
                if len(children) != 0:
                    raise ParseError("Unexpected subelements for element '" +
                                     element_name + "' of parameter '" +
                                     params["name"])
                if element_name in base_type.allowed_elements:
                    raise ParseError("Element '" + element_name +
                                     "' is specified more than once for" +
                                     " parameter '" + params["name"] + "'")
                if element_name not in base_type.enum.elements:
                    raise ParseError("Element '" + element_name +
                                     "' is not a member of enum '" +
                                     base_type.enum.name + "'")
                base_type.allowed_elements[element_name] = \
                    base_type.enum.elements[element_name]
            else:
                other_subelements.append(subelement)

        if isinstance(param_type, Model.Array):
            param_type.element_type = base_type
        else:
            param_type = base_type

        params["param_type"] = param_type
        if default_value is not None:
            params["default_value"] = default_value

        return params, other_subelements, attrib

    def _extract_optional_bool_attrib(self, attrib, name, default):
        """Extract boolean attribute with given name.

        Returns value of the attribute.

        """
        value = self._extract_attrib(attrib, name)

        if value is None:
            value = default
        else:
            value = self._get_bool_from_string(value)

        return value

    def _extract_optional_number_attrib(self, attrib, name, _type=int):
        """Extract number attribute with given name.

        Returns value of the attribute.

        """
        value = self._extract_attrib(attrib, name)

        if value is not None:
            try:
                value = _type(value)
            except:
                raise ParseError("Invlaid value for " + _type.__name__ +
                                 ": '" + value + "'")

        return value

    @staticmethod
    def _extract_attrib(attrib, name):
        """Extract attribute with given name.

        Returns value of the attribute.

        """
        value = None

        if name in attrib:
            value = attrib[name]
            del attrib[name]

        return value

    @staticmethod
    def _get_bool_from_string(bool_string):
        """Convert string representation of boolean to real bool value.

        Returns converted value.

        """
        value = None

        if bool_string in ['0', 'false']:
            value = False
        elif bool_string in ['1', 'true']:
            value = True
        else:
            raise ParseError("Invalid value for bool: '" +
                             bool_string + "'")

        return value

    def _ignore_attribute(self, attrib, name):
        """To be called when attribute is meaningless in terms
        of code generation but it's presence is not issue.

        Removes this attribute from attribute list.

        """
        if name in attrib:
            del attrib[name]
            print ("Ignoring attribute '" +
                   name + "'")
        return True

redpajama_set_name: RedPajamaGithub


text:
package com.aston.asql.convert;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.aston.asql.IConverter;

public class ByteaConverter implements IConverter {

	@Override
	public void bean2sql(Object val, PreparedStatement ps, int pos) throws SQLException {
		if (val instanceof byte[])
			ps.setBytes(pos, (byte[]) val);
	}

	@Override
	public Object sql2bean(ResultSet rs, int pos, Class<?> type) throws SQLException {
		return rs.getBytes(pos);
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor
  name="mvn-golang-hello"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <requiredProperties>
    <requiredProperty key="package">
      <defaultValue>main</defaultValue>
    </requiredProperty>
    <requiredProperty key="gowrapper">
      <defaultValue>2.3.11-SNAPSHOT</defaultValue>
    </requiredProperty>
    <requiredProperty key="gosdk">
      <defaultValue>1.19.3</defaultValue>
    </requiredProperty>
  </requiredProperties>

  <fileSets>
    <fileSet filtered="true" encoding="UTF-8">
      <directory>res</directory>
    </fileSet>
    <fileSet filtered="true" encoding="UTF-8">
      <directory>bin</directory>
    </fileSet>
    <fileSet filtered="true" packaged="false">
      <directory>src</directory>
      <includes>
        <include>**/*.go</include>
        <include>**/*.mod</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" packaged="false">
      <directory></directory>
      <includes>
        <include>*.xml</include>
        <include>*.txt</include>
      </includes>
    </fileSet>
  </fileSets>

</archetype-descriptor>


text:
external help file: Microsoft.Azure.Commands.Sql.dll-Help.xml
ms.assetid: 50E09DF7-F5B5-4668-9520-73D562E91800
online version:
schema: 2.0.0
---

# Set-AzureRmSqlDatabaseAdvisorAutoExecuteStatus

## SYNOPSIS
Modifies auto execute status of an Azure SQL Database Advisor.

## SYNTAX

```
Set-AzureRmSqlDatabaseAdvisorAutoExecuteStatus -AdvisorName <String>
 -AutoExecuteStatus <AdvisorAutoExecuteStatus> -ServerName <String> -DatabaseName <String>
 [-ResourceGroupName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
The **Set-AzureRmSqlDatabaseAdvisorAutoExecuteStatus** cmdlet modifies the auto execute property for an Azure SQL Database Advisor.
Currently, this cmdlet supports the values Enabled, Disabled, and Default.

## EXAMPLES

### Example 1: Enable auto execute for an advisor
```
PS C:\>Set-AzureRmSqlDatabaseAdvisorAutoExecuteStatus -ResourceGroupName "ContosoRunnersProd" -ServerName "runner-australia-east" -DatabaseName "ContosoRunner" -AdvisorName "CreateIndex" -AutoExecuteStatus Enabled
DatabaseName                   : ContosoRunner
ResourceGroupName              : ContosoRunnersProd
ServerName                     : runner-australia-east
AdvisorName                    : CreateIndex
AdvisorStatus                  : GA
AutoExecuteStatus              : Enabled
AutoExecuteStatusInheritedFrom : Database
LastChecked                    : 8/1/2016 2:36:47 PM
RecommendationsStatus          : Ok
RecommendedActions             : {}
```

This command changes the auto execute status of an advisor named CreateIndex to Enabled.

## PARAMETERS

### -AdvisorName
Specifies the name of the advisor for which this cmdlet modifies the status.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -AutoExecuteStatus
Specifies the value for the status.
The acceptable values for this parameter are:

- Enabled
- Disabled
- Default

```yaml
Type: AdvisorAutoExecuteStatus
Parameter Sets: (All)
Aliases:
Accepted values: Enabled, Disabled, Default

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -DatabaseName
Specifies the name of the database for which this cmdlet modifies status.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ResourceGroupName
Specifies the name of the resource group of the server that contains this database.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ServerName
Specifies the name of the server for the database.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### Microsoft.Azure.Commands.Sql.Advisor.Model.AzureSqlDatabaseAdvisorModel
This cmdlet returns an **AzureSqlDatabaseAdvisorModel** object.

## NOTES

## RELATED LINKS

[Get-AzureRmSqlDatabaseAdvisor](./Get-AzureRmSqlDatabaseAdvisor.md)

[SQL Database Documentation](https://docs.microsoft.com/azure/sql-database/)


text:
using namespace llvm;

STATISTIC(NumAnswered,    "Number of dependence queries answered");
STATISTIC(NumAnalysed,    "Number of distinct dependence pairs analysed");
STATISTIC(NumDependent,   "Number of pairs with dependent accesses");
STATISTIC(NumIndependent, "Number of pairs with independent accesses");
STATISTIC(NumUnknown,     "Number of pairs with unknown accesses");

LoopPass *llvm::createLoopDependenceAnalysisPass() {
  return new LoopDependenceAnalysis();
}

INITIALIZE_PASS_BEGIN(LoopDependenceAnalysis, "lda",
                "Loop Dependence Analysis", false, true)
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
INITIALIZE_PASS_END(LoopDependenceAnalysis, "lda",
                "Loop Dependence Analysis", false, true)
char LoopDependenceAnalysis::ID = 0;

//===----------------------------------------------------------------------===//
//                             Utility Functions
//===----------------------------------------------------------------------===//

static inline bool IsMemRefInstr(const Value *V) {
  const Instruction *I = dyn_cast<const Instruction>(V);
  return I && (I->mayReadFromMemory() || I->mayWriteToMemory());
}

static void GetMemRefInstrs(const Loop *L,
                            SmallVectorImpl<Instruction*> &Memrefs) {
  for (Loop::block_iterator b = L->block_begin(), be = L->block_end();
       b != be; ++b)
    for (BasicBlock::iterator i = (*b)->begin(), ie = (*b)->end();
         i != ie; ++i)
      if (IsMemRefInstr(i))
        Memrefs.push_back(i);
}

static bool IsLoadOrStoreInst(Value *I) {
  // Returns true if the load or store can be analyzed. Atomic and volatile
  // operations have properties which this analysis does not understand.
  if (LoadInst *LI = dyn_cast<LoadInst>(I))
    return LI->isUnordered();
  else if (StoreInst *SI = dyn_cast<StoreInst>(I))
    return SI->isUnordered();
  return false;
}

static Value *GetPointerOperand(Value *I) {
  if (LoadInst *i = dyn_cast<LoadInst>(I))
    return i->getPointerOperand();
  if (StoreInst *i = dyn_cast<StoreInst>(I))
    return i->getPointerOperand();
  llvm_unreachable("Value is no load or store instruction!");
}

static AliasAnalysis::AliasResult UnderlyingObjectsAlias(AliasAnalysis *AA,
                                                         const Value *A,
                                                         const Value *B) {
  const Value *aObj = GetUnderlyingObject(A);
  const Value *bObj = GetUnderlyingObject(B);
  return AA->alias(aObj, AA->getTypeStoreSize(aObj->getType()),
                   bObj, AA->getTypeStoreSize(bObj->getType()));
}

static inline const SCEV *GetZeroSCEV(ScalarEvolution *SE) {
  return SE->getConstant(Type::getInt32Ty(SE->getContext()), 0L);
}

//===----------------------------------------------------------------------===//
//                             Dependence Testing
//===----------------------------------------------------------------------===//

bool LoopDependenceAnalysis::isDependencePair(const Value *A,
                                              const Value *B) const {
  return IsMemRefInstr(A) &&
         IsMemRefInstr(B) &&
         (cast<const Instruction>(A)->mayWriteToMemory() ||
          cast<const Instruction>(B)->mayWriteToMemory());
}

bool LoopDependenceAnalysis::findOrInsertDependencePair(Value *A,
                                                        Value *B,
                                                        DependencePair *&P) {
  void *insertPos = 0;
  FoldingSetNodeID id;
  id.AddPointer(A);
  id.AddPointer(B);

  P = Pairs.FindNodeOrInsertPos(id, insertPos);
  if (P) return true;

  P = new (PairAllocator) DependencePair(id, A, B);
  Pairs.InsertNode(P, insertPos);
  return false;
}

void LoopDependenceAnalysis::getLoops(const SCEV *S,
                                      DenseSet<const Loop*>* Loops) const {
  // Refactor this into an SCEVVisitor, if efficiency becomes a concern.
  for (const Loop *L = this->L; L != 0; L = L->getParentLoop())
    if (!SE->isLoopInvariant(S, L))
      Loops->insert(L);
}

bool LoopDependenceAnalysis::isLoopInvariant(const SCEV *S) const {
  DenseSet<const Loop*> loops;
  getLoops(S, &loops);
  return loops.empty();
}

bool LoopDependenceAnalysis::isAffine(const SCEV *S) const {
  const SCEVAddRecExpr *rec = dyn_cast<SCEVAddRecExpr>(S);
  return isLoopInvariant(S) || (rec && rec->isAffine());
}

bool LoopDependenceAnalysis::isZIVPair(const SCEV *A, const SCEV *B) const {
  return isLoopInvariant(A) && isLoopInvariant(B);
}

bool LoopDependenceAnalysis::isSIVPair(const SCEV *A, const SCEV *B) const {
  DenseSet<const Loop*> loops;
  getLoops(A, &loops);
  getLoops(B, &loops);
  return loops.size() == 1;
}

LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseZIV(const SCEV *A,
                                   const SCEV *B,
                                   Subscript *S) const {
  assert(isZIVPair(A, B) && "Attempted to ZIV-test non-ZIV SCEVs!");
  return A == B ? Dependent : Independent;
}

LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseSIV(const SCEV *A,
                                   const SCEV *B,
                                   Subscript *S) const {
  return Unknown; // TODO: Implement.
}

LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseMIV(const SCEV *A,
                                   const SCEV *B,
                                   Subscript *S) const {
  return Unknown; // TODO: Implement.
}

LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
                                         const SCEV *B,
                                         Subscript *S) const {
  DEBUG(dbgs() << "  Testing subscript: " << *A << ", " << *B << "\n");

  if (A == B) {
    DEBUG(dbgs() << "  -> [D] same SCEV\n");
    return Dependent;
  }

  if (!isAffine(A) || !isAffine(B)) {
    DEBUG(dbgs() << "  -> [?] not affine\n");
    return Unknown;
  }

  if (isZIVPair(A, B))
    return analyseZIV(A, B, S);

  if (isSIVPair(A, B))
    return analyseSIV(A, B, S);

  return analyseMIV(A, B, S);
}

LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analysePair(DependencePair *P) const {
  DEBUG(dbgs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n");

  // We only analyse loads and stores but no possible memory accesses by e.g.
  // free, call, or invoke instructions.
  if (!IsLoadOrStoreInst(P->A) || !IsLoadOrStoreInst(P->B)) {
    DEBUG(dbgs() << "--> [?] no load/store\n");
    return Unknown;
  }

  Value *aPtr = GetPointerOperand(P->A);
  Value *bPtr = GetPointerOperand(P->B);

  switch (UnderlyingObjectsAlias(AA, aPtr, bPtr)) {
  case AliasAnalysis::MayAlias:
  case AliasAnalysis::PartialAlias:
    // We can not analyse objects if we do not know about their aliasing.
    DEBUG(dbgs() << "---> [?] may alias\n");
    return Unknown;

  case AliasAnalysis::NoAlias:
    // If the objects noalias, they are distinct, accesses are independent.
    DEBUG(dbgs() << "---> [I] no alias\n");
    return Independent;

  case AliasAnalysis::MustAlias:
    break; // The underlying objects alias, test accesses for dependence.
  }

  const GEPOperator *aGEP = dyn_cast<GEPOperator>(aPtr);
  const GEPOperator *bGEP = dyn_cast<GEPOperator>(bPtr);

  if (!aGEP || !bGEP)
    return Unknown;

  // FIXME: Is filtering coupled subscripts necessary?

  // Collect GEP operand pairs (FIXME: use GetGEPOperands from BasicAA), adding
  // trailing zeroes to the smaller GEP, if needed.
  typedef SmallVector<std::pair<const SCEV*, const SCEV*>, 4> GEPOpdPairsTy;
  GEPOpdPairsTy opds;
  for(GEPOperator::const_op_iterator aIdx = aGEP->idx_begin(),
                                     aEnd = aGEP->idx_end(),
                                     bIdx = bGEP->idx_begin(),
                                     bEnd = bGEP->idx_end();
      aIdx != aEnd && bIdx != bEnd;
      aIdx += (aIdx != aEnd), bIdx += (bIdx != bEnd)) {
    const SCEV* aSCEV = (aIdx != aEnd) ? SE->getSCEV(*aIdx) : GetZeroSCEV(SE);
    const SCEV* bSCEV = (bIdx != bEnd) ? SE->getSCEV(*bIdx) : GetZeroSCEV(SE);
    opds.push_back(std::make_pair(aSCEV, bSCEV));
  }

  if (!opds.empty() && opds[0].first != opds[0].second) {
    // We cannot (yet) handle arbitrary GEP pointer offsets. By limiting
    //
    // TODO: this could be relaxed by adding the size of the underlying object
    // to the first subscript. If we have e.g. (GEP x,0,i; GEP x,2,-i) and we
    // know that x is a [100 x i8]*, we could modify the first subscript to be
    // (i, 200-i) instead of (i, -i).
    return Unknown;
  }

  // Now analyse the collected operand pairs (skipping the GEP ptr offsets).
  for (GEPOpdPairsTy::const_iterator i = opds.begin() + 1, end = opds.end();
       i != end; ++i) {
    Subscript subscript;
    DependenceResult result = analyseSubscript(i->first, i->second, &subscript);
    if (result != Dependent) {
      // We either proved independence or failed to analyse this subscript.
      // Further subscripts will not improve the situation, so abort early.
      return result;
    }
    P->Subscripts.push_back(subscript);
  }
  // We successfully analysed all subscripts but failed to prove independence.
  return Dependent;
}

bool LoopDependenceAnalysis::depends(Value *A, Value *B) {
  assert(isDependencePair(A, B) && "Values form no dependence pair!");
  ++NumAnswered;

  DependencePair *p;
  if (!findOrInsertDependencePair(A, B, p)) {
    // The pair is not cached, so analyse it.
    ++NumAnalysed;
    switch (p->Result = analysePair(p)) {
    case Dependent:   ++NumDependent;   break;
    case Independent: ++NumIndependent; break;
    case Unknown:     ++NumUnknown;     break;
    }
  }
  return p->Result != Independent;
}

//===----------------------------------------------------------------------===//
//                   LoopDependenceAnalysis Implementation
//===----------------------------------------------------------------------===//

bool LoopDependenceAnalysis::runOnLoop(Loop *L, LPPassManager &) {
  this->L = L;
  AA = &getAnalysis<AliasAnalysis>();
  SE = &getAnalysis<ScalarEvolution>();
  return false;
}

void LoopDependenceAnalysis::releaseMemory() {
  Pairs.clear();
  PairAllocator.Reset();
}

void LoopDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
  AU.setPreservesAll();
  AU.addRequiredTransitive<AliasAnalysis>();
  AU.addRequiredTransitive<ScalarEvolution>();
}

static void PrintLoopInfo(raw_ostream &OS,
                          LoopDependenceAnalysis *LDA, const Loop *L) {
  if (!L->empty()) return; // ignore non-innermost loops

  SmallVector<Instruction*, 8> memrefs;
  GetMemRefInstrs(L, memrefs);

  OS << "Loop at depth " << L->getLoopDepth() << ", header block: ";
  WriteAsOperand(OS, L->getHeader(), false);
  OS << "\n";

  OS << "  Load/store instructions: " << memrefs.size() << "\n";
  for (SmallVector<Instruction*, 8>::const_iterator x = memrefs.begin(),
       end = memrefs.end(); x != end; ++x)
    OS << "\t" << (x - memrefs.begin()) << ": " << **x << "\n";

  OS << "  Pairwise dependence results:\n";
  for (SmallVector<Instruction*, 8>::const_iterator x = memrefs.begin(),
       end = memrefs.end(); x != end; ++x)
    for (SmallVector<Instruction*, 8>::const_iterator y = x + 1;
         y != end; ++y)
      if (LDA->isDependencePair(*x, *y))
        OS << "\t" << (x - memrefs.begin()) << "," << (y - memrefs.begin())
           << ": " << (LDA->depends(*x, *y) ? "dependent" : "independent")
           << "\n";
}

void LoopDependenceAnalysis::print(raw_ostream &OS, const Module*) const {
  // TODO: doc why const_cast is safe
  PrintLoopInfo(OS, const_cast<LoopDependenceAnalysis*>(this), this->L);
}


text:
import { isUndefined } from '../checks/isUndefined';
import { FacetVisitor } from '../core/FacetVisitor';
import { GraphicsProgramSymbols } from '../core/GraphicsProgramSymbols';
import { Geometric3 } from '../math/Geometric3';
import { Matrix4 } from '../math/Matrix4';
import { VectorE3 } from '../math/VectorE3';
import { View } from './View';
import { viewMatrixFromEyeLookUp } from './viewMatrixFromEyeLookUp';

//
// In this implementation, the state variables are eye, look, and up.
//
// This is equivalent to specifying position and attitude by the following correspondence:
//
// eye is exactly equivalent to position.
//
// look and eye taken together define a unit vector, n, which points in the opposite direction of viewing.
// n and up allow us to calculate the unit vector v which is in the plane of n and up,
// orthogonal to n and on the same side as up.
// n and v define a third unit vector u, where u x v = n.
// This orthogonal frame u, v, n is equivalent to an attitude in that the attitude is the rotor that
// transforms from the reference frame to the u, v, n frame.
// The reference frame is n = e3, v = e2, and u = e1.
//
/**
 * @hidden
 */
export function createView(options: { viewMatrixName?: string } = {}): View {

    /**
     * eye is the position vector of the viewing point.
     * Default is e3.
     */
    const eye: Geometric3 = Geometric3.vector(0, 0, 1);

    /**
     * look is the point that we are looking at.
     * Default is 0, the origin.
     */
    const look: Geometric3 = Geometric3.vector(0, 0, 0);

    /**
     * up is the "guess" at where up should be.
     * Default is e2.
     */
    const up: Geometric3 = Geometric3.vector(0, 1, 0);

    /**
     *
     */
    const viewMatrix: Matrix4 = Matrix4.one.clone();
    const viewMatrixName = isUndefined(options.viewMatrixName) ? GraphicsProgramSymbols.UNIFORM_VIEW_MATRIX : options.viewMatrixName;

    // Force an update of the view matrix.
    eye.modified = true;
    look.modified = true;
    up.modified = true;

    const self: View = {
        get eye(): Geometric3 {
            return eye;
        },
        set eye(newEye: Geometric3) {
            self.setEye(newEye);
        },
        setEye(newEye: VectorE3): View {
            eye.copyVector(newEye);
            return self;
        },
        get look(): Geometric3 {
            return look;
        },
        set look(newLook: Geometric3) {
            self.setLook(newLook);
        },
        setLook(newLook: VectorE3): View {
            look.copyVector(newLook);
            return self;
        },
        get up(): Geometric3 {
            return up;
        },
        set up(newUp: Geometric3) {
            self.setUp(newUp);
        },
        setUp(newUp: VectorE3): View {
            up.copyVector(newUp);
            up.normalize();
            return self;
        },
        setUniforms(visitor: FacetVisitor): void {
            self.updateViewMatrix();
            visitor.matrix4fv(viewMatrixName, viewMatrix.elements, false);
        },

        updateViewMatrix(): void {
            if (eye.modified || look.modified || up.modified) {
                viewMatrixFromEyeLookUp(eye, look, up, viewMatrix);
                eye.modified = false;
                look.modified = false;
                up.modified = false;
            }
        },

        get viewMatrix(): Matrix4 {
            self.updateViewMatrix();
            return viewMatrix;
        }
    };
    return self;
}