示例#1
0
  @Override
  public int hashCode() {
    int hash = sort.hashCode() + cons.hashCode();

    for (Term t : contents) hash += t.hashCode();
    return hash;
  }
示例#2
0
文件: KApp.java 项目: kszr/k
 @Override
 public boolean contains(Object o) {
   if (o instanceof Bracket) return contains(((Bracket) o).getContent());
   if (o instanceof Cast) return contains(((Cast) o).getContent());
   if (!(o instanceof KApp)) return false;
   KApp k = (KApp) o;
   return label.contains(k.label) && child.contains(k.child);
 }
示例#3
0
文件: KApp.java 项目: kszr/k
 /** Constructs a {@link KApp} object from an XML {@link Element}. */
 public KApp(Element element, org.kframework.kil.loader.Context context) {
   super(element);
   List<Element> childrenElements = XML.getChildrenElements(element);
   Element body = XML.getChildrenElements(childrenElements.get(0)).get(0);
   setLabel((Term) JavaClassesFactory.getTerm(body));
   Term term = (Term) JavaClassesFactory.getTerm(childrenElements.get(1));
   if (!(term.getSort().equals(Sort.KLIST) || term instanceof Ambiguity)) {
     setChild(new KList(Collections.<Term>singletonList(term)));
   } else {
     setChild(term);
   }
 }
示例#4
0
文件: KApp.java 项目: kszr/k
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    KApp kApp = (KApp) o;

    if (!child.equals(kApp.child)) return false;
    if (!label.equals(kApp.label)) return false;

    return true;
  }
示例#5
0
文件: KApp.java 项目: kszr/k
 /**
  * Constructs a {@link KApp} object representing the application of the specified KLabel to the
  * specified KList.
  *
  * @param label the KLabel which is applied to the given KList. A non-null instance of {@link
  *     KLabel}, {@link Variable} of sort KLabel or {@link Ambiguity}.
  * @param child the KList which the given KLabel is applied to. A non-null instance of {@link
  *     KList}, {@link Variable} of sort KList, or {@link Ambiguity}.
  */
 public KApp(Term label, Term child) {
   super(label.getLocation(), label.getSource(), Sort.KITEM);
   setLabel(label);
   setChild(child);
 }
示例#6
0
文件: KApp.java 项目: kszr/k
 @Override
 public int hashCode() {
   return label.hashCode() * 23 + child.hashCode();
 }