コード例 #1
0
 @Deprecated
 @operator(
     value = "neighbors_of",
     content_type = IType.AGENT,
     category = {IOperatorCategory.SPATIAL, IOperatorCategory.SP_QUERIES})
 /* TODO, expected_content_type = { IType.FLOAT, IType.INT } */
 @doc(
     deprecated = "Use 'neighbours_of(topology, agent, distance)' instead",
     usages =
         @usage(
             value =
                 "a list, containing all the agents of the same species than the key of the pair argument (if it is an agent) located at a distance inferior or equal to the right member (float) of the pair (right-hand operand) to the left member (agent, geometry or point) considering the left-hand operand topology.",
             examples = {
               @example(
                   value = "topology(self) neighbors_of self::10",
                   equals =
                       "all the agents located at a distance lower or equal to 10 to the agent applying the operator considering its topology.",
                   test = false)
             }))
 public static IList neighbours_of(final IScope scope, final ITopology t, final GamaPair pair) {
   if (pair == null) {
     return GamaListFactory.EMPTY_LIST;
   }
   Object agent = pair.key;
   return Spatial.Queries._neighbours(
       scope,
       agent instanceof IAgent
           ? In.list(scope, ((IAgent) agent).getPopulation())
           : Different.with(),
       agent,
       pair.value,
       t);
   // TODO We could compute a filter based on the population if it is an agent
 }