本文整理汇总了Java中java.util.BitSet.and方法的典型用法代码示例。如果您正苦于以下问题:Java BitSet.and方法的具体用法?Java BitSet.and怎么用?Java BitSet.and使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.BitSet
的用法示例。
在下文中一共展示了BitSet.and方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"EquivalentEquipment\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
return message.toString();
}
示例2: modelConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility to check whether this class is consistent according to a subset
*
* @param subset
* the subset defining the context in which to check whether this class is consistent
* @return a ConsistencyCheck instance whose boolean attribute (consistent)
* indicates if this class is consistent and whose String attribute
* (message)
* indicates why this class is not consistent if it is not
*/
@Override
public ConsistencyCheck modelConsistency(final Subset subset) {
BitSet intersection = new BitSet(this.minBitsets.get(subset).length());
intersection.or(this.minBitsets.get(subset));
// we create a copy of minBitsets.get(subset)
intersection.and(this.currentBitset);
boolean consistent = (this.minBitsets.get(subset).equals(intersection));
StringBuilder message = new StringBuilder("");
if (!consistent) {
message.append(getMessageForConsistency(this.minBitsets.get(subset)));
}
return new ConsistencyCheck(consistent, message.toString());
}
示例3: modelConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility to check whether this class is consistent in a "merged" context
*
* @return a ConsistencyCheck instance whose boolean attribute (consistent)
* indicates if this class is consistent and whose String attribute
* (message)
* indicates why this class is not consistent if it is not
*/
@Override
public ConsistencyCheck modelConsistency() {
BitSet intersection = new BitSet(this.minBitset.length());
intersection.or(this.minBitset);
// we create a copy of minBitSet
intersection.and(this.currentBitset);
boolean consistent = (this.minBitset.equals(intersection));
StringBuilder message = new StringBuilder("");
if (!consistent) {
message.append(getMessageForConsistency(this.minBitset));
}
return new ConsistencyCheck(consistent, message.toString());
}
示例4: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"NuclearGeneratingUnit\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
return message.toString();
}
示例5: modelConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility to check whether this class is consistent according to a subset
*
* @param subset
* the subset defining the context in which to check whether this class is consistent
* @return a ConsistencyCheck instance whose boolean attribute (consistent)
* indicates if this class is consistent and whose String attribute
* (message)
* indicates why this class is not consistent if it is not
*/
@Override
public ConsistencyCheck modelConsistency(final Subset subset) {
BitSet intersection = new BitSet(this.minBitsets.get(subset).length());
intersection.or(this.minBitsets.get(subset));
// we create a copy of minBitsets.get(subset)
intersection.and(this.currentBitset);
boolean consistent = (this.minBitsets.get(subset).equals(intersection));
StringBuilder message = new StringBuilder("");
if (!consistent) {
message.append(getMessageForConsistency(this.minBitsets.get(subset)));
}
// consistent = (super.modelConsistency().getLeft()) ? (consistent &&
// (true)):(consistent && (false))
// message.append((super.modelConsistency(subset)).getRight());
if (super.modelConsistency().isConsistent()) {
consistent = consistent && (true);
message.append((super.modelConsistency(subset)).getMessage());
} else {
consistent = consistent && (false);
message.append((super.modelConsistency(subset)).getMessage());
}
return new ConsistencyCheck(consistent, message.toString());
}
示例6: and
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Return logical-and of 'columns'.
* @param columns
* @return
*/
public BitSet and(Collection<Integer> columns) {
if (columns == null) return null;
Iterator<Integer> keyIter = columns.iterator();
BitSet set = (BitSet) getColumn(keyIter.next()).clone();
while (keyIter.hasNext()) {
set.and(getColumn(keyIter.next()));
}
return set;
}
示例7: updateEntrySet
import java.util.BitSet; //导入方法依赖的package包/类
private boolean updateEntrySet(BitSet entrySet, BitSet exitSet,
BitSet useBeforeDef, BitSet notDef) {
int card = entrySet.cardinality();
entrySet.or(exitSet);
entrySet.and(notDef);
entrySet.or(useBeforeDef);
return entrySet.cardinality() != card;
}
示例8: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"SubGeographicalRegion\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
if (isNotSet.get(0)) {
message.append("\t\"Region\" needs to be set\n");
}
if (isNotSet.get(1)) {
message.append("\t\"Substations\" needs to be set\n");
}
return message.toString();
}
示例9: modelConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility to check whether this class is consistent in a "merged" context
*
* @return a ConsistencyCheck instance whose boolean attribute (consistent)
* indicates if this class is consistent and whose String attribute
* (message)
* indicates why this class is not consistent if it is not
*/
@Override
public ConsistencyCheck modelConsistency() {
BitSet intersection = new BitSet(this.minBitset.length());
intersection.or(this.minBitset);
// we create a copy of minBitSet
intersection.and(this.currentBitset);
boolean consistent = (this.minBitset.equals(intersection));
StringBuilder message = new StringBuilder("");
if (!consistent) {
message.append(getMessageForConsistency(this.minBitset));
}
// consistent = (super.modelConsistency().getLeft()) ? (consistent &&
// (true)):(consistent && (false))
// message += (super.modelConsistency(subset)).getRight();
if (super.modelConsistency().isConsistent()) {
consistent = consistent && (true);
message.append((super.modelConsistency()).getMessage());
} else {
consistent = consistent && (false);
message.append((super.modelConsistency()).getMessage());
}
return new ConsistencyCheck(consistent, message.toString());
}
示例10: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"Equipment\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
if (isNotSet.get(0)) {
message.append("\t\"equivalent\" needs to be set\n");
}
if (isNotSet.get(1)) {
message.append("\t\"MemberOf_EquipmentContainer\" needs to be set\n");
}
return message.toString();
}
示例11: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"Conductor\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
if (isNotSet.get(0)) {
message.append("\t\"g0ch\" needs to be set\n");
}
if (isNotSet.get(1)) {
message.append("\t\"b0ch\" needs to be set\n");
}
if (isNotSet.get(2)) {
message.append("\t\"length\" needs to be set\n");
}
if (isNotSet.get(3)) {
message.append("\t\"gch\" needs to be set\n");
}
if (isNotSet.get(4)) {
message.append("\t\"x\" needs to be set\n");
}
if (isNotSet.get(5)) {
message.append("\t\"bch\" needs to be set\n");
}
if (isNotSet.get(6)) {
message.append("\t\"x0\" needs to be set\n");
}
if (isNotSet.get(7)) {
message.append("\t\"r\" needs to be set\n");
}
if (isNotSet.get(8)) {
message.append("\t\"r0\" needs to be set\n");
}
return message.toString();
}
示例12: getMessageForConsistency
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Utility in charge of creating the message when the class is not
* consistent within a specific context
*
* @param minBitset
* bitset describing which CIM attributes of this class have
* to be set so that it is consistent within a
* specific subset context
* @return the message explaining what is not consistent
*/
private String getMessageForConsistency(final BitSet minBitset) {
StringBuilder message = new StringBuilder(
"Instance of \"MutualCoupling\" of id \"");
message.append(this.getId());
message.append("\" is not consistent in this context:\n");
/*
* XOR and then AND
* The result is :
* "1" : has not been set and need to be
* "0" : has been set or is not mandatory
*/
BitSet isNotSet = new BitSet(minBitset.length());
isNotSet.or(minBitset);
// we create a copy of minBitset
isNotSet.xor(this.currentBitset);
isNotSet.and(minBitset);
if (isNotSet.get(0)) {
message.append("\t\"distance21\" needs to be set\n");
}
if (isNotSet.get(1)) {
message.append("\t\"distance12\" needs to be set\n");
}
if (isNotSet.get(2)) {
message.append("\t\"Second_Terminal\" needs to be set\n");
}
if (isNotSet.get(3)) {
message.append("\t\"r0\" needs to be set\n");
}
if (isNotSet.get(4)) {
message.append("\t\"distance11\" needs to be set\n");
}
if (isNotSet.get(5)) {
message.append("\t\"distance22\" needs to be set\n");
}
if (isNotSet.get(6)) {
message.append("\t\"b0ch\" needs to be set\n");
}
if (isNotSet.get(7)) {
message.append("\t\"First_Terminal\" needs to be set\n");
}
if (isNotSet.get(8)) {
message.append("\t\"x0\" needs to be set\n");
}
if (isNotSet.get(9)) {
message.append("\t\"g0ch\" needs to be set\n");
}
return message.toString();
}