Java Doc for Operator.java in  » Science » Cougaar12_4 » org » cougaar » lib » contract » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.lib.contract 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.cougaar.lib.contract.Operator

Operator
public interface Operator extends UnaryPredicate(Code)
An extended UnaryPredicate with improved toString, XML generation, and new "implies" capability.

Operators feature improved:

  • toString in "paren" or "xml" formats
  • added XML generation (getXML)
  • (most important) comparison capabilities based upon the behavior of the Operator (implies, allows, equals)

The comparison methods will be used for automated analysis, such as the ability to generate Plugin "contracts" of publish/subscribe behavior.

Note: The default implementation of Operator is currently kept in the utility module as "org.cougaar.lib.contract.lang" -- see the "index.html" file there for language details.


See Also:   OperatorFactory



Field Summary
 intDEFAULT_STYLE
     Default style for toString -- currently pretty-printed XML.
 intPAREN_FLAG
     Constants for Operator parse and toString style.
 intPRETTY_FLAG
    
 intVERBOSE_FLAG
    
 intXML_FLAG
    


Method Summary
 booleanallows(Operator oper)
    
 "(this.allows(oper))" is defined as:
 there exists an Object o such that
 ((this.execute(o) == true) &&
 (oper.execute(o) == true)).
 

Note that this Object might never arise in practice, but the two Operators are at least logically compatable.

One often uses publishOp.allows(subscribeOp), since we are looking to see if any Object might pass both the publishOp and the subscribeOp.

 booleanequals(Operator oper)
    
 "(this.equals(oper))" is defined as:
 for all Objects o1..on,
 (this.execute(oi) == oper.execute(oi)).
 booleanexecute(Object o)
     execute method from UnaryPredicate.
 ElementgetXML(Document doc, int style)
     Get an XML Element representation in the given style.
 ElementgetXML(Document doc)
     Get an XML Element representation in the DEFAULT_STYLE.
 booleanimpliedBy(Operator oper)
     Equivalent to oper.implies(this).
 booleanimplies(Operator oper)
    
 "(this.implies(oper))" is defined as:
 for all Objects o1..on,
 if (this.execute(oi) == true)
 then (oper.execute(oi) == true).
 Objectoperate(Object o)
    
 voidsetConst(String key, Object val)
     Sets a constant value in the Operator, which is accessed internally via (get "key").

 For example, a paren-style predicate might be
 (and (isString) (equals (get "mystr")))
 and parsed into Operator op.
 StringtoString(int style)
     Convert this to a String.

Field Detail
DEFAULT_STYLE
int DEFAULT_STYLE(Code)
Default style for toString -- currently pretty-printed XML.



PAREN_FLAG
int PAREN_FLAG(Code)
Constants for Operator parse and toString style.



PRETTY_FLAG
int PRETTY_FLAG(Code)



VERBOSE_FLAG
int VERBOSE_FLAG(Code)



XML_FLAG
int XML_FLAG(Code)





Method Detail
allows
boolean allows(Operator oper)(Code)
 "(this.allows(oper))" is defined as:
 there exists an Object o such that
 ((this.execute(o) == true) &&
 (oper.execute(o) == true)).
 

Note that this Object might never arise in practice, but the two Operators are at least logically compatable.

One often uses publishOp.allows(subscribeOp), since we are looking to see if any Object might pass both the publishOp and the subscribeOp. Although it's logically equivalent to test subscribeOp.allows(publishOp), the prior form is likely faster and better supported.
See Also:   Operator.implies
See Also:   Operator.equals




equals
boolean equals(Operator oper)(Code)
 "(this.equals(oper))" is defined as:
 for all Objects o1..on,
 (this.execute(oi) == oper.execute(oi)).
 

Note that real "program" equivalency is NP-complete (Halting problem), so this is at best an approximation! The same caveat goes for implies and allows.
See Also:   Operator.implies
See Also:   Operator.allows




execute
boolean execute(Object o)(Code)
execute method from UnaryPredicate.



getXML
Element getXML(Document doc, int style)(Code)
Get an XML Element representation in the given style.


Parameters:
  style - currently only VERBOSE_FLAG is used




getXML
Element getXML(Document doc)(Code)
Get an XML Element representation in the DEFAULT_STYLE.



impliedBy
boolean impliedBy(Operator oper)(Code)
Equivalent to oper.implies(this).



implies
boolean implies(Operator oper)(Code)
 "(this.implies(oper))" is defined as:
 for all Objects o1..on,
 if (this.execute(oi) == true)
 then (oper.execute(oi) == true).
 

Note that there might never be an Object where this.execute(o) is true, and oper might match other Objects.

One can use "implies" to see if the given oper will "fire" if this Operator fires.
See Also:   Operator.allows
See Also:   Operator.equals




operate
Object operate(Object o)(Code)
operate method acts like execute, but returns an Object -- UnaryPredicate users should use execute instead!



setConst
void setConst(String key, Object val)(Code)
Sets a constant value in the Operator, which is accessed internally via (get "key").

 For example, a paren-style predicate might be
 (and (isString) (equals (get "mystr")))
 and parsed into Operator op.  One can then set
 the value of variable "mystr" to be the String 
 "foo" via
 op.setConst("mystr", "foo")
 and the predicate will behave as
 (and (isString) (equals (get "foo")))
 

One can also specify the expected type of the constant to be other than String within the predicate via (and (isInteger) (equals (get "myint" "Integer"))) and then set it via op.setConst("mystr", new Integer(123))

The goal is to allow predicates to be used as simple parameterized templates.


Parameters:
  key - the "get" constant identifier
Parameters:
  val - the new value of the constant




toString
String toString(int style)(Code)
Convert this to a String.
Parameters:
  style - use a bit-mix of *_FLAG constants, such as(XML_FLAG | VERBOSE_FLAG) or(PAREN_FLAG | PRETTY_FLAG), etc



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.