@Test public void testIsChildOf4() { assertEquals(true, VisualPropertyUtil.isChildOf(BasicVisualLexicon.NODE_PAINT, BasicVisualLexicon.NODE_LABEL_COLOR, lexicon)); }
public static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp, final VisualLexicon lexicon) { if(vp == null) throw new NullPointerException("Visual Property is null."); if(lexicon == null) throw new NullPointerException("Lexicon is null."); if(!lexicon.getAllVisualProperties().contains(vp)) throw new IllegalArgumentException("No such Visual Porperty in the lexicon: " + vp.getDisplayName()); VisualLexiconNode node = lexicon.getVisualLexiconNode(vp); if(node.getParent() == null) return false; if (vp.equals(parent) || node.getParent().getVisualProperty().equals(parent)) return true; while (node.getParent() != null) { node = node.getParent(); if (node.getVisualProperty() == parent) return true; } return false; }
VisualPropertyUtil { public static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp, final VisualLexicon lexicon) { if(vp == null) throw new NullPointerException("Visual Property is null."); if(lexicon == null) throw new NullPointerException("Lexicon is null."); if(!lexicon.getAllVisualProperties().contains(vp)) throw new IllegalArgumentException("No such Visual Porperty in the lexicon: " + vp.getDisplayName()); VisualLexiconNode node = lexicon.getVisualLexiconNode(vp); if(node.getParent() == null) return false; if (vp.equals(parent) || node.getParent().getVisualProperty().equals(parent)) return true; while (node.getParent() != null) { node = node.getParent(); if (node.getVisualProperty() == parent) return true; } return false; } }
VisualPropertyUtil { public static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp, final VisualLexicon lexicon) { if(vp == null) throw new NullPointerException("Visual Property is null."); if(lexicon == null) throw new NullPointerException("Lexicon is null."); if(!lexicon.getAllVisualProperties().contains(vp)) throw new IllegalArgumentException("No such Visual Porperty in the lexicon: " + vp.getDisplayName()); VisualLexiconNode node = lexicon.getVisualLexiconNode(vp); if(node.getParent() == null) return false; if (vp.equals(parent) || node.getParent().getVisualProperty().equals(parent)) return true; while (node.getParent() != null) { node = node.getParent(); if (node.getVisualProperty() == parent) return true; } return false; } private  VisualPropertyUtil(); }
VisualPropertyUtil { public static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp, final VisualLexicon lexicon) { if(vp == null) throw new NullPointerException("Visual Property is null."); if(lexicon == null) throw new NullPointerException("Lexicon is null."); if(!lexicon.getAllVisualProperties().contains(vp)) throw new IllegalArgumentException("No such Visual Porperty in the lexicon: " + vp.getDisplayName()); VisualLexiconNode node = lexicon.getVisualLexiconNode(vp); if(node.getParent() == null) return false; if (vp.equals(parent) || node.getParent().getVisualProperty().equals(parent)) return true; while (node.getParent() != null) { node = node.getParent(); if (node.getVisualProperty() == parent) return true; } return false; } private  VisualPropertyUtil(); static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp,
			final VisualLexicon lexicon); }
VisualPropertyUtil { public static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp, final VisualLexicon lexicon) { if(vp == null) throw new NullPointerException("Visual Property is null."); if(lexicon == null) throw new NullPointerException("Lexicon is null."); if(!lexicon.getAllVisualProperties().contains(vp)) throw new IllegalArgumentException("No such Visual Porperty in the lexicon: " + vp.getDisplayName()); VisualLexiconNode node = lexicon.getVisualLexiconNode(vp); if(node.getParent() == null) return false; if (vp.equals(parent) || node.getParent().getVisualProperty().equals(parent)) return true; while (node.getParent() != null) { node = node.getParent(); if (node.getVisualProperty() == parent) return true; } return false; } private  VisualPropertyUtil(); static boolean isChildOf(final VisualProperty<?> parent, final VisualProperty<?> vp,
			final VisualLexicon lexicon);  }