コード例 #1
0
 public void setAssignmentProperty(PROPERTY p, boolean v) {
   if (varPropertiesForAssignment == null
       || varPropertiesForAssignment == VariableProperties.defaultProperties) {
     varPropertiesForAssignment = new VariableProperties();
     varPropertiesForAssignment.setProperty(p, v);
   } else {
     varPropertiesForAssignment.setProperty(p, v);
   }
 }
コード例 #2
0
 public String toString(boolean shortForm, String effectXmlName) {
   String ret = "";
   if (shortForm) {
     if (isAssertion()) ret += XMLConstants.AssignmentID + "(" + left + "," + right + ")";
     else if (isAssignment())
       ret += XMLConstants.AssignmentID + "(" + left + "," + getAssignedExpression() + ")";
     else if (isGoalAchievement())
       ret +=
           XMLConstants.GOALID
               + ": "
               + goalName
               + ((left != null) ? " " + XMLConstants.VALUEID + ": " + left : "");
     else if (isImplication())
       ret += XMLConstants.implyID + "(" + left + "," + value + "," + implyElse + ")";
     else if (isSwapOut()) ret += XMLConstants.SWAPOUTID;
     else if (isInterrupt()) ret += XMLConstants.INTERRUPTID;
     else if (isSend()) ret += XMLConstants.SENDID + "(" + eventName + ")";
     else if (isAssignmentList()) {
       boolean first = true;
       for (DialogueOperatorEffect e : getAssignmentList()) {
         ret += ((!first) ? "," : XMLConstants.AssignmentLISTID + "(") + e.toString(shortForm);
         first = false;
       }
       ret += ")";
     } else ret += "unknown effect";
   } else {
     ret = "<" + effectXmlName + " ";
     if (isAssertion())
       ret +=
           XMLConstants.EXPRID
               + "=\""
               + XMLConstants.AssignmentID
               + "("
               + left
               + ","
               + right
               + ")\"";
     else if (isAssignmentList()) {
       String list = "";
       boolean first = true;
       for (DialogueOperatorEffect e : getAssignmentList()) {
         list += ((!first) ? "," : "") + e.toString(shortForm);
         first = false;
       }
       ret += XMLConstants.EXPRID + "=\"" + XMLConstants.AssignmentLISTID + "(" + list + ")\"";
     } else if (isAssignment()) {
       String ps =
           XMLConstants.VISIBLEID
               + "=\""
               + !varPropertiesForAssignment.getProperty(PROPERTY.HIDDEN)
               + "\" "
               + XMLConstants.READONLYID
               + "=\""
               + varPropertiesForAssignment.getProperty(PROPERTY.READONLY)
               + "\" "
               + XMLConstants.PERSISTENTID
               + "=\""
               + varPropertiesForAssignment.getProperty(PROPERTY.PERSISTENT)
               + "\" ";
       ret +=
           ps
               + XMLConstants.EXPRID
               + "=\""
               + XMLConstants.AssignmentID
               + "("
               + left
               + ","
               + getAssignedExpression()
               + ")\"";
     } else if (isGoalAchievement())
       ret +=
           XMLConstants.GOALID
               + "=\""
               + goalName
               + "\""
               + ((left != null) ? " " + XMLConstants.VALUEID + "=\"" + left + "\"" : "");
     else if (isImplication())
       ret +=
           XMLConstants.EXPRID
               + "=\""
               + XMLConstants.implyID
               + "("
               + left
               + ","
               + value
               + ","
               + implyElse
               + ")\"";
     else if (isSwapOut()) ret = "<" + XMLConstants.SWAPOUTID;
     else if (isSend())
       ret = "<" + XMLConstants.SENDID + " " + XMLConstants.IDID + "=\"" + eventName + "\"";
     else return super.toString();
     ret += "/>";
   }
   return ret;
 }