📄 composite.java
字号:
package it.unimi.dsi.mg4j.query.nodes;/* * MG4J: Managing Gigabytes for Java * * Copyright (C) 2006-2007 Sebastiano Vigna * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import it.unimi.dsi.lang.MutableString;/** A abstract composite node containing an array of underlying queries. * * @author Sebastiano Vigna */public abstract class Composite implements Query { /** The underlying queries. */ protected final Query query[]; public Composite( final Query... query ) { this.query = query; } /** Returns a string representation of this node, given a start string, and end string and a separator. * Instantiating subclasses can easily write their {@link Object#toString()} * methods by supplying these three strings and calling this method. * * @param start the string to be used at the start of the string representation. * @param end the string to be used at the end of the string representation. * @param sep the separator between component queries. * @return a string representation for this composite query node. */ protected String toString( final String start, final String end, final String sep ) { final MutableString s = new MutableString(); s.append( start ); for( int i = 0; i < query.length; i++ ) { if ( i != 0 ) s.append( sep ); s.append( query[ i ] ); } s.append( end ); return s.toString(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -