本文整理匯總了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);
}