JADE
package examples.content.musicShopOntology; import jade.content.*; import jade.util.leap.List; import jade.util.leap.Iterator; import examples.content.ecommerceOntology.*; public class CD extends Item { private String title = null; private List tracks = null; public String getTitle() { return title; } public void setTitle(String t) { title = t; } public List getTracks() { return tracks; } public void setTracks(List l) { tracks = l; } public String toString() { StringBuffer sb = new StringBuffer(title); if (tracks != null) { Iterator it = tracks.iterator(); int i = 0; while (it.hasNext()) { sb.append(" "); Track t = (Track) it.next(); sb.append("track-"+i+": "+t.toString()); i++; } } return sb.toString(); } }
package examples.content.musicShopOntology; public class Single extends CD { }
package examples.content.musicShopOntology; import jade.content.*; public class Track implements Concept { private String name = null; private Integer duration = null; private byte[] pcm = null; // NAME public String getName() { return name; } public void setName(String name) { this.name = name; } // DURATION public Integer getDuration() { return duration; } public void setDuration(Integer duration) { this.duration = duration; } // PCM public byte[] getPcm() { return pcm; } public void setPcm(byte[] pcm) { this.pcm = pcm; } public String toString() { return name+(duration != null ? ("["+duration.intValue()+" sec]") : ""); } }
//Notice that this is part of the ecommerceOntology package examples.content.ecommerceOntology; import jade.content.*; import jade.core.AID; public class Owns implements Predicate { private AID owner; private Item item; public AID getOwner() { return owner; } public void setOwner(AID id) { owner = id; } public Item getItem() { return item; } public void setItem(Item i) { item = i; } }
20 of 21