本文整理汇总了Java中org.eclipse.imp.pdb.facts.IString类的典型用法代码示例。如果您正苦于以下问题:Java IString类的具体用法?Java IString怎么用?Java IString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IString类属于org.eclipse.imp.pdb.facts包,在下文中一共展示了IString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eval
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public IString eval(IString s) {
EvalUtilities util = new EvalUtilities();
IExpr result;
try {
StringBufferWriter buf = new StringBufferWriter();
result = util.evaluate(s.getValue());
OutputFormFactory.get().convert(buf, result);
String output = buf.toString();
return values.string(output);
} catch (final Exception e) {
System.err.printf(e.getMessage());
} finally {
ComputerThreads.terminate();
}
return s;
}
示例2: newString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
static IString newString(String value, boolean fullUnicode) {
if (value ==null) value = "";
if (fullUnicode) {
return new FullUnicodeString(value);
}
return new SimpleUnicodeString(value);
}
示例3: concat
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
@Override
public IString concat(IString other){
StringBuilder buffer = new StringBuilder();
buffer.append(value);
buffer.append(other.getValue());
return StringValue.newString(buffer.toString(), true);
}
示例4: compare
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
@Override
public int compare(IString other){
int result = value.compareTo(other.getValue());
if(result > 0) return 1;
if(result < 0) return -1;
return 0;
}
示例5: string
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
@Override
public IString string(int[] chars) {
StringBuilder b = new StringBuilder(chars.length);
for (int ch : chars) {
b.appendCodePoint(ch);
}
return string(b.toString());
}
示例6: writeString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
private void writeString(IString string) throws IOException{
out.write(STRING_HEADER);
String theString = string.getValue();
byte[] stringData = theString.getBytes(CharEncoding);
printInteger(stringData.length);
out.write(stringData);
}
示例7: readString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
private IString readString() throws IOException{
int size = parseInteger();
byte[] data = new byte[size];
for(int i = 0; i< size; i++){
data[i] = (byte) read();
}
return valueFactory.string(new String(data, BinaryWriter.CharEncoding));
}
示例8: visitString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public IValue visitString(IString o) throws IOException {
// TODO optimize this implementation and finish all escapes
append('\"');
append(o.getValue().replaceAll("\"", "\\\"").replaceAll("\n","\\\\n"));
append('\"');
return o;
}
示例9: readFixed
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
private void readFixed(Type expected, char end, List<IValue> arr, Map<String,IValue> kwParams) throws IOException {
current = stream.read();
for (int i = 0; current != end; i++) {
Type exp = expected.isFixedWidth() ? expected.getFieldType(i) : types.valueType();
IValue elem = readValue(exp);
if (current == '=') {
String label = ((IString) elem).getValue();
current = stream.read();
if (expected.isConstructor() && expected.hasField(label)) {
kwParams.put(label, readValue(expected.getFieldType(label)));
}
else {
kwParams.put(label, readValue(types.valueType()));
}
}
else {
arr.add(elem);
}
if (current != ',' || current == end) {
break; // no more elements, so expecting a 'end', or '='
}
current = stream.read();
}
checkAndRead(end);
}
示例10: visitString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public T visitString(IString o) throws E {
return fVisitor.visitString(o);
}
示例11: visitString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public T visitString(IString o) throws E{
return null;
}
示例12: visitString
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public IValue visitString(IString o) throws E{
return o;
}
示例13: reverse
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
@Override
public IString reverse() {
StringBuilder b = new StringBuilder(value);
return newString(b.reverse().toString(), true);
}
示例14: substring
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
@Override
public IString substring(int start, int end) {
return newString(value.substring(value.offsetByCodePoints(0, start),value.offsetByCodePoints(0, end)));
}
示例15: string
import org.eclipse.imp.pdb.facts.IString; //导入依赖的package包/类
public IString string(String s) {
return adapted.string(s);
}