diff options
Diffstat (limited to 'tests/junit/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java')
-rw-r--r-- | tests/junit/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/junit/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java b/tests/junit/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java new file mode 100644 index 00000000000..9bde0efcfa4 --- /dev/null +++ b/tests/junit/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java @@ -0,0 +1,90 @@ +/***************************************************************************** + * Copyright (c) 2013 Cedric Dumoulin. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel; + +import java.util.Arrays; +import java.util.List; + +/** + * This represent a Folder in the Checker query. + * + * @author cedric dumoulin + */ +public class Folder extends PanelTerm implements IModelObject { + + protected List<Page> pages; + + /** + * Constructor. + * + */ + public Folder(Page ... pages) { + this.pages = Arrays.asList(pages); + } + + /** + * Constructor. + * + */ + public Folder(String name, Page ... pages) { + super(name); + this.pages = Arrays.asList(pages); + } + + /** + * @return the pages + */ + public List<Page> getPages() { + return pages; + } + + /** + * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(IPagesModelVisitor, EObject) + * + * @param visitor + * @throws PagesModelException + */ + public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException { + + visitor.walk(this, modelObject); + } + + /** + * @see java.lang.Object#toString() + * + * @return + */ + @Override + public String toString() { + + StringBuffer buff = new StringBuffer("Folder("); + + if( getName() != null ) { + buff.append(getName()).append(", "); + } + + for(Page page : pages ) { + buff.append(page.toString()).append(", "); + } + // Remove extra , + int length = buff.length(); + if(buff.charAt(length-1) == ' ') { + buff.delete(length-2, length ); + } + buff.append(")"); + + return buff.toString(); + } +} |