本文整理汇总了C#中java.util.ArrayList.set方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.set方法的具体用法?C# ArrayList.set怎么用?C# ArrayList.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.ArrayList
的用法示例。
在下文中一共展示了ArrayList.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testFormatByPattern
public void testFormatByPattern()
{
NumberFormat newNumFormat = new NumberFormat();
newNumFormat.setPattern("(\\d{3})(\\d{3})(\\d{4})");
newNumFormat.setFormat("($1) $2-$3");
List<NumberFormat> newNumberFormats = new ArrayList<NumberFormat>();
newNumberFormats.add(newNumFormat);
assertEquals("(650) 253-0000", phoneUtil.formatByPattern(US_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+1 (650) 253-0000", phoneUtil.formatByPattern(US_NUMBER,
PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
assertEquals("tel:+1-650-253-0000", phoneUtil.formatByPattern(US_NUMBER,
PhoneNumberFormat.RFC3966,
newNumberFormats));
// $NP is set to '1' for the US. Here we check that for other NANPA countries the US rules are
// followed.
newNumFormat.setNationalPrefixFormattingRule("$NP ($FG)");
newNumFormat.setFormat("$1 $2-$3");
assertEquals("1 (242) 365-1234",
phoneUtil.formatByPattern(BS_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+1 242 365-1234",
phoneUtil.formatByPattern(BS_NUMBER, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
newNumFormat.setPattern("(\\d{2})(\\d{5})(\\d{3})");
newNumFormat.setFormat("$1-$2 $3");
newNumberFormats.set(0, newNumFormat);
assertEquals("02-36618 300",
phoneUtil.formatByPattern(IT_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+39 02-36618 300",
phoneUtil.formatByPattern(IT_NUMBER, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule("$NP$FG");
newNumFormat.setPattern("(\\d{2})(\\d{4})(\\d{4})");
newNumFormat.setFormat("$1 $2 $3");
newNumberFormats.set(0, newNumFormat);
assertEquals("020 7031 3000",
phoneUtil.formatByPattern(GB_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule("($NP$FG)");
assertEquals("(020) 7031 3000",
phoneUtil.formatByPattern(GB_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule("");
assertEquals("20 7031 3000",
phoneUtil.formatByPattern(GB_NUMBER, PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+44 20 7031 3000",
phoneUtil.formatByPattern(GB_NUMBER, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
}
示例2: RegionFile
public RegionFile(File file)
{
lastModified = 0L;
fileName = file;
debugln((new StringBuilder()).append("REGION LOAD ").append(fileName).toString());
sizeDelta = 0;
try
{
if (file.exists())
{
lastModified = file.lastModified();
}
dataFile = new RandomAccessFile(file, "rw");
if (dataFile.length() < 4096L)
{
for (int i = 0; i < 1024; i++)
{
dataFile.writeInt(0);
}
for (int j = 0; j < 1024; j++)
{
dataFile.writeInt(0);
}
sizeDelta += 8192;
}
if ((dataFile.length() & 4095L) != 0L)
{
for (int k = 0; k < (dataFile.length() & 4095L); k++)
{
dataFile.write(0);
}
}
int l = (int) dataFile.length()/4096;
sectorFree = new ArrayList(l);
for (int i1 = 0; i1 < l; i1++)
{
sectorFree.add(Boolean.valueOf(true));
}
sectorFree.set(0, Boolean.valueOf(false));
sectorFree.set(1, Boolean.valueOf(false));
dataFile.seek(0L);
for (int j1 = 0; j1 < 1024; j1++)
{
int l1 = dataFile.readInt();
offsets[j1] = l1;
if (l1 == 0 || (l1 >> 8) + (l1 & 0xff) > sectorFree.size())
{
continue;
}
for (int j2 = 0; j2 < (l1 & 0xff); j2++)
{
sectorFree.set((l1 >> 8) + j2, Boolean.valueOf(false));
}
}
for (int k1 = 0; k1 < 1024; k1++)
{
int i2 = dataFile.readInt();
chunkTimestamps[k1] = i2;
}
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
}