public static class Binary extends Formula {
public Binary(TptpParserOutput.FofFormula lhs,
TptpParserOutput.BinaryConnective connective,
TptpParserOutput.FofFormula rhs)
{
_kind = Formula.Kind.Binary;
_lhs = (Formula)lhs;
_connective = connective;
_rhs = (Formula)rhs;
}
public TptpParserOutput.BinaryConnective getConnective() {
return _connective;
}
public Formula getLhs() { return _lhs; }
public Formula getRhs() { return _rhs; }
/** @param obj must be convertible to Binary, can be null */
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) return true;
return _kind == ((Formula)obj)._kind &&
_connective == ((Binary)obj)._connective &&
_lhs.equals(((Binary)obj)._lhs) &&
_rhs.equals(((Binary)obj)._rhs);
}
public int hashCode() {
int res = _kind.hashCode();
res = 31 * res + _connective.hashCode();
res = 31 * res + _lhs.hashCode();
res = 31 * res + _rhs.hashCode();
return res;
}
public String toString() { return toString(new String("")); }
public String toString(String indent) {
return indent + "(" + _lhs + _connective + _rhs + ")";
}
public Formula _lhs;
public TptpParserOutput.BinaryConnective _connective;
public Formula _rhs;
} // class Binary这是一个静态类,如果我想在其他类中访问这两个方法,该如何做? public Formula getLhs() { return _lhs; }
public Formula getRhs() { return _rhs; }
public Binary(TptpParserOutput.FofFormula lhs,
TptpParserOutput.BinaryConnective connective,
TptpParserOutput.FofFormula rhs)
{
_kind = Formula.Kind.Binary;
_lhs = (Formula)lhs;
_connective = connective;
_rhs = (Formula)rhs;
}
public TptpParserOutput.BinaryConnective getConnective() {
return _connective;
}
public Formula getLhs() { return _lhs; }
public Formula getRhs() { return _rhs; }
/** @param obj must be convertible to Binary, can be null */
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) return true;
return _kind == ((Formula)obj)._kind &&
_connective == ((Binary)obj)._connective &&
_lhs.equals(((Binary)obj)._lhs) &&
_rhs.equals(((Binary)obj)._rhs);
}
public int hashCode() {
int res = _kind.hashCode();
res = 31 * res + _connective.hashCode();
res = 31 * res + _lhs.hashCode();
res = 31 * res + _rhs.hashCode();
return res;
}
public String toString() { return toString(new String("")); }
public String toString(String indent) {
return indent + "(" + _lhs + _connective + _rhs + ")";
}
public Formula _lhs;
public TptpParserOutput.BinaryConnective _connective;
public Formula _rhs;
} // class Binary这是一个静态类,如果我想在其他类中访问这两个方法,该如何做? public Formula getLhs() { return _lhs; }
public Formula getRhs() { return _rhs; }
解决方案 »
- 添加到JPanel的组件比如按钮之类的总是自动居中显示,我希望能由顶部开始显示
- CryptoAPI和JAVA security结合问题
- 用户在客户端提供数字证书,在服务器端如何通过此来验证用户的身份??
- 没有循环的小应用程序怎么会重复执行paint()方法?
- java新手关于Apache 和Tomcat 的问题
- 初学者问题(别骂我低能)
- 我认为对于non-public类,没有public成员的必要,诸位以为如何?
- 对面的大虾看过来! 看过来.....看过来~~~~~~
- Jbuilder 菜鸟问题
- 新手:最近用到JFrame,但是好象Frame也有同样的功能,请高手指点?
- java中“线程”的用处?
- 求解如何用java的MappedByteBuffer方法修改大文件
假设你的Binary所在的外部类名称为A,
那么应该这样访问: new A.Binary().getLhs();
因为你这两个方法不是静态的,所以应该是 new 一下。
如果方法用static修饰,则直接A.Binary.getLhs();
希望能帮助你。
没有static关键字修饰的类,能算是静态类吗?不太懂了
此类就是静态内部类,因为代码太多,所以只贴了静态类.
那个java文件,只有第一个是普通类,里面都是潜逃的静态内部类。
如果我想访问,里面的
getLhs()
getRhs()
方法,2楼说的可用吗?
代码没问题。
静态类对象.普通方法();
原来是private或者是protected.
我忘了。