当前位置: 首页>>代码示例>>Java>>正文


Java ObjectOrientedLanguage类代码示例

本文整理汇总了Java中org.aikodi.chameleon.oo.language.ObjectOrientedLanguage的典型用法代码示例。如果您正苦于以下问题:Java ObjectOrientedLanguage类的具体用法?Java ObjectOrientedLanguage怎么用?Java ObjectOrientedLanguage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObjectOrientedLanguage类属于org.aikodi.chameleon.oo.language包,在下文中一共展示了ObjectOrientedLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contains

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
@Override
public boolean contains(Declaration fst, Declaration snd) throws LookupException {
	Declaration first = fst;
	Declaration second = snd;
	boolean result = false;
	if((first instanceof NormalMethod) && (second instanceof NormalMethod)) {
		result = first.nearestAncestor(Type.class).subtypeOf(second.nearestAncestor(Type.class)) &&
		         (first.is(first.language(ObjectOrientedLanguage.class).CLASS) == Ternary.TRUE) && 
		          first.sameSignatureAs(second);
	} else if(first instanceof RegularMemberVariable && second instanceof RegularMemberVariable) {
		 result = first.nearestAncestor(Type.class).subtypeOf(second.nearestAncestor(Type.class)) &&
		          first.sameSignatureAs(second);
	} else if(first instanceof Type && second instanceof Type) {
		result = first.nearestAncestor(Type.class).subtypeOf(second.nearestAncestor(Type.class)) &&
     first.sameSignatureAs(second);
	}
	return result;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:19,代码来源:JavaHidesRelation.java

示例2: assignableTo

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
public boolean assignableTo(Type other) throws LookupException {
	View view = view();
	ObjectOrientedLanguage language = view.language(ObjectOrientedLanguage.class);
Type objType = language.getDefaultSuperClass(view.namespace());
  return super.assignableTo(other) ||
         ( // Reference type
           elementType().subtypeOf(objType) &&
           (other instanceof ArrayType) &&
           elementType().assignableTo(((ArrayType)other).elementType())
         ) ||           
         ( // Primitive type
           (! elementType().subtypeOf(objType)) &&
           (other instanceof ArrayType) &&
           elementType().equals(((ArrayType)other).elementType())
         );
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:17,代码来源:ArrayType.java

示例3: implicitNonMemberInheritanceRelations

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
@Override
public List<InheritanceRelation> implicitNonMemberInheritanceRelations() {
	//FIXME speed avoid creating collection
	String defaultSuperClassFQN = language(ObjectOrientedLanguage.class).getDefaultSuperClassFQN();
	if(explicitNonMemberInheritanceRelations().isEmpty() && 
			(! getFullyQualifiedName().equals(defaultSuperClassFQN)) //"java.lang.Object"
			) {
		InheritanceRelation relation = new SubtypeRelation(language(ObjectOrientedLanguage.class).createTypeReference(defaultSuperClassFQN));
		relation.setUniParent(this);
		relation.setMetadata(new TagImpl(), IMPLICIT_CHILD);
		List<InheritanceRelation> result = new ArrayList<InheritanceRelation>();
		result.add(relation);
		return result;
	} else {
		return Collections.EMPTY_LIST;
	}
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:18,代码来源:JavaTypeInstantiation.java

示例4: impliedProperties

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
/**
 * A Java constructor is not inheritable.
 */
/*@
  @ also public behavior
  @
  @ post \result.contains(language().CONSTRUCTOR);
  @*/
 public PropertySet<Element,ChameleonProperty> impliedProperties() {
 	PropertySet<Element,ChameleonProperty> result = super.impliedProperties();
   result.add(language(ObjectOrientedLanguage.class).INHERITABLE.inverse());
   return result;
 }
 
开发者ID:markovandooren,项目名称:jnome,代码行数:14,代码来源:JavaConstructor.java

示例5: process

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
public List<SecondPhaseConstraint> process() throws LookupException {
	List<SecondPhaseConstraint> result = new ArrayList<SecondPhaseConstraint>();
	// If A is the type of null, no constraint is implied on Tj.
	Type A = A();
	View view = A.view();
   ObjectOrientedLanguage l = view.language(ObjectOrientedLanguage.class);
	
	if(! A.equals(l.getNullType(view.namespace()))) {
		result.addAll(processFirstLevel());
	}
	return result;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:13,代码来源:FirstPhaseConstraint.java

示例6: replace

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
/**
	 * Replace all references to 'declarator' in 'in' with copies of 'replacement'.
	 * @param replacement
	 * @param declarator
	 * @param in
	 * @param kind
	 * @return
	 * @throws LookupException
	 */
	public static <E extends Element> E replace(TypeReference replacement, final Declaration declarator, E in, Class<E> kind) throws LookupException {
		ObjectOrientedLanguage lang = in.language(ObjectOrientedLanguage.class);
		E result = in;
		Predicate<BasicTypeReference, LookupException> predicate = object -> object.getDeclarator().sameAs(declarator);
		List<BasicTypeReference> crefs = in.descendants(BasicTypeReference.class, 
				predicate);
		if(in instanceof BasicTypeReference) {
			BasicTypeReference in2 = (BasicTypeReference) in;
			if(predicate.eval(in2)) {
				crefs.add(in2);
			}
		}
		for(BasicTypeReference cref: crefs) {
			TypeReference substitute;
			Element oldParent = replacement.parent();
			if(replacement.isDerived()) {
//				replacement.setUniParent(null);
			  substitute = lang.createNonLocalTypeReference(Util.clone(replacement),oldParent);
			  substitute.setOrigin(replacement);
			} else {
			  substitute = lang.createNonLocalTypeReference(Util.clone(replacement),oldParent);
			}
			if(! cref.isDerived()) {
				SingleAssociation crefParentLink = cref.parentLink();
				crefParentLink.getOtherRelation().replace(crefParentLink, substitute.parentLink());
			} else {
				substitute.setUniParent(in.parent());
			}
			if(cref == in) {
				if(kind.isInstance(substitute)) {
				  result = (E) substitute;
				} else {
					throw new ChameleonProgrammerException("The type reference passed to replace must be replaced as a whole, but the kind that was given is more specific than the newly created type reference.");
				}
			}
		}
		return result;
	}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:48,代码来源:NonLocalJavaTypeReference.java

示例7: processUnresolvedParameters

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
private void processUnresolvedParameters() throws LookupException {
	// JLS 15.12.2.8
	// In context of assignment with type S.
	if(inContextOfAssignmentConversion()) {
		processUnresolved(S());
	} else {
		// Perform under the assumption that S is java.lang.Object
		if(! unresolvedParameters().isEmpty()) {
			View view = invocation().view();
		ObjectOrientedLanguage language = (ObjectOrientedLanguage) view.language();
			processUnresolved((JavaTypeReference) language.createTypeReferenceInNamespace(language.getDefaultSuperClassFQN(),view.namespace()));
		}
	}
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:15,代码来源:SecondPhaseConstraintSet.java

示例8: checkDefined

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
public boolean checkDefined(Declaration member) throws LookupException {
	Ternary temp1 = member.is(member.language(ObjectOrientedLanguage.class).DEFINED);
	boolean defined1;
	if(temp1 == Ternary.TRUE) {
	  defined1 = true;
	} else if (temp1 == Ternary.FALSE) {
	  defined1 = false;
	} else {
		temp1 = member.is(member.language(ObjectOrientedLanguage.class).DEFINED);
	  throw new LookupException("The definedness of the first element could not be determined.");
	}
	return defined1;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:14,代码来源:JavaImplementsRelation.java

示例9: implicitNonMemberInheritanceRelations

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
@Override
public List<InheritanceRelation> implicitNonMemberInheritanceRelations() {
  if(explicitNonMemberInheritanceRelations().isEmpty() && (! "Object".equals(name())) && (! getFullyQualifiedName().equals("java.lang.Object"))) {
    TypeReference objectTypeReference = language(ObjectOrientedLanguage.class).createTypeReference("java.lang.Object");
    InheritanceRelation relation = new SubtypeRelation(objectTypeReference);
    relation.setUniParent(this);
    relation.setMetadata(new TagImpl(), IMPLICIT_CHILD);
    List<InheritanceRelation> result = ImmutableList.of(relation);
    return result;
  } else {
    return Collections.EMPTY_LIST;
  }
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:14,代码来源:RawType.java

示例10: inherentProperties

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
@Override
public PropertySet<Element, ChameleonProperty> inherentProperties() {
	PropertySet<Element, ChameleonProperty> result = new PropertySet<Element, ChameleonProperty>();
	ObjectOrientedLanguage language = language(ObjectOrientedLanguage.class);
	result.add(language.ABSTRACT.inverse());
	result.add(language.CLASS.inverse());
	result.add(language.REFINABLE.inverse());
	return result;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:10,代码来源:AnonymousType.java

示例11: implicitConstructors

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
protected List<NormalMethod> implicitConstructors() throws LookupException {
	TypeReference tref = typeReference();
  Type writtenType = tref.getElement();
  List<NormalMethod> superMembers = writtenType.localMembers(NormalMethod.class);
  CollectionOperations.filter(superMembers, m -> m.is(language(ObjectOrientedLanguage.class).CONSTRUCTOR) == Ternary.TRUE);
  //if the super type is an interface, there will be no constructor, so we must
  //create a default constructor.
  if(superMembers.isEmpty()) {
  	superMembers.add(defaultDefaultConstructor(tref, writtenType));
  }
	return superMembers;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:13,代码来源:AnonymousType.java

示例12: inherentProperties

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
/**
 * A Java reference type is not overridable. A such, if B extends A, and both
 * A and B have a nested class with name C, then B.C does not override A.C.
 */
@Override
public PropertySet<Element, ChameleonProperty> inherentProperties() {
	PropertySet<Element, ChameleonProperty> result = new PropertySet<Element, ChameleonProperty>();
	result.add(language(ObjectOrientedLanguage.class).OVERRIDABLE.inverse());
	return result;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:11,代码来源:RegularJavaType.java

示例13: selector

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
public DeclarationSelector<Declaration> selector() {
		return new TwoPhaseDeclarationSelector<Declaration>() {

//			@Override
//			public WeakPartialOrder<Member> order() {
//				return new SelectorWithoutOrder.EqualityOrder<Member>();
//			}
			
			@Override
			protected void applyOrder(List<SelectionResult<Declaration>> tmp) throws LookupException {
				
			}

			@Override
			public boolean selectedBasedOnName(Signature signature) throws LookupException {
				return signature.name().equals(name());
			}

			@Override
			public Class<Declaration> selectedClass() {
				return Declaration.class;
			}

			@Override
			public boolean selectedRegardlessOfName(Declaration declaration) throws LookupException {
				ObjectOrientedLanguage language = (ObjectOrientedLanguage) declaration.language(ObjectOrientedLanguage.class);
				return declaration.is(language.CLASS) == Ternary.TRUE;
			}

			@Override
			public String selectionName(DeclarationContainer container) throws LookupException {
				return name();
			}
			
		};
	}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:37,代码来源:SingleStaticImport.java

示例14: erasure

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
@Override
public Type erasure() {
	Element el = farthestOrigin();
	if(el != this) {
		return ((JavaType)el).erasure();
	}
	// I am not sure whether this is correct. The memberInheritanceRelations are not erased in RawType.
	Type outmostType = lexical().farthestAncestor(Type.class);
	if(outmostType == null) {
		outmostType = this;
	}
	RawType outer;
	if(outmostType instanceof RawType) {
		outer = (RawType) outmostType;
	} else {
		outer = new RawType(outmostType);
	}
	RawType current = outer;
	List<Type> outerTypes = ancestors(Type.class);
	outerTypes.add(0, this);

	int size = outerTypes.size();
	Factory expressionFactory = language(ObjectOrientedLanguage.class).plugin(Factory.class);
	for(int i = size - 2; i>=0;i--) {
		NameReference<RawType> simpleRef = expressionFactory.createNameReference(outerTypes.get(i).name(), RawType.class);
		simpleRef.setUniParent(current);
		try {
			current = simpleRef.getElement();
		} catch (LookupException e) {
			e.printStackTrace();
			throw new ChameleonProgrammerException("An inner type of a newly created outer raw type cannot be found",e);
		}
	}
	return current;	
}
 
开发者ID:markovandooren,项目名称:jlo,代码行数:36,代码来源:SubobjectType.java

示例15: language

import org.aikodi.chameleon.oo.language.ObjectOrientedLanguage; //导入依赖的package包/类
public ObjectOrientedLanguage language() {
	return (ObjectOrientedLanguage) _view.language();
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:4,代码来源:PrimitiveTypeFactory.java


注:本文中的org.aikodi.chameleon.oo.language.ObjectOrientedLanguage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。