本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver类的典型用法代码示例。如果您正苦于以下问题:Java InferTypeArgumentsConstraintsSolver类的具体用法?Java InferTypeArgumentsConstraintsSolver怎么用?Java InferTypeArgumentsConstraintsSolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InferTypeArgumentsConstraintsSolver类属于org.eclipse.jdt.internal.corext.refactoring.generics包,在下文中一共展示了InferTypeArgumentsConstraintsSolver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteAST
import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel positionGroups)
throws CoreException {
InferTypeArgumentsTCModel model = new InferTypeArgumentsTCModel();
InferTypeArgumentsConstraintCreator creator =
new InferTypeArgumentsConstraintCreator(model, true);
CompilationUnit root = cuRewrite.getRoot();
root.accept(creator);
InferTypeArgumentsConstraintsSolver solver = new InferTypeArgumentsConstraintsSolver(model);
InferTypeArgumentsUpdate update = solver.solveConstraints(new NullProgressMonitor());
solver = null; // free caches
ParameterizedType[] nodes =
InferTypeArgumentsRefactoring.inferArguments(fTypes, update, model, cuRewrite);
if (nodes.length == 0) return;
ASTRewrite astRewrite = cuRewrite.getASTRewrite();
for (int i = 0; i < nodes.length; i++) {
ParameterizedType type = nodes[i];
List<Type> args = type.typeArguments();
int j = 0;
for (Iterator<Type> iter = args.iterator(); iter.hasNext(); ) {
LinkedProposalPositionGroup group =
new LinkedProposalPositionGroup("G" + i + "_" + j); // $NON-NLS-1$ //$NON-NLS-2$
Type argType = iter.next();
if (!positionGroups.hasLinkedPositions()) {
group.addPosition(astRewrite.track(argType), true);
} else {
group.addPosition(astRewrite.track(argType), false);
}
positionGroups.addPositionGroup(group);
j++;
}
}
positionGroups.setEndPosition(astRewrite.track(nodes[0]));
}
示例2: rewriteAST
import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel positionGroups) throws CoreException {
InferTypeArgumentsTCModel model= new InferTypeArgumentsTCModel();
InferTypeArgumentsConstraintCreator creator= new InferTypeArgumentsConstraintCreator(model, true);
CompilationUnit root= cuRewrite.getRoot();
root.accept(creator);
InferTypeArgumentsConstraintsSolver solver= new InferTypeArgumentsConstraintsSolver(model);
InferTypeArgumentsUpdate update= solver.solveConstraints(new NullProgressMonitor());
solver= null; //free caches
ParameterizedType[] nodes= InferTypeArgumentsRefactoring.inferArguments(fTypes, update, model, cuRewrite);
if (nodes.length == 0)
return;
ASTRewrite astRewrite= cuRewrite.getASTRewrite();
for (int i= 0; i < nodes.length; i++) {
ParameterizedType type= nodes[i];
List<Type> args= type.typeArguments();
int j= 0;
for (Iterator<Type> iter= args.iterator(); iter.hasNext();) {
LinkedProposalPositionGroup group= new LinkedProposalPositionGroup("G" + i + "_" + j); //$NON-NLS-1$ //$NON-NLS-2$
Type argType= iter.next();
if (!positionGroups.hasLinkedPositions()) {
group.addPosition(astRewrite.track(argType), true);
} else {
group.addPosition(astRewrite.track(argType), false);
}
positionGroups.addPositionGroup(group);
j++;
}
}
positionGroups.setEndPosition(astRewrite.track(nodes[0]));
}
示例3: rewriteAST
import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel positionGroups) throws CoreException {
InferTypeArgumentsTCModel model= new InferTypeArgumentsTCModel();
InferTypeArgumentsConstraintCreator creator= new InferTypeArgumentsConstraintCreator(model, true);
CompilationUnit root= cuRewrite.getRoot();
root.accept(creator);
InferTypeArgumentsConstraintsSolver solver= new InferTypeArgumentsConstraintsSolver(model);
InferTypeArgumentsUpdate update= solver.solveConstraints(new NullProgressMonitor());
solver= null; //free caches
ParameterizedType[] nodes= InferTypeArgumentsRefactoring.inferArguments(fTypes, update, model, cuRewrite);
if (nodes.length == 0)
return;
ASTRewrite astRewrite= cuRewrite.getASTRewrite();
for (int i= 0; i < nodes.length; i++) {
ParameterizedType type= nodes[i];
List<Type> args= (List<Type>) type.getStructuralProperty(ParameterizedType.TYPE_ARGUMENTS_PROPERTY);
int j= 0;
for (Iterator<Type> iter= args.iterator(); iter.hasNext();) {
LinkedProposalPositionGroup group= new LinkedProposalPositionGroup("G" + i + "_" + j); //$NON-NLS-1$ //$NON-NLS-2$
Type argType= iter.next();
if (!positionGroups.hasLinkedPositions()) {
group.addPosition(astRewrite.track(argType), true);
} else {
group.addPosition(astRewrite.track(argType), false);
}
positionGroups.addPositionGroup(group);
j++;
}
}
positionGroups.setEndPosition(astRewrite.track(nodes[0]));
}