Codota Logo
OAVObjectType.isSubtype
Code IndexAdd Codota to your IDE (free)

How to use
isSubtype
method
in
jadex.rules.state.OAVObjectType

Best Java code snippets using jadex.rules.state.OAVObjectType.isSubtype (Showing top 20 results out of 315)

  • Common ways to obtain OAVObjectType
private void myMethod () {
OAVObjectType o =
  • Codota IconIOAVState state;Object object;state.getType(object)
  • Codota IconOAVAttributeType oAVAttributeType;oAVAttributeType.getType()
  • Codota IconMap map;Object key;(OAVObjectType) map.get(key)
  • Smart code suggestions by Codota
}
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Get the set of matching type nodes for a (sub)type.
 *  @param type The object type.
 *  @return The set of type nodes for that object type.
 */
protected Set	getTypeNodes(OAVObjectType type)
{
  Set    ret    = (Set)typenodesets.get(type);
  if(ret==null)
  {
    synchronized(this)
    {
      ret    = (Set)typenodesets.get(type);
      if(ret==null)
      {
        ret    = new HashSet();
        for(Iterator it=typenodes.values().iterator(); it.hasNext(); )
        {
          TypeNode    tnode    = (TypeNode)it.next();
          if(type.isSubtype(tnode.getObjectType()))
            ret.add(tnode);
        }
        typenodesets.put(type, ret);
      }
    }
  }
  return ret;
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Get the set of matching type nodes for a (sub)type.
 *  @param type The object type.
 *  @return The set of type nodes for that object type.
 */
protected Set	getTypeNodes(OAVObjectType type)
{
  Set    ret    = (Set)typenodesets.get(type);
  if(ret==null)
  {
    synchronized(this)
    {
      ret    = (Set)typenodesets.get(type);
      if(ret==null)
      {
        ret    = new HashSet();
        for(Iterator it=typenodes.values().iterator(); it.hasNext(); )
        {
          TypeNode    tnode    = (TypeNode)it.next();
          if(type.isSubtype(tnode.getObjectType()))
            ret.add(tnode);
        }
        typenodesets.put(type, ret);
      }
    }
  }
  return ret;
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Test if this object is same type or subtype of this type.
 *  @param object The object to test.
 *  @return True, if object is same type or subtype.
 */
public boolean isSubtype(OAVObjectType type)
{
  return type instanceof OAVJavaType
    ? SReflect.isSupertype(((OAVJavaType)type).getClazz(), clazz)
    : super.isSubtype(type);
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Test if this object is same type or subtype of this type.
 *  @param object The object to test.
 *  @return True, if object is same type or subtype.
 */
public boolean isSubtype(OAVObjectType type)
{
  return type instanceof OAVJavaType
    ? SReflect.isSupertype(((OAVJavaType)type).getClazz(), clazz)
    : super.isSubtype(type);
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Evaluate two objects with respect to the
 *  operator semantics.
 *  @param state The state.
 *  @param val1 The first object.
 *  @param val2 The second object.
 *  @return True, if objects fit wrt. the operator semantics.
 */
public boolean evaluate(IOAVState state, Object val1, Object val2)
{
  val1 = val1 instanceof ILazyValue? ((ILazyValue)val1).getValue(): val1; 
  val2 = val2 instanceof ILazyValue? ((ILazyValue)val2).getValue(): val2; 
  boolean ret;
  if(val2 instanceof Class)
  {
    ret = ((Class)val2).isAssignableFrom(val1 instanceof Class? (Class)val1: val1.getClass());
  }
  else //if(val2 instanceof OAVObjectType)
  {
    ret = val1 instanceof OAVObjectType? ((OAVObjectType)val1).isSubtype((OAVObjectType)val2)
      :state.getType(val1).isSubtype((OAVObjectType)val2);
  }
  return ret;
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Evaluate two objects with respect to the
 *  operator semantics.
 *  @param state The state.
 *  @param val1 The first object.
 *  @param val2 The second object.
 *  @return True, if objects fit wrt. the operator semantics.
 */
public boolean evaluate(IOAVState state, Object val1, Object val2)
{
  val1 = val1 instanceof ILazyValue? ((ILazyValue)val1).getValue(): val1; 
  val2 = val2 instanceof ILazyValue? ((ILazyValue)val2).getValue(): val2; 
  boolean ret;
  if(val2 instanceof Class)
  {
    ret = ((Class)val2).isAssignableFrom(val1 instanceof Class? (Class)val1: val1.getClass());
  }
  else //if(val2 instanceof OAVObjectType)
  {
    ret = val1 instanceof OAVObjectType? ((OAVObjectType)val1).isSubtype((OAVObjectType)val2)
      :state.getType(val1).isSubtype((OAVObjectType)val2);
  }
  return ret;
}
 
origin: net.sourceforge.jadex/jadex-kernel-bdi

/**
 * 
 */
public static boolean isSucceeded(IOAVState state, Object handle)
{
  boolean	ret;
  Object    pstate    = state.getAttributeValue(handle, OAVBDIRuntimeModel.goal_has_processingstate);
  Object    mgoal    = state.getAttributeValue(handle, OAVBDIRuntimeModel.element_has_model);
  if(state.getType(mgoal).isSubtype(OAVBDIMetaModel.maintaingoal_type))
    ret    = OAVBDIRuntimeModel.GOALPROCESSINGSTATE_IDLE.equals(pstate);
  else
    ret    = OAVBDIRuntimeModel.GOALPROCESSINGSTATE_SUCCEEDED.equals(pstate);    
  return ret;
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Test if a value is compatible with the defined typeinfo.
 */
protected boolean isTypeCompatible(Object object, ObjectInfo info, IContext context)
{
  boolean ret = true;
  if(info!=null && info.getTypeInfo() instanceof OAVObjectType)
  {
    OAVObjectType otype = (OAVObjectType)info.getTypeInfo();
    ret = ((IOAVState)context).getType(object).isSubtype(otype);
  }
  return ret;
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Test if a value is compatible with the defined typeinfo.
 */
protected boolean isTypeCompatible(Object object, ObjectInfo info, IContext context)
{
  boolean ret = true;
  if(info!=null && info.getTypeInfo() instanceof OAVObjectType)
  {
    OAVObjectType otype = (OAVObjectType)info.getTypeInfo();
    ret = ((IOAVState)context).getType(object).isSubtype(otype);
  }
  return ret;
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Check if it is allowed to set or add an attribute value.
 *  For this purpose it is checked if the value is either
 *  a) a ObjectId -> type check via OAVObjectType
 *  b) a normal Java object -> type check via OAVJavaType
 *  Additionally multiplicity is checked.
 *  @throws RuntimeException if value is not allowed.
 */
protected boolean checkValueCompatibility(Object object, 
  OAVAttributeType attribute, Object value)
{
  if(value!=null)
  {
    OAVObjectType    atype    = attribute.getType();
    if(atype instanceof OAVJavaType)
    {
      if(!tmodel.getJavaType(value.getClass()).isSubtype(atype))
        throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value);
    }
    else if(!getType(value).isSubtype(atype))
    {
      throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value);
    }
  }
  return true;
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Check if it is allowed to set or add an attribute value.
 *  For this purpose it is checked if the value is either
 *  a) a ObjectId -> type check via OAVObjectType
 *  b) a normal Java object -> type check via OAVJavaType
 *  Additionally multiplicity is checked.
 *  @throws RuntimeException if value is not allowed.
 */
protected boolean checkValueCompatibility(Object object, 
  OAVAttributeType attribute, Object value)
{
  if(value!=null)
  {
    OAVObjectType    atype    = attribute.getType();
    if(atype instanceof OAVJavaType)
    {
      if(!tmodel.getJavaType(value.getClass()).isSubtype(atype))
        throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value);
    }
    else if(!getType(value).isSubtype(atype))
    {
      throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value);
    }
  }
  return true;
}
 
origin: net.sourceforge.jadex/jadex-kernel-bdi

  public String getObjectName(Object obj)
  {
    String    name    = null;
    if(state.getType(obj).isSubtype(OAVBDIMetaModel.modelelement_type))
    {
      name    = (String)state.getAttributeValue(obj, OAVBDIMetaModel.modelelement_has_name);
    }
    
    if(name==null && state.getType(obj).isSubtype(OAVBDIMetaModel.elementreference_type))
    {
      name    = (String)state.getAttributeValue(obj, OAVBDIMetaModel.elementreference_has_concrete);
    }
    
    if(name==null && state.getType(obj).isSubtype(OAVBDIMetaModel.expression_type))
    {
      IParsedExpression    exp    =(IParsedExpression)state.getAttributeValue(obj, OAVBDIMetaModel.expression_has_parsed);
      String    text    = (String)state.getAttributeValue(obj, OAVBDIMetaModel.expression_has_text);
      name    = exp!=null ? exp.getExpressionText() : text!=null ? text.trim() : null;
    }
    
    if(name==null)
    {
      name    = ""+obj;
    }
    
    return obj instanceof String ? (String)obj : state.getType(obj).getName().substring(1) + " " + name;
  }
}
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Check if it is allowed to set or add an attribute value.
 *  For this purpose it is checked if the value is either
 *  a) a ObjectId -> type check via OAVObjectType
 *  b) a normal Java object -> type check via OAVJavaType
 *  Additionally multiplicity is checked.
 *  @throws RuntimeException if value is not allowed.
 */
