本文整理了Java中xdi2.core.util.XDIAddressUtil.endsWithXDIAddress()
方法的一些代码示例,展示了XDIAddressUtil.endsWithXDIAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XDIAddressUtil.endsWithXDIAddress()
方法的具体详情如下:
包路径:xdi2.core.util.XDIAddressUtil
类名称:XDIAddressUtil
方法名:endsWithXDIAddress
[英]Checks if an address ends with a certain other address.
[中]检查一个地址是否以某个其他地址结尾。
代码示例来源:origin: projectdanube/xdi2
/**
* Checks if an address ends with a certain other address.
*/
public static XDIAddress[] endsWithXDIAddress(final XDIAddress XDIaddress, final XDIAddress endXDIAddress) {
return endsWithXDIAddress(XDIaddress, endXDIAddress, false, false);
}
代码示例来源:origin: projectdanube/xdi2
/**
* Removes an end address from an address.
* E.g. for =a*b*c*d and *c*d, this returns =a*b
* E.g. for =a*b*c*d and (empty address), this returns =a*b*c*d
* E.g. for =a*b*c*d and =a*b*c*d, this returns (empty address)
* E.g. for =a*b*c*d and *y, this returns null
*/
public static XDIAddress removeEndXDIAddress(final XDIAddress XDIaddress, final XDIAddress endXDIAddress, final boolean variablesinXDIAddress, final boolean variablesInEnd) {
if (XDIaddress == null) throw new NullPointerException();
if (endXDIAddress == null) throw new NullPointerException();
XDIAddress result = null;
try {
if (endXDIAddress.equals(XDIConstants.XDI_ADD_ROOT)) { result = XDIaddress; return result; }
if (XDIaddress.equals(XDIConstants.XDI_ADD_ROOT)) { result = null; return result; }
XDIAddress[] foundXDIAddress = XDIAddressUtil.endsWithXDIAddress(XDIaddress, endXDIAddress, variablesinXDIAddress, variablesInEnd);
if (foundXDIAddress == null) { result = null; return result; }
if (XDIaddress.equals(foundXDIAddress[0])) { result = XDIConstants.XDI_ADD_ROOT; return result; }
{ result = XDIAddressUtil.parentXDIAddress(XDIaddress, - foundXDIAddress[0].getNumXDIArcs()); return result; }
} finally {
if (log.isTraceEnabled()) log.trace("removeEndXDIAddress(" + XDIaddress + "," + endXDIAddress + "," + variablesinXDIAddress + "," + variablesInEnd + ") --> " + result);
}
}
代码示例来源:origin: projectdanube/xdi2
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*d")), XDIAddress.create("*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*c*d")), XDIAddress.create("*c*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b*c*d")), XDIAddress.create("*b*c*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("=a*b*c*d")), XDIAddress.create("=a*b*c*d"));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*y*d")));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b*y*d")));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("{}"), false, true), XDIAddress.create("*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("{}*d"), false, true), XDIAddress.create("*c*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b{}{}"), false, true), XDIAddress.create("*b*c*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("=a*b*c{}"), false, true), XDIAddress.create("=a*b*c*d"));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*y*d"), false, true));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b*y*d"), false, true));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("{}"), false, false));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("{}*d"), false, false));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b{}{}"), false, false));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("=a*b*c{}"), false, false));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*y*d"), false, false));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("*b*y*d"), false, false));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("*d"), true, false), XDIAddress.create("*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("*c*d"), true, false), XDIAddress.create("{}*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("*b*c*d"), true, false), XDIAddress.create("*b{}*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("=a*b*c*d"), true, false), XDIAddress.create("{}*b{}*d"));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("*y*d"), true, false), XDIAddress.create("{}*d"));
assertNull(XDIAddressUtil.endsWithXDIAddress(XDIaddress2, XDIAddress.create("*y*c*d"), true, false));
assertEquals(XDIAddressUtil.endsWithXDIAddress(XDIaddress1, XDIAddress.create("=a*b*c{{=*}}"), false, true), XDIaddress1);
内容来源于网络,如有侵权,请联系作者删除!