Changeset 15275 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-08-04T21:15:10+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r15245 r15275 339 339 Object[] convertedArgs; 340 340 341 int start = 0; 342 int offset = 0; 341 343 if (needsEnvironment) { 342 convertedArgs = new Object[args.size()+1]; 344 start = 1; 345 offset = 1; 346 convertedArgs = new Object[args.size() + 1]; 343 347 convertedArgs[0] = env; 344 for (int i = 1; i < convertedArgs.length; ++i) {345 convertedArgs[i] = Cascade.convertTo(args.get(i-1).evaluate(env), expectedParameterTypes[i]);346 if (convertedArgs[i] == null && !nullable) {347 return null;348 }349 }350 348 } else { 351 349 convertedArgs = new Object[args.size()]; 352 for (int i = 0; i < convertedArgs.length; ++i) { 353 convertedArgs[i] = Cascade.convertTo(args.get(i).evaluate(env), expectedParameterTypes[i]); 354 if (convertedArgs[i] == null && !nullable) { 355 return null; 350 } 351 352 for (int i = start; i < convertedArgs.length; ++i) { 353 if (!expectedParameterTypes[i].isArray()) { 354 convertedArgs[i] = Cascade.convertTo(args.get(i - offset).evaluate(env), expectedParameterTypes[i]); 355 } else { 356 Class<?> clazz = expectedParameterTypes[i].getComponentType(); 357 Object[] varargs = (Object[]) Array.newInstance(clazz, args.size() - i + 1); 358 for (int j = 0; j < args.size() - i + 1; ++j) { 359 varargs[j] = Cascade.convertTo(args.get(j + i - 1).evaluate(env), clazz); 356 360 } 357 } 358 } 361 convertedArgs[i] = expectedParameterTypes[i].cast(varargs); 362 break; 363 } 364 if (convertedArgs[i] == null && !nullable) { 365 return null; 366 } 367 } 368 359 369 Object result = null; 360 370 try { -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
r15246 r15275 505 505 506 506 /** 507 * Returns t rue if role is in relation. Returns false if not a relation or it does not have the role.507 * Returns the number of primitives in a relation with the specified roles. 508 508 * @param env the environment 509 509 * @param roles The roles to count in the relation
Note:
See TracChangeset
for help on using the changeset viewer.