// construction based on clip instance ImageBase::ImageBase(ClipInstance& instance, double renderScaleX, double renderScaleY, const OfxRectI &bounds, const OfxRectI &rod, int rowBytes, std::string field, std::string uniqueIdentifier) : Property::Set(imageBaseStuffs) , _referenceCount(1) { getClipBits(instance); // set other data setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleX, 0); setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleY, 1); setIntProperty(kOfxImagePropBounds,bounds.x1, 0); setIntProperty(kOfxImagePropBounds,bounds.y1, 1); setIntProperty(kOfxImagePropBounds,bounds.x2, 2); setIntProperty(kOfxImagePropBounds,bounds.y2, 3); setIntProperty(kOfxImagePropRegionOfDefinition,rod.x1, 0); setIntProperty(kOfxImagePropRegionOfDefinition,rod.y1, 1); setIntProperty(kOfxImagePropRegionOfDefinition,rod.x2, 2); setIntProperty(kOfxImagePropRegionOfDefinition,rod.y2, 3); setIntProperty(kOfxImagePropRowBytes,rowBytes); setStringProperty(kOfxImagePropField,field); setStringProperty(kOfxImageClipPropFieldOrder,field); setStringProperty(kOfxImagePropUniqueIdentifier,uniqueIdentifier); }
Node* setPersonProperties(int id, char* name, char* surname, int age) { /*create properties*/ Properties* prop = createProperties(PERSON_PROPERTIES_NUM); setStringProperty(name, 0, prop); setStringProperty(surname, 1, prop); setIntegerProperty(age, 2, prop); /*create node*/ Node* n = createNode(id, prop); return n; }
void ArrayObject::_setIntProperty(int index, Atom value) { if (index >= 0) _setUintProperty(index, value); else // integer is negative - we must intern it setStringProperty(core()->internInt(index), value); }
Edge* setEdgeProperties(int startNodeID, int endNodeID, char* type, double weight) { /*create edge properties*/ Properties* propEdge = createProperties(PERSON_REL_PROPERTIES_NUM); setStringProperty(type, 0, propEdge); setDoubleProperty(weight, 1, propEdge); /*create an edge*/ Edge* e = createEdge(startNodeID, endNodeID, propEdge); return e; }
void ScriptObject::setMultinameProperty(const Multiname* name, Atom value) { if (traits()->needsHashtable() && name->isValidDynamicName()) { setStringProperty(name->getName(), value); } else { throwWriteSealedError(*name); } }
Edge* setEdgeProperties(int startNodeID, int endNodeID, char* type, int weight, Graph* g) { /*create edge properties*/ Properties* propEdge = createProperties(PERSON_REL_PROPERTIES_NUM); setStringProperty(type, 0, propEdge); setIntegerProperty(weight, 1, propEdge); /*create an edge*/ Node* endNode = g->lookUpItem(endNodeID); Edge* e = createEdge(endNode, propEdge); return e; }
/* MapLine::clearUnneededTextures * Clears any textures not needed on the line (eg. a front upper * texture that would be invisible) *******************************************************************/ void MapLine::clearUnneededTextures() { // Check needed textures int tex = needsTexture(); // Clear any unneeded textures if (side1) { if ((tex & TEX_FRONT_MIDDLE) == 0) setStringProperty("side1.texturemiddle", "-"); if ((tex & TEX_FRONT_UPPER) == 0) setStringProperty("side1.texturetop", "-"); if ((tex & TEX_FRONT_LOWER) == 0) setStringProperty("side1.texturebottom", "-"); } if (side2) { if ((tex & TEX_BACK_MIDDLE) == 0) setStringProperty("side2.texturemiddle", "-"); if ((tex & TEX_BACK_UPPER) == 0) setStringProperty("side2.texturetop", "-"); if ((tex & TEX_BACK_LOWER) == 0) setStringProperty("side2.texturebottom", "-"); } }
Edge* setEdgeProperties(int startNodeID, int endNodeID, char** property,const int* type, int properties ) { int i ; /*create edge properties*/ Properties* propEdge = createProperties(properties); for (i=0;i<properties;i++) if (type[i]==1) setStringProperty(property[i], i, propEdge); else if (type[i]==2) setIntegerProperty(property[i], i, propEdge); /*create an edge*/ Edge* e = createEdge(startNodeID, endNodeID, propEdge); return e; }
Node* setNodeProperties(int id, char** property,const int* type, int properties) { /*create properties*/ int i ; Properties* prop = createProperties(properties); for (i=0;i<properties;i++) if (type[i]==1) setStringProperty(property[i], i, prop); /*create node*/ Node* n = createNode(id, prop); return n; }
Node* setPersonProperties(int id, char* name,char* surname ,char* gender,char* birthday,char* creationDate,char* locationIP,char* browser) { Node* n; Properties* prop = createProperties(PERSON_PROPERTIES_NUM); if(name != NULL){ setStringProperty(name, 0, prop); setStringProperty(surname, 1, prop); setStringProperty(gender, 2, prop); setStringProperty(birthday, 3, prop); setStringProperty(creationDate,4, prop); setStringProperty(locationIP, 5, prop); setStringProperty(browser, 6, prop); prop[7].property = (TagList*)createTagList(); } else prop[0].property = prop[1].property = prop[2].property = prop[3].property = prop[4].property = prop[5].property = prop[6].property = prop[7].property = NULL; n = createNode(id,prop); return n; }
DOMTypeInfoImpl::DOMTypeInfoImpl(DOMDocumentImpl* ownerDoc, const DOMPSVITypeInfo* sourcePSVI) : fBitFields(0), fTypeName(0), fTypeNamespace(0), fMemberTypeName(0), fMemberTypeNamespace(0), fDefaultValue(0), fNormalizedValue(0) { setNumericProperty(DOMPSVITypeInfo::PSVI_Validity, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Validity)); setNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted)); setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type)); setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous)); setNumericProperty(DOMPSVITypeInfo::PSVI_Nil, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Nil)); setNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous)); setNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified, sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified)); setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name))); setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace))); setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name))); setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace))); setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default))); setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value, ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value))); }
void addTrust(Graph * trustGraph, Graph * g) //insert trust edges in trustGraph { int i,j; Node * n; Person * p; List * l; Properties * props; Edge * e; LikeCom * tmp,*lc; for(i=0; i < trustGraph->size; i++) //for every node in trustGraph, adding edges { for(j=0; j < trustGraph->position[i]; j++) { n = lookupNode(trustGraph->table[i][j]->ID,g); p = n->obj; l = p->list; while(l != NULL) { if((n = lookupNode(l->neighbor->ID,trustGraph)) == NULL) { l = l->next; continue; } props = createProperties(2); setStringProperty("trust",0,props); props->prop[1] = malloc(sizeof(double)); e = createEdge(0,l->neighbor->ID,props); insertEdge(trustGraph->table[i][j]->ID,e,trustGraph); l = l->next; } } } LikeCom * pivot; for(i=0; i < trustGraph->size; i++) //calculating weight { for(j=0; j < trustGraph->position[i]; j++) { p = trustGraph->table[i][j]->obj; if (p->nProp == NULL) { p->prop_num = 2; p->nProp = (void*)createProperties(1); p->nProp->prop[0] = malloc(sizeof(double)); continue; } pivot = p->nProp->prop[2]; l = p->list; while(l != NULL) { while(pivot != NULL) { if (l->neighbor->ID == pivot->creatorID) { *(double*)l->neighbor->eProp->prop[1] = 0; if((int)p->nProp->prop[0] != 0) *(double *) l->neighbor->eProp->prop[1] = 0.3*pivot->likes_count/(int)p->nProp->prop[0]; //calculating likes weight if((int)p->nProp->prop[1] != 0) *(double *) l->neighbor->eProp->prop[1] += 0.7*pivot->replies_count/(int)p->nProp->prop[1]; //calculating replies weight pivot = pivot->next; } l = l->next; } if (l != NULL) l = l->next; } lc = p->nProp->prop[2]; while(lc!=NULL) //free { tmp = lc; lc = lc->next; free(tmp); } p->prop_num = 2; p->nProp->prop[0] = malloc(sizeof(double)); //allocating trust } } }
//TODO keylist should be a list/set of string sets, because an operator may have more than one candidate key each of which may consist of multiple attributes void computeKeyProp (QueryOperator *root) { List *keyList = NIL; List *rKeyList = NIL; if (root == NULL) return; // compute key properties of children first if(root->inputs != NULL) FOREACH(QueryOperator, op, root->inputs) computeKeyProp(op); // table acces operator or constant relation operators have predetermined keys if(isA(root, TableAccessOperator)) { TableAccessOperator *rel = (TableAccessOperator *) root; keyList = getKeyInformation(rel->tableName); setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)keyList); DEBUG_LOG("operator %s keys are {%s}", root->schema->name, stringListToString(keyList)); return; } else if (isA(root, ConstRelOperator)) { FOREACH(AttributeDef, a, root->schema->attrDefs) keyList = appendToTailOfList(keyList, strdup(a->attrName)); setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)keyList); DEBUG_LOG("operator %s keys are {%s}", root->schema->name, stringListToString(keyList)); return; } // get keys of children keyList = (List *) getStringProperty(OP_LCHILD(root), PROP_STORE_LIST_KEY); if (IS_BINARY_OP(root)) { List *newKeyList = NIL; rKeyList = (List *) getStringProperty(OP_RCHILD(root), PROP_STORE_LIST_KEY); newKeyList = concatTwoLists(keyList, rKeyList); setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)newKeyList); } // deal with different operator types // here we could use the ECs to determine new keys, e.g., if input has keys {{A}, {C}} and we have selection condition B = C, then we have a new key {{A}, {B}, {C}} if (isA(root, SelectionOperator)) setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)keyList); if (isA(root, ProjectionOperator)) { List *l1 = ((ProjectionOperator *)root)->projExprs; List *l2 = NIL; FOREACH(AttributeReference, op1, l1) l2 = appendToTailOfList(l2, op1->name); FOREACH(char, op, keyList) { if(!searchListString(l2, op)) { setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, NULL); break; } setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)keyList); } } // dup removal operator has a key {all attributes} if the input does not have a key if (isA(root, DuplicateRemoval)) { //List *l1 = getQueryOperatorAttrNames(OP_LCHILD(root)); //TODO Get the child's key property and Append it to above list and set it as property of duplicate operator setStringProperty((QueryOperator *)root, PROP_STORE_LIST_KEY, (Node *)keyList); } DEBUG_LOG("operator %s keys are {%s}", root->schema->name, stringListToString(keyList)); }
bool FractalConfiguration::open(string filename) { if(invalidID()) return true; m_dirty = false; XMLDocument doc; // Parse file doc.LoadFile(filename.c_str()); if(doc.Error()) { m_last_error = doc.GetErrorStr1(); return true; } // Get data XMLElement *root = doc.RootElement(); string name = string(root->Name()); if(name != "fractal") { m_last_error = "Configuration file is invalid!"; return true; } if(root->Attribute("id", m_id.c_str())) { XMLNode *node = root->FirstChild(); // Loop over all properties while(node != NULL) { XMLElement *element = node->ToElement(); if(element == NULL) { m_last_error = "Configuration file is invalid!"; return true; } // Get name and type (attributes) const char* tmp_name = element->Attribute("name"); const char* tmp_type = element->Attribute("type"); if(tmp_name == NULL || tmp_type == NULL) { m_last_error = "Configuration file is invalid!"; return true; } string name(tmp_name); string type(tmp_type); // Get text const char* tmp_text = element->GetText(); string text = ""; if(tmp_text != NULL) text = tmp_text; // Set property if(type == "string") { if(setStringProperty(name, text)) return true; } else if(type == "int") { int value; if(stringToInt(text, &value)) { m_last_error = "Error in configuration: " + text + " should be an integer"; return true; } if(setIntProperty(name, value)) return true; } else if(type == "double") { double value; if(stringToDouble(text, &value)) { m_last_error = "Error in configuration: " + text + " should be a double"; return true; } if(setDoubleProperty(name, value)) return true; } else if(type == "bool") { bool value; if(text == "1") value = true; else if(text == "0") value = false; else { m_last_error = "Error in configuration: " + text + " should be boolean (0 or 1)"; return true; } if(setBoolProperty(name, value)) return true; } else { m_last_error = "Error in configuration: " + type + " is not a valid type"; return true; } // Next node node = node->NextSibling(); } } else { m_last_error = "File contains not the configuration of a fractal with ID " + m_id; return true; } resetDirty(); return false; }