protected boolean checkValueCompatibility(Object id, 
  OAVAttributeType attribute, Object value)
{
  // #ifndef MIDP
  assert nocheck || generator.isId(id);
  // #endif
  if(value!=null)
  {
    OAVObjectType    atype    = attribute.getType();
    if(atype instanceof OAVJavaType)
    {
      if(!tmodel.getJavaType(value.getClass()).isSubtype(atype))
        throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value);
    }
    else if(!getType(value).isSubtype(atype))
    {
      throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value);
    }
  }
  return true;
}
 
origin: net.sourceforge.jadex/jadex-kernel-bdi

/**
 *  Get the type name (name of the modelelement).
 */
public static String getTypeName(IOAVState state, Object handle)
{
  // Only called from synchronized code -> no agent invocation necessary 
  String ret = "unknown";
  try
  {
    if(handle!=null && state.getType(handle).isSubtype(OAVBDIRuntimeModel.element_type))
    {
      Object me = state.getAttributeValue(handle, OAVBDIRuntimeModel.element_has_model);
      if(me!=null)
        ret = (String)state.getAttributeValue(me, OAVBDIMetaModel.modelelement_has_name);
    }
  }
  catch(RuntimeException e)
  {
  }
  return ret;
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Check if it is allowed to set or add an attribute value.
 *  For this purpose it is checked if the value is either
 *  a) a ObjectId -> type check via OAVObjectType
 *  b) a normal Java object -> type check via OAVJavaType
 *  Additionally multiplicity is checked.
 *  @throws RuntimeException if value is not allowed.
 */
protected boolean checkValueCompatibility(Object id, 
  OAVAttributeType attribute, Object value)
{
  // #ifndef MIDP
  assert nocheck || generator.isId(id);
  // #endif
  if(value!=null)
  {
    OAVObjectType    atype    = attribute.getType();
    if(atype instanceof OAVJavaType)
    {
      if(!tmodel.getJavaType(value.getClass()).isSubtype(atype))
        throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value);
    }
    else if(!getType(value).isSubtype(atype))
    {
      throw new RuntimeException("Value not of suitable type: "+id+" "+attribute+" "+value);
    }
  }
  return true;
}
 
origin: net.sourceforge.jadex/jadex-kernel-bdi

  /**
   *  Schedule a plan instance candidate.
   */
  public static void schedulePlanInstanceCandidate(IOAVState state, Object dispelem, Object rplan, Object rcapa)//Object cand)
  {
//        System.out.println("schedulePlanInstanceCandidate: Setting plan to ready: "
//            +BDIInterpreter.getInterpreter(state).getAgentAdapter().getComponentIdentifier().getLocalName()
//            +", "+rplan);
    
//        Object    rplan    = state.getAttributeValue(cand, OAVBDIRuntimeModel.plancandidate_has_plan);
//        Object    rcapa    = state.getAttributeValue(cand, OAVBDIRuntimeModel.plancandidate_has_rcapa);
    state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_processingstate, 
      OAVBDIRuntimeModel.PLANPROCESSINGTATE_READY);
    state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_dispatchedelement, dispelem);
    PlanRules.cleanupPlanWait(state, rcapa, rplan, false);
    
    if(dispelem!=null && state.getType(dispelem).isSubtype(OAVBDIRuntimeModel.processableelement_type))
    {
      state.setAttributeValue(dispelem, OAVBDIRuntimeModel.processableelement_has_state, 
        OAVBDIRuntimeModel.PROCESSABLEELEMENT_CANDIDATESSELECTED);
    }
  }
   
origin: net.sourceforge.jadex/jadex-kernel-bdi

/**
 *  Dispatch a new subgoal.
 *  @param subgoal The new subgoal.
 *  Note: plan step is interrupted after call.
 */
