Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.FieldName$Textual


        }

        final Map<FieldName, TypeExpr> allFieldsMap = new HashMap<FieldName, TypeExpr>(); //map containing all the context fields and fields added with the value editor, RecordFieldName -> TypeExpr

        for (int i = 0; i < numFields; i++) {
            final FieldName fieldName = hasFieldNames.get(i);
            if (contextFieldsMap.containsKey(fieldName)) {
                allFieldsMap.put(fieldName, contextFieldsMap.get(fieldName));
            } else {
                allFieldsMap.put(fieldName, TypeExpr.makeParametricType());
            }
        }
        final RecordType leastConstrainedRecordType = TypeExpr.makePolymorphicRecordType(allFieldsMap);

       
        // add the record node itself to the result map
        resultMap.put(currentValueNode, leastConstrainedRecordType);

        // add all the record field nodes to the result map
        for (int j = 0; j < numFields; j++) {
            ValueNode currentFieldNode = currentValueNode.getValueAt(j);
            FieldName fieldName = hasFieldNames.get(j);
           
            TypeExpr leastConstrainedRecordElementType = leastConstrainedRecordType.getHasFieldType(fieldName);
                           
            resultMap.put(currentFieldNode, leastConstrainedRecordElementType);
        }
View Full Code Here


                    // Create a field name which does not conflict with existing or lacks fields
                   
                    List<FieldName> hasFields = getValueNode().getTypeExpr().rootRecordType().getHasFieldNames();
                    Set<FieldName> lacksFields = getValueNode().getTypeExpr().rootRecordType().getLacksFieldsSet();
                   
                    FieldName newFieldName = RecordValueEditor.getNewFieldName(hasFields, lacksFields);
                                                                                               
                    // Create new record type having the existing fields plus a new one
                   
                    Map<FieldName, TypeExpr> fieldNamesToTypeMap = new HashMap<FieldName, TypeExpr>();
                    for (final FieldName hasFieldName : hasFields) {
View Full Code Here

                   
                    if (!rowHeader.getModel().isCellEditable(row, 0)) {
                        throw new IllegalStateException();
                    }
                   
                    FieldName fieldName = ((AbstractRecordValueNode)getValueNode()).getFieldName(row);
                   
                    // Create new record type lacking the field
                   
                    Map<FieldName, TypeExpr> fieldNamesToTypeMap = new HashMap<FieldName, TypeExpr>();
                    List<FieldName> hasFields = getValueNode().getTypeExpr().rootRecordType().getHasFieldNames();
View Full Code Here

     */
    static FieldName getNewFieldName(Collection<FieldName> hasFields, Collection<FieldName> lacksFields) {
                       
        for (int i = 1; true; ++i) {
           
            FieldName fieldName = FieldName.make(RecordValueEditor.DEFAULT_NEW_FIELD_PREFIX + i);
           
            if (fieldName != null &&
                !hasFields.contains(fieldName) &&
                !lacksFields.contains(fieldName)) {
               
View Full Code Here

                    textField.finishedEdit();
                    if ((row == -1) || (col == -1)) {
                        return;
                    }
                   
                    FieldName fieldName = RowHeader.this.recordFieldModel.getHasFieldName(row);
                    if (!textField.isValidFieldName()) {
                        setValueAt(fieldName.getCalSourceForm(), row, col);
                        return;
                    }
                   
                    String newFieldNameAsString = textField.getText();
                    if (newFieldNameAsString.equals(fieldName.getCalSourceForm())) {
                        return;
                    }
                   
                    RowHeader.this.headerOwner.renameField(fieldName, FieldName.make(newFieldNameAsString));
                    RowHeader.this.recordEditor.refreshDisplay();
View Full Code Here

       
        RecordValueEditor.RecordFieldModel recordFieldModel = new RecordValueEditor.RecordFieldModel();
        RecordValueEditor.RowHeader.RowHeaderOwner rowHeaderOwner = new RecordValueEditor.RowHeader.RowHeaderOwner() {
           
            public TypeExpr getFieldType(int row) {
                FieldName fieldName = (getListElementType().rootRecordType().getHasFieldNames().get(row));
                return getListElementType().rootRecordType().getHasFieldType(fieldName);
            }
           
            public void renameField(FieldName oldName, FieldName newName) {
               
View Full Code Here

            //add all the additional fields from the editor
            if (firstChild.getTypeExpr() instanceof RecordType ) {
                RecordType elementType = (RecordType ) firstChild.getTypeExpr(); // unconstrainedListElementType;
                for (int i = 0; i < elementType.getNHasFields(); i++) {
                    final FieldName fieldName = elementType.getHasFieldNames().get(i);
                    if (!fieldMap.containsKey(fieldName)) {
                        fieldMap.put(fieldName, TypeExpr.makeParametricType());
                    }
                }
            }
View Full Code Here

                    // Find a name for the field, which does not conflict with the existing has or lacks fields
                   
                    List<FieldName> hasFields = getListElementType().rootRecordType().getHasFieldNames();
                    Set<FieldName> lacksFields = getListElementType().rootRecordType().getLacksFieldsSet();
                   
                    FieldName newFieldName = RecordValueEditor.getNewFieldName(hasFields, lacksFields);                  
                   
                    // Create new record type
                   
                    Map<FieldName, TypeExpr> fieldNamesToTypeMap = new HashMap<FieldName, TypeExpr>();
                    for (final FieldName hasFieldName : hasFields) {
View Full Code Here

                    if (col == -1) {
                        return;
                    }
                   
                    List<FieldName> existingFields = getListElementType().rootRecordType().getHasFieldNames();
                    FieldName fieldName = existingFields.get(col);
                   
                    // Create new record type lacking the field
                   
                    Map<FieldName, TypeExpr> fieldNamesToTypeMap = new HashMap<FieldName, TypeExpr>();
                    if (!existingFields.remove(fieldName)) {
View Full Code Here

        final RecordValue resultMap = RecordValueImpl.make();
        final int nFields = recordDict.getNFields();

        for (int i = 0; i < nFields; ++i) {
            final FieldName fieldName = recordDict.getNthFieldName(i);
            //RTValue fieldDict = recordDictionary.getNthValue(i);
            //RTValue xField = xRecord.getNthValue(i);

            //compute "Prelude.output fieldDict xField"
            //this is just (after inlining Prelude.output d = d"
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.FieldName$Textual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.