You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by eh...@apache.org on 2005/10/29 11:22:51 UTC

svn commit: r329380 - /lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java

Author: ehatcher
Date: Sat Oct 29 02:22:47 2005
New Revision: 329380

URL: http://svn.apache.org/viewcvs?rev=329380&view=rev
Log:
Utility class to remove duplication in Query.toString implementations

Added:
    lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java

Added: lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java?rev=329380&view=auto
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java (added)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/ToStringUtils.java Sat Oct 29 02:22:47 2005
@@ -0,0 +1,25 @@
+package org.apache.lucene.util;
+
+/**
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ToStringUtils {
+  public static String boost(float boost) {
+    if (boost != 1.0f) {
+      return "^" + Float.toString(boost);
+    } else return "";
+  }
+}