• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Text类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javolution.text.Text的典型用法代码示例。如果您正苦于以下问题:Java Text类的具体用法?Java Text怎么用?Java Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Text类属于javolution.text包,在下文中一共展示了Text类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: characters

import javolution.text.Text; //导入依赖的package包/类
public void characters(char[] values, int offset, int count) throws org.xml.sax.SAXException {
    if (isParseForTemplate) {
        // if null, don't worry about it
        if (this.currentNodeForTemplate != null) {
            Node newNode = this.documentForTemplate.createTextNode(new String(values, offset, count));
            this.currentNodeForTemplate.appendChild(newNode);
        }
        return;
    }

    if (currentValue != null && currentFieldName != null) {
        Text value = Text.valueOf(values, offset, count);

        // Debug.logInfo("characters: value=" + value, module);
        if (currentFieldValue == null) {
            currentFieldValue = value;
        } else {
            currentFieldValue = Text.valueOf(currentFieldValue).concat(value);
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:EntitySaxReader.java


示例2: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the decimal text representation of this number.
 *
 * @return the text representation of this number.
 */
public Text toText() {
    if (this == NaN)
        return Text.valueOf("NaN");
    if (this._significand.isZero())
        return Text.valueOf("0.0");
    TextBuilder tb = TextBuilder.newInstance();
    LargeInteger m = _significand;
    if (isNegative()) {
        tb.append('-');
        m = m.opposite();
    }
    tb.append("0.");
    LargeInteger.DECIMAL_FORMAT.format(m, tb);
    int exp = _exponent + m.digitLength();
    if (exp != 0) {
        tb.append("E");
        tb.append(_exponent + m.digitLength());
    }
    Text txt = tb.toText();
    TextBuilder.recycle(tb);
    return txt;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:28,代码来源:FloatingPoint.java


示例3: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this term.
 */
public Text toText() {
    TextBuilder tb = TextBuilder.newInstance();
    for (int i = 0; i < _size; i++) {
        tb.append(_variables[i].getSymbol());
        int power = _powers[i];
        switch (power) {
        case 1:
            break;
        case 2:
            tb.append('²');
            break;
        case 3:
            tb.append('³');
            break;
        default:
            tb.append(power);
        }
    }
    return tb.toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:24,代码来源:Term.java


示例4: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this matrix.
 *
 * @return the text representation of this matrix.
 */
public Text toText() {
    final int m = this.getNumberOfRows();
    final int n = this.getNumberOfColumns();
    TextBuilder tmp = TextBuilder.newInstance();
    tmp.append('{');
    for (int i = 0; i < m; i++) {
        tmp.append('{');
        for (int j = 0; j < n; j++) {
            tmp.append(get(i, j));
            if (j != n - 1) {
                tmp.append(", ");
            }
        }
        tmp.append("}");
        if (i != m - 1) {
            tmp.append(",\n");
        }            
    }
    tmp.append("}");
    Text txt = tmp.toText();
    TextBuilder.recycle(tmp);
    return txt;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:29,代码来源:Matrix.java


示例5: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this vector.
 *
 * @return the text representation of this vector.
 */
public Text toText() {
    final int dimension = this.getDimension();
    TextBuilder tmp = TextBuilder.newInstance();
    tmp.append('{');
    for (int i = 0; i < dimension; i++) {
        tmp.append(get(i));
        if (i != dimension - 1) {
            tmp.append(", ");
        }
    }
    tmp.append('}');
    Text txt = tmp.toText();
    TextBuilder.recycle(tmp); 
    return txt;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:21,代码来源:Vector.java


示例6: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the string representation of this coordinates.
 * 
 * @return the coordinates values/units.
 */
public Text toText() {
    double[] coordinates = getCoordinates();
    CoordinateSystem cs = this.getCoordinateReferenceSystem().getCoordinateSystem();
    TextBuilder tb = TextBuilder.newInstance();
    tb.append('[');
    for (int i=0; i < coordinates.length; i++) {
        if (i != 0) {
            tb.append(", ");
        }
        tb.append(getOrdinate(i));
        tb.append(' ');
        tb.append(cs.getAxis(i).getUnit());
    }
    tb.append(']');
    return tb.toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:22,代码来源:Coordinates.java


示例7: initializeRealtimeClasses

import javolution.text.Text; //导入依赖的package包/类
/** Initializes all real-time classes. */
public static synchronized boolean initializeRealtimeClasses() {
	Initializer initializer = new Initializer(OSGiServices.class.getClassLoader());
	initializer.loadClass(MathLib.class);
	initializer.loadClass(Text.class);
	initializer.loadClass(TypeFormat.class);
	initializer.loadClass(Struct.class);
	initializer.loadClass(FastBitSet.class);
	initializer.loadClass(FastSortedMap.class);
	initializer.loadClass(FastSortedSet.class);
	initializer.loadClass(FastSortedTable.class);
	initializer.loadClass(Index.class); // Preallocates.
	initializer.loadClass(Reducers.class);
	initializer.loadClass(Equalities.class);
	initializer.loadClass(XMLStreamReaderImpl.class);
	initializer.loadClass(XMLStreamWriterImpl.class);
	return initializer.initializeLoadedClasses();
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:OSGiServices.java


示例8: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this number.
 *
 * @return The string representation of this number as a <code>Text</code>.
 */

@Override
public Text toText()
{
    return Text.valueOf(value().toString());
}
 
开发者ID:mtommila,项目名称:apfloat,代码行数:12,代码来源:AbstractField.java


示例9: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this number in the specified radix.
 *
 * @param radix the radix of the representation.
 * @return the text representation of this number in the specified radix.
 */
public Text toText(int radix) {
    TextBuilder tmp = TextBuilder.newInstance();
    try {
        format(this, radix, tmp);
        return tmp.toText();
    } catch (IOException e) {
        throw new Error(e);
    } finally {
        TextBuilder.recycle(tmp);
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:18,代码来源:LargeInteger.java


示例10: valueOf

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the rational number for the specified character sequence.
 * 
 * @param  chars the character sequence.
 * @return the corresponding rational number.
 */
public static Rational valueOf(CharSequence chars) {
    Text txt = Text.valueOf(chars); // TODO Use TextFormat...
    int sep = txt.indexOf("/");
    if (sep >= 0) {
        LargeInteger dividend = LargeInteger.valueOf(txt.subtext(0, sep));
        LargeInteger divisor = LargeInteger.valueOf(txt.subtext(
                sep + 1, chars.length()));
        return valueOf(dividend, divisor);
    } else { // No divisor.
        return valueOf(LargeInteger.valueOf(txt),
                LargeInteger.ONE);
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:20,代码来源:Rational.java


示例11: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the decimal text representation of this number.
 *
 * @return the text representation of this number.
 */
public Text toText() {
    if (this == NaN)
        return Text.valueOf("NaN");
    if (isExact()) {
        return (_exponent == 0) ? _significand.toText() : 
            _significand.toText().plus("E").plus(Text.valueOf(_exponent));
    }
    int errorDigits = _error.digitLength();
    LargeInteger m = (_significand.isPositive()) ? _significand.plus(FIVE
            .times10pow(errorDigits - 1)) : _significand.plus(MINUS_FIVE
            .times10pow(errorDigits - 1));
    m = m.times10pow(-errorDigits);
    int exp = _exponent + errorDigits;
    Text txt = m.toText();
    int digits = (m.isNegative()) ? txt.length() - 1 : txt.length();
    if (digits > 1) {
        if ((exp < 0) && (-exp < digits)) {
            txt = txt.insert(txt.length() + exp, Text.valueOf('.'));
        } else { // Scientific notation.
            txt = txt.insert(txt.length() - digits + 1, Text.valueOf('.'));
            txt = txt.concat(Text.valueOf('E')).concat(
                    Text.valueOf(exp + digits - 1));
        }
    } else {
        txt = txt.concat(Text.valueOf('E')).concat(Text.valueOf(exp));
    }
    return txt;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:34,代码来源:Real.java


示例12: toText

import javolution.text.Text; //导入依赖的package包/类
@Override
public Text toText() {
    TextBuilder tb = TextBuilder.newInstance();
    tb.append('(');
    tb.append(_dividend);
    tb.append(")/(");
    tb.append(_divisor);
    tb.append(')');
    return tb.toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:11,代码来源:RationalFunction.java


示例13: toText

import javolution.text.Text; //导入依赖的package包/类
@Override
public Text toText() {
    FastTable<Term> terms = FastTable.newInstance();
    terms.addAll(_termToCoef.keySet());
    terms.sort();
    TextBuilder tb = TextBuilder.newInstance();
    for (int i=0, n = terms.size(); i < n; i++) {
        if (i != 0) {
            tb.append(" + ");
        }
        tb.append('[').append(_termToCoef.get(terms.get(i)));
        tb.append(']').append(terms.get(i));
    }
    return tb.toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:16,代码来源:Polynomial.java


示例14: format

import javolution.text.Text; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Appendable format(Amount arg0, Appendable arg1)
        throws IOException {
    if (arg0.getUnit() instanceof Currency)
        return formatMoney(arg0, arg1);
    if (arg0.isExact()) {
        TypeFormat.format(arg0.getExactValue(), arg1);
        arg1.append(' ');
        return UnitFormat.getInstance().format(arg0.getUnit(), arg1);
    }
    double value = arg0.getEstimatedValue();
    double error = arg0.getAbsoluteError();
    int log10Value = (int) MathLib.floor(MathLib.log10(MathLib
            .abs(value)));
    int log10Error = (int) MathLib.floor(MathLib.log10(error));
    int digits = log10Value - log10Error - 1; // Exact digits.
    digits = MathLib.max(1, digits + _errorDigits);

    boolean scientific = (MathLib.abs(value) >= 1E6)
            || (MathLib.abs(value) < 1E-6);
    boolean showZeros = true;
    TextBuilder tb = TextBuilder.newInstance();
    TypeFormat.format(value, digits, scientific, showZeros, tb);
    int endMantissa = 0;
    for (; endMantissa < tb.length(); endMantissa++) {
        if (tb.charAt(endMantissa) == 'E')
            break;
    }
    int bracketError = (int) (error * MathLib.toDoublePow10(1,
            -log10Error + _errorDigits - 1));
    tb.insert(endMantissa, Text.valueOf('[').plus(
            Text.valueOf(bracketError)).plus(']'));
    arg1.append(tb);
    arg1.append(' ');
    return UnitFormat.getInstance().format(arg0.getUnit(), arg1);
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:38,代码来源:AmountFormat.java


示例15: read

import javolution.text.Text; //导入依赖的package包/类
/**
 * Reads characters into a portion of an array.  This method does not 
 * block.
 *
 * @param  cbuf the destination buffer.
 * @param  off the offset at which to start storing characters.
 * @param  len the maximum number of characters to read
 * @return the number of characters read,  or -1 if there is no more
 *         character to be read.
 * @throws IOException if an I/O error occurs.
 */
public int read(char cbuf[], int off, int len) throws IOException {
    if (input == null)
        throw new IOException("Reader closed");
    final int inputLength = input.length();
    if (index >= inputLength)
        return -1;
    final int count = MathLib.min(inputLength - index, len);
    final Object csq = input;
    if (csq instanceof String) {
        String str = (String) csq;
        str.getChars(index, index + count, cbuf, off);
    } else if (csq instanceof Text) {
        Text txt = (Text) csq;
        txt.getChars(index, index + count, cbuf, off);
    } else if (csq instanceof TextBuilder) {
        TextBuilder tb = (TextBuilder) csq;
        tb.getChars(index, index + count, cbuf, off);
    } else if (csq instanceof CharArray) {
        CharArray ca = (CharArray) csq;
        System.arraycopy(ca.array(), index + ca.offset(), cbuf, off, count);
    } else { // Generic CharSequence.
        for (int i = off, n = off + count, j = index; i < n;) {
            cbuf[i++] = input.charAt(j++);
        }
    }
    index += count;
    return count;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:40,代码来源:CharSequenceReader.java


示例16: write

import javolution.text.Text; //导入依赖的package包/类
/**
 * Writes a portion of a string.
 *
 * @param  str a String.
 * @param  off the offset from which to start writing characters.
 * @param  len the number of characters to write.
 * @throws IOException if an I/O error occurs
 */
public void write(String str, int off, int len) throws IOException {
    if (output == null)
        throw new IOException("Writer closed");
    Object obj = str;
    if (obj instanceof CharSequence) {
        output.append((CharSequence) obj);
    } else {
        output.append(Text.valueOf(str));
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:AppendableWriter.java


示例17: toText

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the text representation of this number.
 *
 * @return The string representation of this number as a <code>Text</code>.
 */

public Text toText()
{
    return Text.valueOf(value().toString());
}
 
开发者ID:nick-paul,项目名称:aya-lang,代码行数:11,代码来源:AbstractField.java


示例18: valueOf

import javolution.text.Text; //导入依赖的package包/类
/**
 * Returns the real for the specified character sequence.
 * If the precision is not specified (using the <code>±</code> symbol), 
 * the real is supposed exact. Example of valid character sequences:
 * <li>"1.2E3" (1200 exact)</li>
 * <li>"1.2E3±1E-2" (1200 ± 0.01)</li></ul>
 * 
 * @param  chars the character sequence.
 * @return the corresponding real number.
 * @throws NumberFormatException if the character sequence does not contain
 *         a parsable real.
 */
public static Real valueOf(CharSequence chars) throws NumberFormatException {
    if ('-' == chars.charAt(0)) {
        return valueOf(chars.subSequence(1, chars.length())).opposite();
    }
    Text txt = Text.valueOf(chars); // TODO Use TextFormat...
    if ((txt.length() == 3) && (txt.indexOf("NaN", 0) == 0))
        return NaN;
    if (txt.equals("0"))
        return ZERO;
    int exponentIndex = txt.indexOf("E", 0);
    if (exponentIndex >= 0) {
        int exponent = TypeFormat.parseInt(txt.subtext(exponentIndex + 1,
                txt.length()));
        Real r = valueOf(txt.subtext(0, exponentIndex));
        if (r == ZERO)
            return valueOf(LargeInteger.ZERO, 1, exponent);
        r._exponent += exponent;
        return r;
    }
    Real real = FACTORY.object();
    int errorIndex = txt.indexOf("±", 0);
    if (errorIndex >= 0) {
        real._significand = LargeInteger.valueOf(txt.subtext(0, errorIndex));
        real._error = LargeInteger.valueOf(txt.subtext(errorIndex + 1, txt
                .length()));
        if (real._error.isNegative())
            throw new NumberFormatException(chars
                    + " not parsable (error cannot be negative)");
        real._exponent = 0;
        return real;
    }
    int decimalPointIndex = txt.indexOf(".", 0);
    if (decimalPointIndex >= 0) {
        LargeInteger integer = LargeInteger.valueOf(txt.subtext(0,
                decimalPointIndex));
        LargeInteger fraction = LargeInteger.valueOf(txt.subtext(
                decimalPointIndex + 1, txt.length()));
        int fractionDigits = chars.length() - decimalPointIndex - 1;
        real._significand = integer.isNegative() ? integer.times10pow(
                fractionDigits).minus(fraction) : integer.times10pow(
                fractionDigits).plus(fraction);
        real._error = LargeInteger.ZERO;
        real._exponent = -fractionDigits;
        return real;
    } else {
        real._significand = LargeInteger.valueOf(chars);
        real._error = LargeInteger.ZERO;
        real._exponent = 0;
        return real;
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:64,代码来源:Real.java


示例19: toText

import javolution.text.Text; //导入依赖的package包/类
public Text toText() {
    return TextBuilder.newInstance().append('(').append(_f).append(')')
            .append('o').append('(').append(_g).append(')').toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:Function.java


示例20: toText

import javolution.text.Text; //导入依赖的package包/类
@Override
public Text toText() {
    return Text.valueOf(getClass().getName()).plus("@").plus(
            Text.valueOf(hashCode(), 16));
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:6,代码来源:DiscreteFunction.java



注:本文中的javolution.text.Text类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListOfValuesConstraint类代码示例发布时间:2022-05-22
下一篇:
Java SecondaryLoop类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap