protected class UMod2java.V_compileFieldDefs extends UMod.Visitor
Modifier and Type | Field and Description |
---|---|
protected GeneratedClass |
basevisitor |
protected boolean |
getterfunctions |
protected int |
modif_field |
protected boolean |
setterfunctions |
protected UMod2visitors |
visitorcompiler |
result
Constructor and Description |
---|
V_compileFieldDefs(GeneratedClass bv,
UMod2visitors vc,
boolean getterfunctions,
boolean setterfunctions,
boolean monolithic) |
Modifier and Type | Method and Description |
---|---|
protected void |
action(UMod.ClassDef cd) |
protected void |
action(UMod.FieldDef fd) |
protected UMod.FieldDef |
findSuperField(UMod.FieldDef fd) |
protected void |
makeMultipleContainsKey(UMod.FieldDef fd) |
protected void |
makeMultiplePut(UMod.FieldDef fd) |
protected void |
makePrefixMultipleContainsKey(String fieldname,
List<UMod.Type> types) |
protected void |
makePrefixMultiplePut(String fieldname,
List<UMod.Type> types,
boolean topIsOpt,
boolean lastIsListoid,
boolean lastIsMultimap)
For a field declaration ...
|
protected void |
makeSetGet(UMod.FieldDef fd,
boolean getterfunctions,
boolean setterfunctions,
boolean isabstract) |
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, getResult, match
protected GeneratedClass basevisitor
protected UMod2visitors visitorcompiler
protected boolean getterfunctions
protected boolean setterfunctions
protected int modif_field
public V_compileFieldDefs(GeneratedClass bv, UMod2visitors vc, boolean getterfunctions, boolean setterfunctions, boolean monolithic)
protected UMod.FieldDef findSuperField(UMod.FieldDef fd)
protected void action(UMod.ClassDef cd)
action
in class UMod.Visitor
protected void action(UMod.FieldDef fd)
action
in class UMod.Visitor
protected void makeSetGet(UMod.FieldDef fd, boolean getterfunctions, boolean setterfunctions, boolean isabstract)
protected void makePrefixMultiplePut(String fieldname, List<UMod.Type> types, boolean topIsOpt, boolean lastIsListoid, boolean lastIsMultimap)
f: A -> B -> C -> D f: A -> SEQ (C -> D) // at each position; "SEQ.." f: A -> int->C -> D // is treated as "int->.."... we generate ...
put_f(a, Map[B,Map[C,D]]) // resp. put_f(a, Seq[Map[C,D]] ) put_f(a, b, Map[C,D]) putAll_f(a, b, x:Map[C,D]) put_f(a, b, c, d){ m0=g.get(a); if(m0==null){m0=new...();f.put(a,m0);} m1=m0.get(b); if(m1==null){m1=new...();m0.put(b,m0);} m1.put(c, d); // resp. m1.putAll(x); }(The "addAll(..)" method is only realized at the very end of this chain. Up to now it did not show up as urgently requested with shorter prefices. In the example above you currently have to use
if (get_f().containsKey(a)) f.get().get(a).putAll(x:MAP[b->MAP[c->d]]) else f.get().put(NEW COPY OF (x:MAP[b->MAP[c->d]]))A future version could additionally generate such code, if requested by a command line switch.)
f: A -> B -> SET C... we generate ...
put_f(a, Map[B,SET C]) put_f(a, b, c:SET c){ m0=g.get(a); if(m0==null){m0=new...();f.put(a,m0);} m0.put(b,c); } addAll_f(a, b, x:SET[C]){ add_f(a, b, c){ m0=g.get(a); if(m0==null){m0=new...();f.put(a,m0);} m1=m0.get(b); if(m1==null){m1=new set...();m0.put(b,m0);} m1.add(c); // resp. m1.addAll(x); }On the "reading side", the method "containsKey()" is generared for all prefices of the signature. A result of "true" implies the existance of all intermediate container classes and "get(..).get(..).get(..)" can be called conventionally.
f: A -> B -> C ->D f: A -> OPT B -> C ->DIf the user calls a "put_f(a, b, c...)", then they want want that there exists an f(a), in any case, no matter whether it already existed.
f: A -> B -> C g: A -> OPT B -> Cget_f(a,b) throws an exception if containsKey_f(a) is f false.
protected void makeMultiplePut(UMod.FieldDef fd)
protected void makePrefixMultipleContainsKey(String fieldname, List<UMod.Type> types)
protected void makeMultipleContainsKey(UMod.FieldDef fd)
see also the complete user documentation .