/** * Get the rules that match a given element. * * <p>First a rule for the identifier of the element is looked for. It is looked for in its name * space (nodes for Node element, etc.) If it is not found, the default rule for this kind of * element is used. This rule is pushed at start of the returned array of rules. * * <p>After a rule for the element is found, then the various classes the element pertains to are * looked at and each class rule found is added in order in the returned array. * * @param element The element a rules are searched for. * @return A set of rules matching the element, with the main rule at index 0. */ public ArrayList<Rule> getRulesFor(Element element) { ArrayList<Rule> rules = null; if (element instanceof Graph) { rules = graphRules.getRulesFor(element); } else if (element instanceof Node) { rules = nodeRules.getRulesFor(element); } else if (element instanceof Edge) { rules = edgeRules.getRulesFor(element); } else if (element instanceof GraphicSprite) { rules = spriteRules.getRulesFor(element); } else { rules = new ArrayList<Rule>(); rules.add(defaultRule); } return rules; }