本文整理汇总了C#中com.ximpleware.VTDNav.getCurrentIndex2方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getCurrentIndex2方法的具体用法?C# VTDNav.getCurrentIndex2怎么用?C# VTDNav.getCurrentIndex2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ximpleware.VTDNav
的用法示例。
在下文中一共展示了VTDNav.getCurrentIndex2方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: process_self
private int process_self(VTDNav vn)
{
bool b1 = false;
Predicate t = null;
int result;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContext)
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1)
{
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
else
state = END;
break;
}
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
}
else
{
state = TERMINAL;
if (vn.atTerminal)
result = vn.LN;
else
result = vn.getCurrentIndex2();
if (isUnique(result))
return result;
}
}
else
{
if (currentStep.hasPredicate)
currentStep.resetP(vn);
if (state == START)
state = END;
else
state = BACKWARD;
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
case TERMINAL:
if (currentStep.prevS != null)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
else
{
state = END;
}
break;
default:
throw new XPathEvalException("unknown state");
}
return -2;
}
示例2: process_ancestor2
protected internal int process_ancestor2( VTDNav vn)
{
int result;
bool b = false, b1 = false;
//int contextSize;
Predicate t= null;
switch(state){
case START:
t = currentStep.p;
while (t != null) {
if (t.requireContext) {
int i = computeContextSize( t, vn);
if (i == 0) {
b1 = true;
break;
} else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1) {
state = END;
break;
}
state = END;
//if (vn.getCurrentDepth() != -1) {
vn.push2();
while (vn.toNode(VTDNav.P)) {
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
if (currentStep.nextS != null) {
state = FORWARD;
currentStep = currentStep.nextS;
break;
} else {
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex2();
if (isUnique(result))
return result;
}
}
}
if (state == END) {
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
}
// }
break;
case END:
currentStep =null;
// reset();
return -1;
case FORWARD:
t = currentStep.p;
while(t!=null){
if (t.requireContext){
int i = computeContextSize(t,vn);
if (i==0){
b1 = true;
break;
}else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1){
currentStep = currentStep.prevS;
state = BACKWARD;
break;
}
state = BACKWARD;
vn.push2();
while(vn.toNode(VTDNav.P)){
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
if (currentStep.nextS != null){
state = FORWARD;
currentStep = currentStep.nextS;
break;
}
else {
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex2();
if ( isUnique(result))
return result;
}
}
}
if ( state == BACKWARD){
if (currentStep.hasPredicate)
//.........这里部分代码省略.........
示例3: process_DDFP
//.........这里部分代码省略.........
b = false;
while (ap.iterate())
{
if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
{
b = true;
break;
}
}
if (b == false)
{
vn.pop2();
//System.out.println(" --++ pop in //");
currentStep.ft = true;
if (currentStep.hasPredicate)
currentStep.resetP(vn);
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
}
else
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
}
else
{
//vn.pop();
state = TERMINAL;
result = vn.getCurrentIndex2();
if (isUnique(result))
return result;
}
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
//currentStep = currentStep.prevS;
if (currentStep.out_of_range)
{
currentStep.out_of_range = false;
transition_DDFP(vn);
break;
}
ap = (AutoPilot)currentStep.o;
//vn.push();
//b = false;
while (ap.iterate())
{
if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
{
b = true;
break;
}
}
if (b)
{
示例4: process_preceding_sibling
private int process_preceding_sibling(VTDNav vn)
{
bool b = false, b1 = false;
Predicate t = null;
int result;
switch (state)
{
case START:
case FORWARD:
t = currentStep.p;
while (t != null)
{
if (t.requireContext)
{
int i = computeContextSize(t, vn);
if (i == 0)
{
b1 = true;
break;
}
else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1)
{
if (state == FORWARD)
{
state = BACKWARD;
currentStep = currentStep.prevS;
}
else
state = END;
break;
}
if (state == START)
state = END;
else
state = BACKWARD;
vn.push2();
while (vn.toElement(VTDNav.PS))
{
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
break;
}
else
{
state = TERMINAL;
result = vn.getCurrentIndex2();
if (isUnique(result))
return result;
}
}
}
if(state == END) {
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
}else if (state == BACKWARD)
{
if (currentStep.hasPredicate)
currentStep.resetP(vn);
vn.pop2();
currentStep = currentStep.prevS;
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
if (currentStep.out_of_range)
{
currentStep.out_of_range = false;
transition_preceding_sibling(vn);
break;
}
while (vn.toElement(VTDNav.PS))
{
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
{
if (currentStep.nextS != null)
{
state = FORWARD;
currentStep = currentStep.nextS;
b = true;
break;
}
else
{
//.........这里部分代码省略.........
示例5: process_child
private int process_child(VTDNav vn)
{
int result;
bool b = false, b1 = false;
int k=1;
Predicate t= null;
// Console.WriteLine(" index-============= " + vn.getCurrentIndex());
// Console.WriteLine(" depth ==============" + vn.getCurrentDepth());
switch(state){
case START:
//if (currentStep.nt.testType < NodeTest.TEXT){
// first search for any predicate that
// requires contextSize
// if so, compute its context size
// if size > 0
// set context
// if size ==0
// immediately set the state to backward or end
t = currentStep.p;
while(t!=null){
if (t.requireContext){
int i = computeContextSize(t,vn);
if (i==0){
b1 = true;
break;
}else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1){
state = END;
break;
}
b=vn.toElement(VTDNav.FIRST_CHILD);
state = END;
if (b ){
do {
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
if (currentStep.nextS != null){
//currentStep.position++;
state = FORWARD;
currentStep = currentStep.nextS;
}
else {
state = TERMINAL;
result = vn.getCurrentIndex2();
if ( isUnique(result)){
return result;
}
}
break;
}
} while (vn.toElement(VTDNav.NS));
if (state == END)
vn.toElement(VTDNav.PARENT);
}
break;
case END:
currentStep =null;
// reset();
return -1;
case FORWARD:
//if (currentStep.nt.testType < NodeTest.TEXT){
t = currentStep.p;
while(t!=null){
if (t.requireContext){
int i = computeContextSize(t,vn);
if (i==0){
b1 = true;
break;
}else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1){
currentStep = currentStep.prevS;
state = BACKWARD;
break;
}
state = BACKWARD;
if (vn.toElement(VTDNav.FC)) {
do {
if ((currentStep.nt_eval || currentStep.nt.eval(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
if (currentStep.nextS != null) {
state = FORWARD;
currentStep = currentStep.nextS;
} else {
state = TERMINAL;
result = vn.getCurrentIndex2();
if ( isUnique(result))
return result;
}
//.........这里部分代码省略.........
示例6: process_parent2
protected internal int process_parent2(VTDNav vn)
{
bool b1 = false;
Predicate t= null;
int result;
switch ( state) {
case START:
case FORWARD:
t = currentStep.p;
while(t!=null){
if (t.requireContext){
int i = computeContextSize(t,vn);
if (i==0){
b1 = true;
break;
}else
t.ContextSize=(i);
}
t = t.nextP;
}
if (b1){
if (state == FORWARD){
state = BACKWARD;
currentStep = currentStep.prevS;
}else
state = END;
break;
}
if (vn.getCurrentDepth() == -1) {
if ( state == START)
state = END;
else {
//vn.pop();
state = BACKWARD;
currentStep = currentStep.prevS;
}
} else {
vn.push2();
vn.toNode(VTDNav.P); // must return true
if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
if (currentStep.nextS != null) {
state = FORWARD;
currentStep = currentStep.nextS;
} else {
state = TERMINAL;
result = vn.getCurrentIndex2();
if ( isUnique(result))
return result;
}
}else{
vn.pop2();
if (currentStep.hasPredicate)
currentStep.resetP(vn);
if ( state == START)
state = END;
else {
state = BACKWARD;
currentStep = currentStep.prevS;
}
}
}
break;
case END:
currentStep = null;
// reset();
return -1;
case BACKWARD:
case TERMINAL:
if (currentStep.prevS == null) {
vn.pop2();
state = END;
break;
}else {
vn.pop2();
state = BACKWARD;
currentStep = currentStep.prevS;
break;
}
default:
throw new XPathEvalException("unknown state");
}
return -2;
}
示例7: evalNodeSet
public override int evalNodeSet(VTDNav vn)
{
switch (opCode)
{
case FuncName.CURRENT:
if (state == START)
{
vn.loadCurrentNode();
state = END;
return vn.getCurrentIndex2();
}
else
{
return -1;
}
// break;
case FuncName.DOCUMENT:
if (argCount1 == 1)
{
if (!argumentList.e.NodeSet)
{
if (state == START)
{
String s = argumentList.e.evalString(vn);
if (s.Length == 0)
{
newVN = xslVN;
newVN.context[0] = -1;
}
else if (vg.parseFile(s, true))
{
newVN = vg.getNav();
newVN.context[0] = -1;
newVN.URIName = s;
}
else
{
state = END;
return -1;
}
state = END;
return 0;
}
else
{
return -1;
}
}
else
{
try
{
if (state != END)
{
a = argumentList.e.evalNodeSet(vn);
if (a != -1)
{
String s = vn.toString(getStringVal(vn, a));
if (s.Length == 0)
{
newVN = xslVN;
newVN.context[0] = -1;
}
else if (vg.parseFile(s, true))
{
newVN = vg.getNav();
newVN.context[0] = -1;
newVN.URIName = s;
}
else
{
state = END;
return -1;
}
state = END;
return 0;
}
else
{
state = END;
return -1;
}
}
else
return -1;
}
catch (NavException e)
{
}
}
}
break;
case FuncName.KEY:
throw new XPathEvalException(" key() not yet implemented ");
// break;
}
throw new XPathEvalException(" Function Expr can't eval to node set ");
}
示例8: generateID
/**
* generate-id(nodeset?);
* @param vn
* @return
*/
private String generateID(VTDNav vn)
{
if (argCount1 == 0)
{
return "v" + vn.getCurrentIndex2();
}
else if (argCount1 == 1)
{
int i = evalFirstArgumentListNodeSet2(vn);
return "v" + i;
}
else
throw new ArgumentException
("generate-id()'s argument count is invalid");
}
示例9: getStringLen
private int getStringLen(VTDNav vn)
{
if (argCount1 == 0)
{
try
{
if (vn.atTerminal == true)
{
int type = vn.getTokenType(vn.LN);
if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
{
return vn.getStringLength(vn.LN + 1);
}
else
{
return vn.getStringLength(vn.LN);
}
}
else
{
int k = vn.getCurrentIndex2();
// int type = vn.getTokenType(k);
return vn.XPathStringLength(k);
}
}
catch (NavException e)
{
return 0;
}
}
else if (argCount1 == 1)
{
int result = 0;
if (argumentList.e.NodeSet)
{
int a = 0x7fffffff, k = -1;
vn.push2();
int size = vn.contextStack2.size;
try
{
if (argumentList.e.needReordering)
{
argumentList.e.adjust(vn.getTokenCount());
while ((k = argumentList.e.evalNodeSet(vn)) != -1)
{
if (k < a)
a = k; // a is always smaller
}
if (a == 0x7fffffff)
{
a = -1;
}
}
else
{
a = argumentList.e.evalNodeSet(vn);
}
if (a == -1)
result = 0;
else
{
int type = vn.getTokenType(a);
if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS || type == VTDNav.TOKEN_PI_NAME)
{
result = vn.getStringLength(a + 1);
}
else if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_DOCUMENT)
{
result = vn.XPathStringLength(a);
}
else
{
result = vn.getStringLength(a);
}
}
}
catch (VTDException e)
{
}
argumentList.e.reset(vn);
vn.contextStack2.size = size;
vn.pop2();
return result;
}
else
return argumentList.e.evalString(vn).Length;
}
else
{
throw new System.ArgumentException("string-length()'s argument count is invalid");
}
}