本文整理汇总了C#中System.Collections.Hashtable.Substring方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.Substring方法的具体用法?C# Hashtable.Substring怎么用?C# Hashtable.Substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Hashtable
的用法示例。
在下文中一共展示了Hashtable.Substring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Schema
/**
* @param nameLiterals
* Name literals encoded into a string as
* "[stateId1][uri1]\u0000[local1]\u0000[stateid2][uri2]\u0000 ..."
* @param defaultNameCode
* The name code assigned to literals that are not described in the above
* dictionary.
* @param encStates
* encoded state information.
* @param encATr, encDTr, encETr, encITr, encLTr, encNTr, encVTr
* encoded transition tables (per alphabet type.)
* @param datatypes
* Datatype objects used in this schema.
* @param values
* Values used by <value/> patterns.
*/
public Schema(
string nameLiterals,
int defaultNameCode,
string encStates,
string encATr,
string encDTr,
string encETr,
string encITr,
string encLTr,
string encNTr,
string encVTr,
Datatype[] datatypes,
object[] values)
{
// decode name literals
while(nameLiterals.Length!=0) {
int code = decodeInt(nameLiterals,0); // name code
nameLiterals = nameLiterals.Substring(2);
int idx;
idx = nameLiterals.IndexOf('\u0000');
string uri = nameLiterals.Substring(0,idx);
nameLiterals = nameLiterals.Substring(idx+1);
idx = nameLiterals.IndexOf('\u0000');
string local = nameLiterals.Substring(0,idx);
nameLiterals = nameLiterals.Substring(idx+1);
this.nameLiterals.Add( new StringPair(uri,local), code );
}
this.defaultNameCode = defaultNameCode;
{// decode state and transition table
string es;
State.Single[] states = new State.Single[ encStates.Length/sizeOfState ];
// build basic state objects
es=encStates;
for( int idx=0; es.Length!=0; idx++,es=es.Substring(sizeOfState) ) {
char bitFlags = es[0];
states[idx] = new State.Single( (bitFlags&2)!=0, (bitFlags&1)!=0, idx );
}
bool[] decoded = new bool[states.Length];
// bare stack.
int[] stack = new int[16];
int stackPtr=0;
// decode transition table
for( int idx=states.Length-1; idx>=0; idx-- ) {
int s = idx;
while( s!=65535 && !decoded[s] ) {
// this state needs to be decoded -- push this state
if( stack.Length==stackPtr ) {
// extend the stack
int[] newBuf = new int[stack.Length*2];
stack.CopyTo( newBuf,0 );
stack = newBuf;
}
stack[stackPtr++] = s;
decoded[s] = true;
// decode next state
s = encStates[ s*sizeOfState+1 ];
}
while( stackPtr!=0 ) {
// decode transitions from state 's'.
s = stack[--stackPtr];
State.Single current = states[s];
// next state
int nextStateIdx = encStates[ s*sizeOfState+1 ];
State.Single nextState = (nextStateIdx==65535)?null:states[nextStateIdx];
// decode transitions
current.aTr = decodeATr( encStates, encATr, states, s, nextState==null?null:nextState.aTr );
current.dTr = decodeDTr( encStates, encDTr, states, s, nextState==null?null:nextState.dTr, datatypes );
current.eTr = decodeETr( encStates, encETr, states, s, nextState==null?null:nextState.eTr );
//.........这里部分代码省略.........