本文整理汇总了Java中brut.util.Duo类的典型用法代码示例。如果您正苦于以下问题:Java Duo类的具体用法?Java Duo怎么用?Java Duo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Duo类属于brut.util包,在下文中一共展示了Duo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeValue
import brut.util.Duo; //导入依赖的package包/类
private String decodeValue(int value) throws AndrolibException {
String value2 = mItemsCache.get(value);
if (value2 == null) {
ResReferenceValue ref = null;
for (Duo<ResReferenceValue, ResIntValue> duo : mItems) {
if (duo.m2.getValue() == value) {
ref = duo.m1;
break;
}
}
if (ref != null) {
value2 = ref.getReferent().getName();
mItemsCache.put(value, value2);
}
}
return value2;
}
示例2: serializeToResValuesXml
import brut.util.Duo; //导入依赖的package包/类
@Override
public void serializeToResValuesXml(XmlSerializer serializer,
ResResource res) throws IOException, AndrolibException {
String type = res.getResSpec().getType().getName();
if ("style".equals(type)) {
new ResStyleValue(mParent, new Duo[0], null)
.serializeToResValuesXml(serializer, res);
return;
}
if ("array".equals(type)) {
new ResArrayValue(mParent, new Duo[0]).serializeToResValuesXml(
serializer, res);
return;
}
if ("plurals".equals(type)) {
new ResPluralsValue(mParent, new Duo[0]).serializeToResValuesXml(
serializer, res);
return;
}
serializer.startTag(null, "item");
serializer.attribute(null, "type", type);
serializer.attribute(null, "name", res.getResSpec().getName());
serializer.endTag(null, "item");
}
示例3: bagFactory
import brut.util.Duo; //导入依赖的package包/类
public ResBagValue bagFactory(int parent, Duo<Integer, ResScalarValue>[] items) throws AndrolibException {
ResReferenceValue parentVal = newReference(parent, null);
if (items.length == 0) {
return new ResBagValue(parentVal);
}
int key = items[0].m1;
if (key == ResAttr.BAG_KEY_ATTR_TYPE) {
return ResAttr.factory(parentVal, items, this, mPackage);
}
if (key == ResArrayValue.BAG_KEY_ARRAY_START) {
return new ResArrayValue(parentVal, items);
}
if (key >= ResPluralsValue.BAG_KEY_PLURALS_START && key <= ResPluralsValue.BAG_KEY_PLURALS_END) {
return new ResPluralsValue(parentVal, items);
}
return new ResStyleValue(parentVal, items, this);
}
示例4: enumerateNonPositionalSubstitutionsIfRequired
import brut.util.Duo; //导入依赖的package包/类
public static String enumerateNonPositionalSubstitutionsIfRequired(String str) {
Duo<List<Integer>, List<Integer>> tuple = findSubstitutions(str, 2);
if (tuple.m1.isEmpty() || tuple.m1.size() + tuple.m2.size() < 2) {
return str;
}
List<Integer> subs = tuple.m1;
StringBuilder out = new StringBuilder();
int pos = 0;
int count = 0;
for (Integer sub : subs) {
out.append(str.substring(pos, ++sub)).append(++count).append('$');
pos = sub;
}
out.append(str.substring(pos));
return out.toString();
}
示例5: readComplexEntry
import brut.util.Duo; //导入依赖的package包/类
private ResBagValue readComplexEntry() throws IOException, AndrolibException {
int parent = mIn.readInt();
int count = mIn.readInt();
ResValueFactory factory = mPkg.getValueFactory();
Duo<Integer, ResScalarValue>[] items = new Duo[count];
ResIntBasedValue resValue;
int resId;
for (int i = 0; i < count; i++) {
resId = mIn.readInt();
resValue = readValue();
if (resValue instanceof ResScalarValue) {
items[i] = new Duo<Integer, ResScalarValue>(resId, (ResScalarValue) resValue);
} else {
resValue = new ResStringValue(resValue.toString(), resValue.getRawIntValue());
items[i] = new Duo<Integer, ResScalarValue>(resId, (ResScalarValue) resValue);
}
}
return factory.bagFactory(parent, items);
}
示例6: bagFactory
import brut.util.Duo; //导入依赖的package包/类
public ResBagValue bagFactory(int parent,
Duo<Integer, ResScalarValue>[] items) throws AndrolibException {
ResReferenceValue parentVal = newReference(parent, null);
if (items.length == 0) {
return new ResBagValue(parentVal);
}
int key = items[0].m1;
if (key == ResAttr.BAG_KEY_ATTR_TYPE) {
return ResAttr.factory(parentVal, items, this, mPackage);
}
if (key == ResArrayValue.BAG_KEY_ARRAY_START) {
return new ResArrayValue(parentVal, items);
}
if (key >= ResPluralsValue.BAG_KEY_PLURALS_START
&& key <= ResPluralsValue.BAG_KEY_PLURALS_END) {
return new ResPluralsValue(parentVal, items);
}
return new ResStyleValue(parentVal, items, this);
}
示例7: decodeValue
import brut.util.Duo; //导入依赖的package包/类
private String decodeValue(int value) throws AndrolibException {
String value2 = mItemsCache.get(value);
if (value2 == null) {
ResReferenceValue ref = null;
for (Duo<ResReferenceValue, ResIntValue> duo : mItems) {
if (duo.m2.getValue() == value) {
ref = duo.m1;
break;
}
}
if (ref != null) {
value2 = ref.getReferent().getName();
mItemsCache.put(value, value2);
}
}
return value2;
}
示例8: serializeToResValuesXml
import brut.util.Duo; //导入依赖的package包/类
@Override
public void serializeToResValuesXml(XmlSerializer serializer,
ResResource res) throws IOException, AndrolibException {
String type = res.getResSpec().getType().getName();
if ("style".equals(type)) {
new ResStyleValue(mParent, new Duo[0], null)
.serializeToResValuesXml(serializer, res);
return;
}
if ("array".equals(type)) {
new ResArrayValue(mParent, new Duo[0]).serializeToResValuesXml(
serializer, res);
return;
}
if ("plurals".equals(type)) {
new ResPluralsValue(mParent, new Duo[0]).serializeToResValuesXml(
serializer, res);
return;
}
serializer.startTag(null, "item");
serializer.attribute(null, "type", type);
serializer.attribute(null, "name", res.getResSpec().getName());
serializer.endTag(null, "item");
}
示例9: ResFlagsAttr
import brut.util.Duo; //导入依赖的package包/类
ResFlagsAttr(ResReferenceValue parent, int type, Integer min, Integer max,
Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) {
super(parent, type, min, max, l10n);
mItems = new FlagItem[items.length];
for (int i = 0; i < items.length; i++) {
mItems[i] = new FlagItem(items[i].m1, items[i].m2.getValue());
}
}
示例10: serializeBody
import brut.util.Duo; //导入依赖的package包/类
@Override
protected void serializeBody(XmlSerializer serializer, ResResource res)
throws AndrolibException, IOException {
for (Duo<ResReferenceValue, ResIntValue> duo : mItems) {
int intVal = duo.m2.getValue();
serializer.startTag(null, "enum");
serializer.attribute(null, "name", duo.m1.getReferent().getName());
serializer.attribute(null, "value", String.valueOf(intVal));
serializer.endTag(null, "enum");
}
}
示例11: ResPluralsValue
import brut.util.Duo; //导入依赖的package包/类
ResPluralsValue(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items) {
super(parent);
mItems = new ResScalarValue[6];
for (int i = 0; i < items.length; i++) {
mItems[items[i].m1 - BAG_KEY_PLURALS_START] = items[i].m2;
}
}
示例12: ResArrayValue
import brut.util.Duo; //导入依赖的package包/类
ResArrayValue(ResReferenceValue parent, Duo<Integer, ResScalarValue>[] items) {
super(parent);
mItems = new ResScalarValue[items.length];
for (int i = 0; i < items.length; i++) {
mItems[i] = items[i].m2;
}
}
示例13: ResStyleValue
import brut.util.Duo; //导入依赖的package包/类
ResStyleValue(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items, ResValueFactory factory) {
super(parent);
mItems = new Duo[items.length];
for (int i = 0; i < items.length; i++) {
mItems[i] = new Duo<ResReferenceValue, ResScalarValue>(
factory.newReference(items[i].m1, null), items[i].m2);
}
}
示例14: getResFileDecoder
import brut.util.Duo; //导入依赖的package包/类
public Duo<ResFileDecoder, AXmlResourceParser> getResFileDecoder() {
ResStreamDecoderContainer decoders = new ResStreamDecoderContainer();
decoders.setDecoder("raw", new ResRawStreamDecoder());
decoders.setDecoder("9patch", new Res9patchStreamDecoder());
AXmlResourceParser axmlParser = new AXmlResourceParser();
axmlParser.setAttrDecoder(new ResAttrDecoder());
decoders.setDecoder("xml", new XmlPullStreamDecoder(axmlParser, getResXmlSerializer()));
return new Duo<ResFileDecoder, AXmlResourceParser>(new ResFileDecoder(decoders), axmlParser);
}
示例15: fromInternalName
import brut.util.Duo; //导入依赖的package包/类
public static TypeName fromInternalName(String internal)
throws AndrolibException {
Duo<TypeName, Integer> duo = fetchFromInternalName(internal);
if (duo.m2 != internal.length()) {
throw new AndrolibException("Invalid internal name: " + internal);
}
return duo.m1;
}