本文整理汇总了C#中System.Xml.Schema.BitSet.Get方法的典型用法代码示例。如果您正苦于以下问题:C# BitSet.Get方法的具体用法?C# BitSet.Get怎么用?C# BitSet.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.BitSet
的用法示例。
在下文中一共展示了BitSet.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpectedElements
// returns names of all legal elements following the specified state
internal ArrayList ExpectedElements(int state, BitSet allElementsSet) {
ArrayList names = new ArrayList();
if (IsAllElements) {
for (int i = 0; i < allElementsSet.Count; i++) {
if (!allElementsSet.Get(i)) {
names.Add(symbols[i]);
}
}
}
else {
if (IsCompiled) {
int[] t = null;
if (dtrans != null)
t = (int[])dtrans[state];
if (t!=null) {
for (int i = 0; i < terminalNodes.Count; i++) {
XmlQualifiedName n = ((TerminalNode)terminalNodes[i]).Name;
if (!n.IsEmpty) {
string name = n.ToString();
if (!names.Contains(name)) {
Object lookup = symbolTable[n];
if ((lookup != null) && (t[(int)lookup] != -1)) {
names.Add(name);
}
}
}
}
}
}
else {
//need to deal with not compiled content model
}
}
return names;
}
示例2: Finish
internal void Finish(ValidationEventHandler eventHandler, bool compile) {
stack = null;
IsCompiled = !abnormalContent && compile;
if (contentNode == null)
return;
#if DEBUG
StringBuilder bb = new StringBuilder();
contentNode.Dump(bb);
Debug.WriteLineIf(CompModSwitches.XmlSchema.TraceVerbose, "\t\t\tContent: (" + bb.ToString() + ")");
#endif
// add end node
endNode = NewTerminalNode(XmlQualifiedName.Empty);
contentNode = new InternalNode(contentNode, endNode, ContentNode.Type.Sequence);
((InternalNode)contentNode).LeftNode.ParentNode = contentNode;
endNode.ParentNode = contentNode;
if (!IsCompiled) {
CheckXsdDeterministic(eventHandler);
return;
}
if (nodeTable == null)
nodeTable = new Hashtable();
// calculate followpos
int terminals = terminalNodes.Count;
BitSet[] followpos = new BitSet[terminals];
for (int i = 0; i < terminals; i++) {
followpos[i] = new BitSet(terminals);
}
contentNode.CalcFollowpos(followpos);
// state table
ArrayList Dstates = new ArrayList(16);
// transition table
dtrans = new ArrayList(16);
// lists unmarked states
ArrayList unmarked = new ArrayList(16);
// state lookup table
Hashtable statetable = new Hashtable();
BitSet empty = new BitSet(terminals);
statetable.Add(empty, -1);
// start with firstpos at the root
BitSet set = contentNode.Firstpos(terminals);
statetable.Add(set, Dstates.Count);
unmarked.Add(set);
Dstates.Add(set);
int[] a = new int[symbols.Count + 1];
dtrans.Add(a);
if (set.Get(endNode.Pos)) {
a[symbols.Count] = 1; // accepting
}
// current state processed
int state = 0;
// check all unmarked states
while (unmarked.Count > 0) {
int[] t = (int[])dtrans[state];
set = (BitSet)unmarked[0];
CheckDeterministic(set, terminals, eventHandler);
unmarked.RemoveAt(0);
// check all input symbols
for (int sym = 0; sym < symbols.Count; sym++) {
XmlQualifiedName n = (XmlQualifiedName)symbols[sym];
BitSet newset = new BitSet(terminals);
// if symbol is in the set add followpos to new set
for (int i = 0; i < terminals; i++) {
if (set.Get(i) && n.Equals(((TerminalNode)terminalNodes[i]).Name)) {
newset.Or(followpos[i]);
}
}
Object lookup = statetable[newset];
// this state will transition to
int transitionTo;
// if new set is not in states add it
if (lookup == null) {
transitionTo = Dstates.Count;
statetable.Add(newset, transitionTo);
unmarked.Add(newset);
Dstates.Add(newset);
a = new int[symbols.Count + 1];
dtrans.Add(a);
if (newset.Get(endNode.Pos)) {
a[symbols.Count] = 1; // accepting
}
}
else {
transitionTo = (int)lookup;
}
// set the transition for the symbol
//.........这里部分代码省略.........
示例3: CheckDeterministic
private void CheckDeterministic(BitSet set, int t, ValidationEventHandler eventHandler) {
nodeTable.Clear();
for (int i = 0; i < t; i++) {
if (set.Get(i)) {
XmlQualifiedName n = ((TerminalNode)terminalNodes[i]).Name;
if (!n.IsEmpty) {
if (nodeTable[n] == null) {
nodeTable.Add(n, n);
}
else {
if (eventHandler != null) {
eventHandler(this, new ValidationEventArgs(new XmlSchemaException(Res.Sch_NonDeterministic,n.ToString())));
}
else {
throw new XmlSchemaException(Res.Sch_NonDeterministic,n.ToString());
}
}
}
}
}
}
示例4: IsSequenceFromAll
private bool IsSequenceFromAll(XmlSchemaSequence derivedSequence, XmlSchemaAll baseAll) {
if (!IsValidOccurrenceRangeRestriction(derivedSequence, baseAll) || derivedSequence.Items.Count > baseAll.Items.Count) {
return false;
}
BitSet map = new BitSet(baseAll.Items.Count);
foreach (XmlSchemaParticle p in derivedSequence.Items) {
int i = GetMappingParticle(p, baseAll.Items);
if (i >= 0) {
if (map.Get(i)) {
return false;
}
else {
map.Set(i);
}
}
else {
return false;
}
}
for (int i = 0; i < baseAll.Items.Count; i++) {
if (!map.Get(i) && !IsParticleEmptiable((XmlSchemaParticle)baseAll.Items[i])) {
return false;
}
}
return true;
}