コード例 #1
0
 public void testCustomTypeAndItsInstance() {
   Cache cache = initWorkingSpace();
   Type vehicle = cache.addType("Vehicle");
   Attribute equipment = vehicle.setAttribute("Equipment");
   Generic myVehicle = vehicle.addInstance("myVehicle");
   myVehicle.setValue(equipment, "ABS");
   closingWorkingSpace(cache);
 }
コード例 #2
0
 private void readByComposites(Generic persistedNode, Generic readNode) {
   int indexComposites = 0;
   assert (persistedNode.getComposites().size() == readNode.getComposites().size());
   for (Generic persistedGeneric : persistedNode.getComposites()) {
     compareGeneric(persistedGeneric, readNode.getComposites().get(indexComposites));
     readByComposites(persistedGeneric, readNode.getComposites().get(indexComposites));
     indexComposites++;
   }
 }
コード例 #3
0
 public void testLink() {
   Cache cache = initWorkingSpace();
   Type vehicle = cache.addType("Vehicle");
   Type color = cache.addType("Color");
   Relation vehicleColor = vehicle.setRelation("VehicleColor", color);
   Generic myVehicle = vehicle.addInstance("myVehicle");
   Generic red = color.addInstance("red");
   myVehicle.setLink(vehicleColor, "myVehicleRed", red);
   closingWorkingSpace(cache);
 }
コード例 #4
0
 private static void compareGeneric(Generic persistedGeneric, Generic readGeneric) {
   assert ((GenericImpl) persistedGeneric).getBirthTs() == ((GenericImpl) readGeneric).getBirthTs()
       : "BirthTs : "
           + ((GenericImpl) persistedGeneric).getBirthTs()
           + " / "
           + ((GenericImpl) readGeneric).getBirthTs();
   assert ((GenericImpl) persistedGeneric).getDeathTs() == ((GenericImpl) readGeneric).getDeathTs()
       : "DeathTs : "
           + ((GenericImpl) persistedGeneric).getDeathTs()
           + " / "
           + ((GenericImpl) readGeneric).getDeathTs();
   assert ((GenericImpl) persistedGeneric).getDesignTs()
           == ((GenericImpl) readGeneric).getDesignTs()
       : "DesignTs : "
           + ((GenericImpl) persistedGeneric).getDesignTs()
           + " / "
           + ((GenericImpl) readGeneric).getDesignTs();
   assert (persistedGeneric.getMetaLevel() == readGeneric.getMetaLevel());
   assert (persistedGeneric.getValue().equals(readGeneric.getValue()));
 }
コード例 #5
0
 private void readByInheritings(Generic persistedNode, Generic readNode) {
   int indexInherintings = 0;
   assert (persistedNode.getInheritings().size() == readNode.getInheritings().size())
       : persistedNode.getInheritings() + " / " + readNode.getInheritings();
   for (Generic persistedGeneric : persistedNode.getInheritings()) {
     compareGeneric(persistedGeneric, readNode.getInheritings().get(indexInherintings));
     readByInheritings(persistedGeneric, readNode.getInheritings().get(indexInherintings));
     indexInherintings++;
   }
 }