Package gov.llnl.lc.chaos
Class Genders
- java.lang.Object
-
- gov.llnl.lc.chaos.Genders
-
public class Genders extends java.lang.ObjectJava JNI extensions wrapper around libgenders C library. Most library functions behave similarly to C api functions with minor exceptions documented below.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcleanup()Cleans up allocated memory.java.lang.String[]getattr()Returns all the attributes of the node you are running onjava.lang.String[]getattr(java.lang.String node)Returns all the attributes of the specified nodejava.lang.String[]getattr_all()Returns all of the attributes in the genders databasejava.lang.Stringgetattrval(java.lang.String attr)Returns the value of the specified attribute on the current node you are running onjava.lang.Stringgetattrval(java.lang.String node, java.lang.String attr)Returns the value of the specified attribute on the specified node.intgetmaxattrs()Deprecated.Use getnumattrs()java.lang.Stringgetnodename()Returns the current node you are on, in shortened hostname format.java.lang.String[]getnodes()Returns all the nodes in the genders databasejava.lang.String[]getnodes(java.lang.String attr)Returns all the nodes with the specified attributejava.lang.String[]getnodes(java.lang.String attr, java.lang.String val)Returns all the nodes with the specified attribute and valueintgetnumattrs()Returns number of attributes parsed in the genders databaseintgetnumnodes()Returns number of nodes parsed in the genders databasebooleanisattr(java.lang.String attr)Tests if the specified attribute exists in the genders databasebooleanisattrval(java.lang.String attr, java.lang.String val)Tests if the specified value exists in the genders databasebooleanisnode(java.lang.String node)Tests if the specified node exists in the genders databasejava.lang.String[]query(java.lang.String query)Returns nodes specified via the specified query.booleantestattr(java.lang.String attr)Tests if the current node has the specified attributebooleantestattr(java.lang.String node, java.lang.String attr)Tests if the specified node has the specified attributebooleantestattrval(java.lang.String attr, java.lang.String val)Tests if the current node has the specified attribute and value.booleantestattrval(java.lang.String node, java.lang.String attr, java.lang.String val)Tests if the specified node has the specified attribute and value.booleantestquery(java.lang.String query)Test if the current node meets the conditions of the specified query.booleantestquery(java.lang.String node, java.lang.String query)Test if the specified node meets the conditions of the specified query.
-
-
-
Constructor Detail
-
Genders
public Genders() throws GendersExceptionCreates a Genders object, loading the default genders database- Throws:
GendersException
-
Genders
public Genders(java.lang.String filename) throws GendersExceptionCreates a Genders object, loading the specified genders database- Throws:
GendersException
-
-
Method Detail
-
getnumnodes
public int getnumnodes() throws GendersExceptionReturns number of nodes parsed in the genders database- Throws:
GendersException- on error
-
getnumattrs
public int getnumattrs() throws GendersExceptionReturns number of attributes parsed in the genders database- Throws:
GendersException- on error
-
getmaxattrs
@Deprecated public int getmaxattrs() throws GendersExceptionDeprecated.Use getnumattrs()Returns maximum number of attributes of any one node parsed in the genders database- Throws:
GendersException- on error
-
getnodename
public java.lang.String getnodename() throws GendersExceptionReturns the current node you are on, in shortened hostname format.- Throws:
GendersException- on error
-
getnodes
public java.lang.String[] getnodes() throws GendersExceptionReturns all the nodes in the genders database- Throws:
GendersException- on error
-
getnodes
public java.lang.String[] getnodes(java.lang.String attr) throws GendersExceptionReturns all the nodes with the specified attribute- Throws:
GendersException- on error
-
getnodes
public java.lang.String[] getnodes(java.lang.String attr, java.lang.String val) throws GendersExceptionReturns all the nodes with the specified attribute and value- Throws:
GendersException- on error
-
getattr
public java.lang.String[] getattr() throws GendersExceptionReturns all the attributes of the node you are running on- Throws:
GendersException- on error
-
getattr
public java.lang.String[] getattr(java.lang.String node) throws GendersExceptionReturns all the attributes of the specified node- Throws:
GendersException- on error
-
getattr_all
public java.lang.String[] getattr_all() throws GendersExceptionReturns all of the attributes in the genders database- Throws:
GendersException- on error
-
getattrval
public java.lang.String getattrval(java.lang.String attr) throws GendersExceptionReturns the value of the specified attribute on the current node you are running on- Throws:
GendersException- on error
-
getattrval
public java.lang.String getattrval(java.lang.String node, java.lang.String attr) throws GendersExceptionReturns the value of the specified attribute on the specified node. May be an empty string if the attribute contains no value.- Throws:
GendersException- on error
-
testattr
public boolean testattr(java.lang.String attr) throws GendersExceptionTests if the current node has the specified attribute- Throws:
GendersException- on error
-
testattr
public boolean testattr(java.lang.String node, java.lang.String attr) throws GendersExceptionTests if the specified node has the specified attribute- Throws:
GendersException- on error
-
testattrval
public boolean testattrval(java.lang.String attr, java.lang.String val) throws GendersExceptionTests if the current node has the specified attribute and value.- Throws:
GendersException- on error
-
testattrval
public boolean testattrval(java.lang.String node, java.lang.String attr, java.lang.String val) throws GendersExceptionTests if the specified node has the specified attribute and value.- Throws:
GendersException- on error
-
isnode
public boolean isnode(java.lang.String node) throws GendersExceptionTests if the specified node exists in the genders database- Throws:
GendersException- on error
-
isattr
public boolean isattr(java.lang.String attr) throws GendersExceptionTests if the specified attribute exists in the genders database- Throws:
GendersException- on error
-
isattrval
public boolean isattrval(java.lang.String attr, java.lang.String val) throws GendersExceptionTests if the specified value exists in the genders database- Throws:
GendersException- on error
-
query
public java.lang.String[] query(java.lang.String query) throws GendersExceptionReturns nodes specified via the specified query. Signify union with '||', intersection with '&&', * difference with '--', and complement with '~'. Operations are performed left to right. Parentheses can be used to change the order of operations.- Throws:
GendersException- on error
-
testquery
public boolean testquery(java.lang.String query) throws GendersExceptionTest if the current node meets the conditions of the specified query.- Throws:
GendersException- on error
-
testquery
public boolean testquery(java.lang.String node, java.lang.String query) throws GendersExceptionTest if the specified node meets the conditions of the specified query.- Throws:
GendersException- on error
-
cleanup
public void cleanup()
Cleans up allocated memory. Must be called to free memory from underlying calls. After this method is called, all genders methods above cannot be called and will result in errors.
-
-