universAAL / ontology

Collection of "official" ontologies of universAAL, which play the role of data model
13 stars 11 forks source link

RoomFunction.valueOf(String) yields IndexOutOfBoundsExeption #409

Closed Alfiva closed 7 years ago

Alfiva commented 7 years ago

Originally Opened: @amedranogil (2014-06-04 12:19:53) Originally Closed: 2014-09-12 14:07:16

I seems the methods are copied from old implementations:

public static final RoomFunction valueOf(String name) {
for (int i = 0; i < names.length; i++)
    if (names[i].equals(name))
    return getLevelByOrder(i);
return null;
}

public static RoomFunction getLevelByOrder(int order) {
OntClassInfo info = OntologyManagement.getInstance().getOntClassInfo(
    MY_URI);
return info == null ? null : (RoomFunction) info.getInstances()[order];
                                                                    //^ it breaks here

}

info.getinstances() is an empty set!

Also "getLEVELByOrder" seems a bit suspicious.

--

From: this issue has been automatically imported from our old issue tracker

Alfiva commented 7 years ago

Original author: @Alfiva (2014-09-12 14:07:15)

Fixed: added a getRoomFunctionByOrder(int) that uses a simple switch on static values rather than depending on .getInstances.

Alfiva commented 7 years ago

issue cloed on 2014-09-12 14:07:16