public void dispatchSubgoal(IGoal subgoal)
{
  Object rgoal = ((GoalFlyweight)subgoal).getHandle();
  Object scope = ((GoalFlyweight)subgoal).getScope();
  interpreter.startMonitorConsequences();
  GoalLifecycleRules.adoptGoal(state, scope, rgoal);
  state.addAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_subgoals, rgoal);
  state.setAttributeValue(rgoal, OAVBDIRuntimeModel.goal_has_parentplan, rplan);
  // Protect goal, if necessary.
  Object    planstate    = state.getAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_lifecyclestate);
  Object    reason    = state.getAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_reason);
  boolean	protectgoal	= OAVBDIRuntimeModel.PLANLIFECYCLESTATE_PASSED.equals(planstate)
    || OAVBDIRuntimeModel.PLANLIFECYCLESTATE_FAILED.equals(planstate)
    || OAVBDIRuntimeModel.PLANLIFECYCLESTATE_ABORTED.equals(planstate);
  if(!protectgoal && reason!=null && state.getType(reason).isSubtype(OAVBDIRuntimeModel.goal_type))
  {
     protectgoal    = ((Boolean)state.getAttributeValue(reason, OAVBDIRuntimeModel.goal_has_protected)).booleanValue();
  }
  if(protectgoal)
  {
    state.setAttributeValue(rgoal, OAVBDIRuntimeModel.goal_has_protected, Boolean.TRUE);
  }

  interpreter.endMonitorConsequences();
}
origin: net.sourceforge.jadex/jadex-kernel-bdi

  /**
   *  Resolve the parameter class.
   */
  public static Class resolveClazz(IOAVState state, Object mparamelem, String name)
  {
    Class clazz = null;
//        Object mparamelem = state.getAttributeValue(parameterelement, OAVBDIRuntimeModel.element_has_model);    
    Object mparam = state.getAttributeValue(mparamelem, OAVBDIMetaModel.parameterelement_has_parameters, name);
    if(mparam!=null)
    {
      clazz = (Class)state.getAttributeValue(mparam, OAVBDIMetaModel.typedelement_has_class);
    }
    else if(state.getType(mparamelem).isSubtype(OAVBDIMetaModel.messageevent_type))
    {
      MessageType mt = MessageEventRules.getMessageEventType(state, mparamelem);
      ParameterSpecification ps = mt.getParameter(name);
      clazz = ps.getClazz();
    }
    if(clazz==null)
      clazz = Object.class;
    
    return clazz;
  }
 
origin: net.sourceforge.jadex/jadex-kernel-bdi

if(state.getType(rpe).isSubtype(OAVBDIRuntimeModel.goal_type))
  state.setAttributeValue(state.getAttributeValue(cand, OAVBDIRuntimeModel.waitqueuecandidate_has_plan)
    , OAVBDIRuntimeModel.plan_has_waitqueuecandidate, cand);
if(state.getType(rpe).isSubtype(OAVBDIRuntimeModel.goal_type))
  state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_plancandidate, cand);
if(state.getType(rpe).isSubtype(OAVBDIRuntimeModel.goal_type))
origin: net.sourceforge.jadex/jadex-kernel-bdi

/**
 *  Resolve the parameterset class.
 */
protected Class resolveClazz()
{
  Class clazz = null;
  Object mparamelem = getState().getAttributeValue(pe, OAVBDIRuntimeModel.element_has_model);    
  Object mparamset = getState().getAttributeValue(mparamelem, OAVBDIMetaModel.parameterelement_has_parametersets, name);
  if(mparamset!=null)
  {
    clazz = (Class)getState().getAttributeValue(mparamset, OAVBDIMetaModel.typedelement_has_class);
  }
  else if(getState().getType(mparamelem).isSubtype(OAVBDIMetaModel.messageevent_type))
  {
    MessageType mt = MessageEventRules.getMessageEventType(getState(), mparamelem);
    ParameterSpecification ps = mt.getParameter(name);
    clazz = ps.getClazz();
  }
  if(clazz==null)
    clazz = Object.class;
  
  return clazz;
}
 
jadex.rules.stateOAVObjectTypeisSubtype

Javadoc

Test if this type is same type or subtype of another type.

Popular methods of OAVObjectType

  • getName
    Get the name of the OAV object type.
  • getSupertype
    Get the supertype of this typ.
  • createAttributeType
    Create a new attribute type.
  • equals
    Test if two types are equal.
  • getAttributeType
    Get an attribute type description.
  • getDeclaredAttributeTypes
    Get the declared attribute types (i.e. not those of super types).
  • <init>
    Create a new OAV object type.
  • addAttributeType
    Add an attribute type description.
  • getAttributeType0
    Get an attribute type description.
  • getDeclaredAttributeType0
    Get an attribute type description.
  • hashCode
    Get the hash code.
  • hashCode

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getSystemService (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JCheckBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now