public static void addPair(ItemList list, Item key, Item value) { Item pair = makePair(key, value) ; list.add(pair) ; }
@Override public String toString() { String str = "" ; if ( hasLocation() ) str = str.concat(location()) ; return str+slice().toString() ; } }
public Expr make(final ItemList list) { ItemList x = list.cdr(); // drop "count" boolean distinct = startsWithDistinct(x) ; if ( distinct ) x = x.cdr(); BuilderLib.checkLength(0, 1, x, "Broken syntax: "+list.shortString()) ; Aggregator agg = null ; if ( x.size() == 0 ) agg = AggregatorFactory.createCount(distinct) ; else { Expr expr = BuilderExpr.buildExpr(x.get(0)) ; agg = AggregatorFactory.createCountExpr(distinct, expr) ; } return new ExprAggregator((Var)null, agg) ; } };
ObjectMapper mapper = new ObjectMapper(); ObjectWriter writer = mapper.writer(); Item item1 = new Item(); item1.setFoo(1); Item item2 = new Item(); item2.setFoo(2); ItemList itemList = new ItemList(); itemList.add(item1); itemList.add(item2); String json = writer .with(SerializationFeature.WRAP_ROOT_VALUE) .writeValueAsString(itemList); // json contains {"item":[{"foo":1},{"foo":2}]}
private void init(Item stats) { if ( !stats.isTagged(STATS) ) throw new ARQException("Not a tagged '"+STATS+"'") ; ItemList list = stats.getList().cdr(); // Skip tag if ( list.car().isTagged(META) ) { // Process the meta tag. Item elt1 = list.car(); list = list.cdr(); // Move list on // Get count. Item x = Item.find(elt1.getList(), COUNT) ; if ( x != null ) count = x.getList().get(1).asInteger() ; } while (!list.isEmpty()) { Item elt = list.car() ; list = list.cdr(); onePattern(elt) ; } }
public final Expr make(ItemList list) { ItemList x = list.cdr(); // drop "sum" boolean distinct = startsWithDistinct(x) ; if ( distinct ) x = x.cdr(); BuilderLib.checkLength(1, x, "Broken syntax: "+list.shortString()) ; // (sum ?var) Expr expr = buildExpr(x.get(0)) ; return make(distinct, expr) ; }
public static Graph buildGraph(Graph graph, ItemList list) { if ( ! list.isEmpty() && list.get(0).isSymbol() ) { if ( list.get(0).isSymbol(Tags.tagGraph) ) list = list.cdr(); } for (Item item : list) { BuilderLib.checkList(item) ; Triple triple = buildTriple(item.getList()) ; graph.add(triple) ; } return graph ; }
public Op make(ItemList list) { boolean silent = false ; BuilderLib.checkLength(3, 4, list, "service") ; list = list.cdr() ; if ( list.size() == 3 ) { if ( !list.car().isSymbol() ) BuilderLib.broken(list, "Expected a keyword") ; if ( ! list.car().getSymbol().equalsIgnoreCase("SILENT") ) BuilderLib.broken(list, "Service: Expected SILENT") ; silent = true ; list = list.cdr() ; } Node service = BuilderNode.buildNode(list.car()) ; if ( ! service.isURI() && ! service.isVariable() ) BuilderLib.broken(list, "Service must provide a URI or variable") ; list = list.cdr() ; Op sub = build(list, 0) ; return new OpService(service, sub, silent) ; } } ;
[System.Web.Services.WebMethod] public static object testmethod(string serial) { ItemList itemlist = new ItemList(); itemlist.Item = "Testing"; return itemList; }
itemList = new ItemList(); itemList.setItem(currentValue); itemList.setManufacturer(currentValue);
ItemList unique = new ItemList(); String query="Select id,name from item"; ResultSet rs = d.sendQuery(query); while(rs.next()) { System.out.println(rs.getString(1)+"\t"+rs.getString(2)); unique.addItem(new Item(rs.getString(1),rs.getString(2))); List<Item> list = i.getItemList(); list.get(10); //11 because 0 counts also