コード例 #1
0
 public static Set<PsiType> getDefaultExpectedTypes(@NotNull GrExpression element) {
   final LinkedHashSet<PsiType> result = new LinkedHashSet<PsiType>();
   for (TypeConstraint constraint : calculateTypeConstraints(element)) {
     result.add(constraint.getDefaultType());
   }
   return result;
 }
コード例 #2
0
ファイル: JSURI.java プロジェクト: BackupTheBerlios/esxx-svn
  public String[] getAuthMechanisms(
      Context cx, URI req_uri, String realm, final String[] default_mechanisms) {
    final LinkedHashSet<String> result = new LinkedHashSet<String>(); // Order is important

    enumerateProperty(
        cx,
        "auth",
        new PropEnumerator() {
          public void handleProperty(Scriptable p, int s) {
            Object mechanism = p.get("mechanism", p);

            if (mechanism == null
                || mechanism == Scriptable.NOT_FOUND
                || mechanism == Context.getUndefinedValue()) {
              // Any mechanism is OK
              result.addAll(Arrays.asList(default_mechanisms));
            } else {
              result.add(Context.toString(mechanism).toLowerCase());
            }
          }
        },
        req_uri,
        realm,
        null);

    return result.toArray(new String[result.size()]);
  }
コード例 #3
0
    public LinkedHashSet<Path> scan(FileSystem fs, Path filePath, Set<String> consumedFiles) {
      LinkedHashSet<Path> pathSet = Sets.newLinkedHashSet();
      try {
        LOG.debug("Scanning {} with pattern {}", filePath, this.filePatternRegexp);
        FileStatus[] files = fs.listStatus(filePath);
        for (FileStatus status : files) {
          Path path = status.getPath();
          String filePathStr = path.toString();

          if (consumedFiles.contains(filePathStr)) {
            continue;
          }

          if (ignoredFiles.contains(filePathStr)) {
            continue;
          }

          if (acceptFile(filePathStr)) {
            LOG.debug("Found {}", filePathStr);
            pathSet.add(path);
          } else {
            // don't look at it again
            ignoredFiles.add(filePathStr);
          }
        }
      } catch (FileNotFoundException e) {
        LOG.warn("Failed to list directory {}", filePath, e);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      return pathSet;
    }
コード例 #4
0
  @Override
  @NotNull
  public SuggestedNameInfo suggestUniqueVariableName(
      @NotNull final SuggestedNameInfo baseNameInfo,
      PsiElement place,
      boolean ignorePlaceName,
      boolean lookForward) {
    final String[] names = baseNameInfo.names;
    final LinkedHashSet<String> uniqueNames = new LinkedHashSet<String>(names.length);
    for (String name : names) {
      if (ignorePlaceName && place instanceof PsiNamedElement) {
        final String placeName = ((PsiNamedElement) place).getName();
        if (Comparing.strEqual(placeName, name)) {
          uniqueNames.add(name);
          continue;
        }
      }
      uniqueNames.add(suggestUniqueVariableName(name, place, lookForward));
    }

    return new SuggestedNameInfo(ArrayUtil.toStringArray(uniqueNames)) {
      @Override
      public void nameChosen(String name) {
        baseNameInfo.nameChosen(name);
      }
    };
  }
コード例 #5
0
 public String[] getGroupNames() {
   LinkedHashSet<String> groups = new LinkedHashSet<String>();
   for (ApiDoc apiDoc : docs) {
     groups.add(apiDoc.group);
   }
   return groups.toArray(new String[groups.size()]);
 }
コード例 #6
0
  private boolean tryToReloadApplication() {
    try {
      final Application app = ApplicationManager.getApplication();

      if (app.isDisposed()) return false;
      final HashSet<Pair<VirtualFile, StateStorage>> causes =
          new HashSet<Pair<VirtualFile, StateStorage>>(myChangedApplicationFiles);
      if (causes.isEmpty()) return true;

      final boolean[] reloadOk = {false};
      final LinkedHashSet<String> components = new LinkedHashSet<String>();

      ApplicationManager.getApplication()
          .runWriteAction(
              new Runnable() {
                @Override
                public void run() {
                  try {
                    reloadOk[0] =
                        ((ApplicationImpl) app).getStateStore().reload(causes, components);
                  } catch (StateStorageException e) {
                    Messages.showWarningDialog(
                        ProjectBundle.message("project.reload.failed", e.getMessage()),
                        ProjectBundle.message("project.reload.failed.title"));
                  } catch (IOException e) {
                    Messages.showWarningDialog(
                        ProjectBundle.message("project.reload.failed", e.getMessage()),
                        ProjectBundle.message("project.reload.failed.title"));
                  }
                }
              });

      if (!reloadOk[0] && !components.isEmpty()) {
        String message = "Application components were changed externally and cannot be reloaded:\n";
        for (String component : components) {
          message += component + "\n";
        }

        final boolean canRestart = ApplicationManager.getApplication().isRestartCapable();
        message += "Would you like to " + (canRestart ? "restart " : "shutdown ");
        message += ApplicationNamesInfo.getInstance().getProductName() + "?";

        if (Messages.showYesNoDialog(
                message, "Application Configuration Reload", Messages.getQuestionIcon())
            == Messages.YES) {
          for (Pair<VirtualFile, StateStorage> cause : causes) {
            StateStorage stateStorage = cause.getSecond();
            if (stateStorage instanceof XmlElementStorage) {
              ((XmlElementStorage) stateStorage).disableSaving();
            }
          }
          ApplicationManagerEx.getApplicationEx().restart(true);
        }
      }

      return reloadOk[0];
    } finally {
      myChangedApplicationFiles.clear();
    }
  }
コード例 #7
0
 public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) {
   data.TEST_OBJECT = TestType.PATTERN.getType();
   final String suffix;
   if (method != null) {
     data.METHOD_NAME = method.getName();
     suffix = "," + data.METHOD_NAME;
   } else {
     suffix = "";
   }
   LinkedHashSet<String> patterns = new LinkedHashSet<String>();
   for (PsiClass pattern : classes) {
     patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + suffix);
   }
   data.setPatterns(patterns);
   final Module module =
       RunConfigurationProducer.getInstance(TestNGPatternConfigurationProducer.class)
           .findModule(this, getConfigurationModule().getModule(), patterns);
   if (module == null) {
     data.setScope(TestSearchScope.WHOLE_PROJECT);
     setModule(null);
   } else {
     setModule(module);
   }
   setGeneratedName();
 }
コード例 #8
0
    private synchronized TaskAttemptId getAndRemove(int volumeId) {
      TaskAttemptId taskAttemptId = null;
      if (!unassignedTaskForEachVolume.containsKey(volumeId)) {
        if (volumeId > REMOTE) {
          diskVolumeLoads.remove(volumeId);
        }
        return taskAttemptId;
      }

      LinkedHashSet<TaskAttempt> list = unassignedTaskForEachVolume.get(volumeId);
      if (list != null && !list.isEmpty()) {
        TaskAttempt taskAttempt;
        synchronized (unassignedTaskForEachVolume) {
          Iterator<TaskAttempt> iterator = list.iterator();
          taskAttempt = iterator.next();
          iterator.remove();
        }

        taskAttemptId = taskAttempt.getId();
        for (DataLocation location : taskAttempt.getTask().getDataLocations()) {
          HostVolumeMapping volumeMapping =
              scheduledRequests.leafTaskHostMapping.get(location.getHost());
          if (volumeMapping != null) {
            volumeMapping.removeTaskAttempt(location.getVolumeId(), taskAttempt);
          }
        }

        increaseConcurrency(volumeId);
      }

      return taskAttemptId;
    }
コード例 #9
0
  @Nullable
  @Override
  public Element getState() {
    final Element actions = new Element("actions");
    final Element abbreviations = new Element("abbreviations");
    actions.addContent(abbreviations);
    for (String key : myActionId2Abbreviations.keySet()) {
      final LinkedHashSet<String> abbrs = myActionId2Abbreviations.get(key);
      final LinkedHashSet<String> pluginAbbrs = myPluginsActionId2Abbreviations.get(key);
      if (abbrs == pluginAbbrs || (abbrs != null && abbrs.equals(pluginAbbrs))) {
        continue;
      }
      if (abbrs != null) {
        final Element action = new Element("action");
        action.setAttribute("id", key);
        abbreviations.addContent(action);
        for (String abbr : abbrs) {
          final Element abbreviation = new Element("abbreviation");
          abbreviation.setAttribute("name", abbr);
          action.addContent(abbreviation);
        }
      }
    }

    return actions;
  }
コード例 #10
0
 public String[] getGroupRoutes(String group) {
   LinkedHashSet<String> routes = new LinkedHashSet<String>();
   for (ApiDoc apiDoc : docs) {
     if (StringUtils.equals(group, apiDoc.group)) Collections.addAll(routes, apiDoc.routes);
   }
   return routes.toArray(new String[routes.size()]);
 }
コード例 #11
0
ファイル: StramClient.java プロジェクト: andyperlitch/Apex
  public static LinkedHashSet<String> findJars(LogicalPlan dag, Class<?>[] defaultClasses) {
    List<Class<?>> jarClasses = new ArrayList<Class<?>>();

    for (String className : dag.getClassNames()) {
      try {
        Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
        jarClasses.add(clazz);
      } catch (ClassNotFoundException e) {
        throw new IllegalArgumentException("Failed to load class " + className, e);
      }
    }

    for (Class<?> clazz : Lists.newArrayList(jarClasses)) {
      // process class and super classes (super does not require deploy annotation)
      for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) {
        // LOG.debug("checking " + c);
        jarClasses.add(c);
        jarClasses.addAll(Arrays.asList(c.getInterfaces()));
      }
    }

    jarClasses.addAll(Arrays.asList(defaultClasses));

    if (dag.isDebug()) {
      LOG.debug("Deploy dependencies: {}", jarClasses);
    }

    LinkedHashSet<String> localJarFiles = new LinkedHashSet<String>(); // avoid duplicates
    HashMap<String, String> sourceToJar = new HashMap<String, String>();

    for (Class<?> jarClass : jarClasses) {
      if (jarClass.getProtectionDomain().getCodeSource() == null) {
        // system class
        continue;
      }
      String sourceLocation =
          jarClass.getProtectionDomain().getCodeSource().getLocation().toString();
      String jar = sourceToJar.get(sourceLocation);
      if (jar == null) {
        // don't create jar file from folders multiple times
        jar = JarFinder.getJar(jarClass);
        sourceToJar.put(sourceLocation, jar);
        LOG.debug("added sourceLocation {} as {}", sourceLocation, jar);
      }
      if (jar == null) {
        throw new AssertionError("Cannot resolve jar file for " + jarClass);
      }
      localJarFiles.add(jar);
    }

    String libJarsPath = dag.getValue(LogicalPlan.LIBRARY_JARS);
    if (!StringUtils.isEmpty(libJarsPath)) {
      String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP);
      localJarFiles.addAll(Arrays.asList(libJars));
    }

    LOG.info("Local jar file dependencies: " + localJarFiles);

    return localJarFiles;
  }
コード例 #12
0
  public static LinkedHashSet<String> sortMatching(
      final PrefixMatcher matcher, Collection<String> _names) {
    ProgressManager.checkCanceled();

    List<String> sorted = new ArrayList<String>();
    for (String name : _names) {
      if (matcher.prefixMatches(name)) {
        sorted.add(name);
      }
    }

    ProgressManager.checkCanceled();
    Collections.sort(sorted, String.CASE_INSENSITIVE_ORDER);
    ProgressManager.checkCanceled();

    LinkedHashSet<String> result = new LinkedHashSet<String>();
    for (String name : sorted) {
      if (matcher.isStartMatch(name)) {
        result.add(name);
      }
    }

    ProgressManager.checkCanceled();

    result.addAll(sorted);
    return result;
  }
コード例 #13
0
  /**
   * Test importing of Clinical Data File.
   *
   * @throws DaoException Database Access Error.
   * @throws IOException IO Error.
   */
  @Test
  @Ignore("To be fixed")
  public void testImportClinicalDataSurvival() throws Exception {

    // TBD: change this to use getResourceAsStream()
    File clinicalFile = new File("target/test-classes/clinical_data.txt");
    ImportClinicalData importClinicalData = new ImportClinicalData(study, clinicalFile);
    importClinicalData.importData();

    LinkedHashSet<String> caseSet = new LinkedHashSet<String>();
    caseSet.add("TCGA-A1-A0SB");
    caseSet.add("TCGA-A1-A0SI");
    caseSet.add("TCGA-A1-A0SE");

    List<Patient> clinicalCaseList =
        DaoClinicalData.getSurvivalData(study.getInternalId(), caseSet);
    assertEquals(3, clinicalCaseList.size());

    Patient clinical0 = clinicalCaseList.get(0);
    assertEquals(new Double(79.04), clinical0.getAgeAtDiagnosis());
    assertEquals("DECEASED", clinical0.getOverallSurvivalStatus());
    assertEquals("Recurred/Progressed", clinical0.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(43.8), clinical0.getOverallSurvivalMonths());
    assertEquals(new Double(15.05), clinical0.getDiseaseFreeSurvivalMonths());

    Patient clinical1 = clinicalCaseList.get(1);
    assertEquals(new Double(55.53), clinical1.getAgeAtDiagnosis());
    assertEquals("LIVING", clinical1.getOverallSurvivalStatus());
    assertEquals("DiseaseFree", clinical1.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(49.02), clinical1.getOverallSurvivalMonths());
    assertEquals(new Double(49.02), clinical1.getDiseaseFreeSurvivalMonths());

    Patient clinical2 = clinicalCaseList.get(2);
    assertEquals(null, clinical2.getDiseaseFreeSurvivalMonths());
  }
コード例 #14
0
ファイル: Chemkin.java プロジェクト: ecintron/RMG-Java
  // ## operation writeChemkinReactions(ReactionModel)
  // 10/26/07 gmagoon: changed to take temperature as parameter (it doesn't seem like this method is
  // currently used anywhere)
  public static String writeChemkinReactions(
      ReactionModel p_reactionModel, Temperature p_temperature) {
    // #[ operation writeChemkinReactions(ReactionModel)
    StringBuilder result = new StringBuilder();
    result.append("REACTIONS	KCAL/MOLE\n");
    CoreEdgeReactionModel cerm = (CoreEdgeReactionModel) p_reactionModel;

    LinkedHashSet all = cerm.getReactedReactionSet();

    HashSet hs = new HashSet();
    int numfor = 0;
    int numrev = 0;
    int numdup = 0;
    int numnorev = 0;
    for (Iterator iter = all.iterator(); iter.hasNext(); ) {
      Reaction rxn = (Reaction) iter.next();
      if (rxn.isForward()) {
        result.append(
            " "
                + rxn.toChemkinString(p_temperature)
                + "\n"); // 10/26/07 gmagoon: changed to avoid use of Global.temperature
        //	result.append(" " + rxn.toChemkinString(Global.temperature) + "\n");

      }
    }

    result.append("END\n");

    return result.toString();

    // #]
  }
コード例 #15
0
  private static List<XmlElementDescriptor> computeRequiredSubTags(XmlElementsGroup group) {

    if (group.getMinOccurs() < 1) return Collections.emptyList();
    switch (group.getGroupType()) {
      case LEAF:
        XmlElementDescriptor descriptor = group.getLeafDescriptor();
        return descriptor == null
            ? Collections.<XmlElementDescriptor>emptyList()
            : Collections.singletonList(descriptor);
      case CHOICE:
        LinkedHashSet<XmlElementDescriptor> set = null;
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          List<XmlElementDescriptor> descriptors = computeRequiredSubTags(subGroup);
          if (set == null) {
            set = new LinkedHashSet<XmlElementDescriptor>(descriptors);
          } else {
            set.retainAll(descriptors);
          }
        }
        if (set == null || set.isEmpty()) {
          return Collections.singletonList(null); // placeholder for smart completion
        }
        return new ArrayList<XmlElementDescriptor>(set);

      default:
        ArrayList<XmlElementDescriptor> list = new ArrayList<XmlElementDescriptor>();
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          list.addAll(computeRequiredSubTags(subGroup));
        }
        return list;
    }
  }
コード例 #16
0
  @Override
  public void loadState(Element state) {
    final List<Element> abbreviations = state.getChildren("abbreviations");
    if (abbreviations != null && abbreviations.size() == 1) {
      final List<Element> actions = abbreviations.get(0).getChildren("action");
      if (actions != null && actions.size() > 0) {
        for (Element action : actions) {
          final String actionId = action.getAttributeValue("id");
          LinkedHashSet<String> values = myActionId2Abbreviations.get(actionId);
          if (values == null) {
            values = new LinkedHashSet<String>(1);
            myActionId2Abbreviations.put(actionId, values);
          }

          final List<Element> abbreviation = action.getChildren("abbreviation");
          if (abbreviation != null) {
            for (Element abbr : abbreviation) {
              final String abbrValue = abbr.getAttributeValue("name");
              if (abbrValue != null) {
                values.add(abbrValue);
              }
            }
          }
        }
      }
    }
  }
コード例 #17
0
ファイル: Main.java プロジェクト: akalinkov/JavaPVT
  public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    List<String> list = new ArrayList<>();

    System.out.print("Enter text to add to ArrayList: ");
    String str = input.nextLine();
    // adding text to list:
    while (true) {
      if (str.equals("exit")) break;
      list.add(str);
      System.out.print("Enter text to add to ArrayList: ");
      str = input.nextLine();
    }

    // dellete duplicates
    LinkedHashSet<String> set = new LinkedHashSet<>();
    set.addAll(list);
    list.clear();
    list.addAll(set);

    // output of arraylist
    System.out.println("All duplicates are deleted:");
    for (String elem : list) {
      System.out.println(elem);
    }
  }
コード例 #18
0
ファイル: SerDeserTest.java プロジェクト: Paytm-Sam/cassandra
  public void udtSerDeserTest(int version) throws Exception {
    ListType<?> lt = ListType.getInstance(Int32Type.instance, true);
    SetType<?> st = SetType.getInstance(UTF8Type.instance, true);
    MapType<?, ?> mt = MapType.getInstance(UTF8Type.instance, LongType.instance, true);

    UserType udt =
        new UserType(
            "ks",
            bb("myType"),
            Arrays.asList(bb("f1"), bb("f2"), bb("f3"), bb("f4")),
            Arrays.asList(LongType.instance, lt, st, mt));

    Map<ColumnIdentifier, Term.Raw> value = new HashMap<>();
    value.put(ci("f1"), lit(42));
    value.put(ci("f2"), new Lists.Literal(Arrays.<Term.Raw>asList(lit(3), lit(1))));
    value.put(ci("f3"), new Sets.Literal(Arrays.<Term.Raw>asList(lit("foo"), lit("bar"))));
    value.put(
        ci("f4"),
        new Maps.Literal(
            Arrays.<Pair<Term.Raw, Term.Raw>>asList(
                Pair.<Term.Raw, Term.Raw>create(lit("foo"), lit(24)),
                Pair.<Term.Raw, Term.Raw>create(lit("bar"), lit(12)))));

    UserTypes.Literal u = new UserTypes.Literal(value);
    Term t = u.prepare("ks", columnSpec("myValue", udt));

    QueryOptions options = QueryOptions.DEFAULT;
    if (version == 2)
      options =
          QueryOptions.fromProtocolV2(ConsistencyLevel.ONE, Collections.<ByteBuffer>emptyList());
    else if (version != 3) throw new AssertionError("Invalid protocol version for test");

    ByteBuffer serialized = t.bindAndGet(options);

    ByteBuffer[] fields = udt.split(serialized);

    assertEquals(4, fields.length);

    assertEquals(bytes(42L), fields[0]);

    // Note that no matter what the protocol version has been used in bindAndGet above, the
    // collections inside
    // a UDT should alway be serialized with version 3 of the protocol. Which is why we don't use
    // 'version'
    // on purpose below.

    assertEquals(
        Arrays.asList(3, 1), lt.getSerializer().deserializeForNativeProtocol(fields[1], 3));

    LinkedHashSet<String> s = new LinkedHashSet<>();
    s.addAll(Arrays.asList("bar", "foo"));
    assertEquals(s, st.getSerializer().deserializeForNativeProtocol(fields[2], 3));

    LinkedHashMap<String, Long> m = new LinkedHashMap<>();
    m.put("bar", 12L);
    m.put("foo", 24L);
    assertEquals(m, mt.getSerializer().deserializeForNativeProtocol(fields[3], 3));
  }
コード例 #19
0
 private boolean isUnknownState(DfaValue val) {
   val = unwrap(val);
   if (val instanceof DfaVariableValue) {
     if (myUnknownVariables.contains(val)) return true;
     DfaVariableValue negatedValue = ((DfaVariableValue) val).getNegatedValue();
     if (negatedValue != null && myUnknownVariables.contains(negatedValue)) return true;
   }
   return false;
 }
コード例 #20
0
  /**
   * Begins the in-place refactoring operation.
   *
   * @return true if the in-place refactoring was successfully started, false if it failed to start
   *     and a dialog should be shown instead.
   */
  public boolean startInplaceIntroduceTemplate() {
    final boolean replaceAllOccurrences = isReplaceAllOccurrences();
    final Ref<Boolean> result = new Ref<>();
    CommandProcessor.getInstance()
        .executeCommand(
            myProject,
            () -> {
              final String[] names = suggestNames(replaceAllOccurrences, getLocalVariable());
              final V variable = createFieldToStartTemplateOn(replaceAllOccurrences, names);
              boolean started = false;
              if (variable != null) {
                int caretOffset = getCaretOffset();
                myEditor.getCaretModel().moveToOffset(caretOffset);
                myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);

                final LinkedHashSet<String> nameSuggestions = new LinkedHashSet<>();
                nameSuggestions.add(variable.getName());
                nameSuggestions.addAll(Arrays.asList(names));
                initOccurrencesMarkers();
                setElementToRename(variable);
                updateTitle(getVariable());
                started = super.performInplaceRefactoring(nameSuggestions);
                if (started) {
                  onRenameTemplateStarted();
                  myDocumentAdapter =
                      new DocumentAdapter() {
                        @Override
                        public void documentChanged(DocumentEvent e) {
                          if (myPreview == null) return;
                          final TemplateState templateState =
                              TemplateManagerImpl.getTemplateState(myEditor);
                          if (templateState != null) {
                            final TextResult value =
                                templateState.getVariableValue(
                                    InplaceRefactoring.PRIMARY_VARIABLE_NAME);
                            if (value != null) {
                              updateTitle(getVariable(), value.getText());
                            }
                          }
                        }
                      };
                  myEditor.getDocument().addDocumentListener(myDocumentAdapter);
                  updateTitle(getVariable());
                  if (TemplateManagerImpl.getTemplateState(myEditor) != null) {
                    myEditor.putUserData(ACTIVE_INTRODUCE, this);
                  }
                }
              }
              result.set(started);
              if (!started) {
                finish(true);
              }
            },
            getCommandName(),
            getCommandName());
    return result.get();
  }
コード例 #21
0
 public void register(
     String abbreviation, String actionId, Map<String, LinkedHashSet<String>> storage) {
   LinkedHashSet<String> abbreviations = storage.get(actionId);
   if (abbreviations == null) {
     abbreviations = new LinkedHashSet<String>(1);
     storage.put(actionId, abbreviations);
   }
   abbreviations.add(abbreviation);
 }
コード例 #22
0
  LinkedHashSet<EqClass> getNonTrivialEqClasses() {
    if (myCachedNonTrivialEqClasses != null) return myCachedNonTrivialEqClasses;

    LinkedHashSet<EqClass> result = ContainerUtil.newLinkedHashSet();
    for (EqClass eqClass : myEqClasses) {
      if (eqClass != null && eqClass.size() > 1) {
        result.add(eqClass);
      }
    }
    return myCachedNonTrivialEqClasses = result;
  }
コード例 #23
0
  @Override
  public PsiType[] guessTypeToCast(
      PsiExpression expr) { // TODO : make better guess based on control flow
    LinkedHashSet<PsiType> types = new LinkedHashSet<>();

    ContainerUtil.addIfNotNull(types, getControlFlowExpressionType(expr));
    addExprTypesWhenContainerElement(types, expr);
    addExprTypesByDerivedClasses(types, expr);

    return types.toArray(PsiType.createArray(types.size()));
  }
コード例 #24
0
 int getPartialHashCode(boolean unknowns, boolean varStates) {
   int hash =
       (getNonTrivialEqClasses().hashCode() * 31 + getDistinctClassPairs().hashCode()) * 31
           + myStack.hashCode();
   if (varStates) {
     hash = hash * 31 + myVariableStates.hashCode();
   }
   if (unknowns && !myUnknownVariables.isEmpty()) {
     hash = hash * 31 + myUnknownVariables.hashCode();
   }
   return hash;
 }
 public final void a(ajy paramajy, boolean paramBoolean)
 {
   if (paramBoolean) {
     K.add(paramajy);
   }
   for (;;)
   {
     A();
     return;
     K.remove(paramajy);
   }
 }
コード例 #26
0
 @Override
 public void calcData(final DataKey key, final DataSink sink) {
   if (key.equals(LangDataKeys.PSI_ELEMENT)) {
     if (mySelectedElements != null && !mySelectedElements.isEmpty()) {
       T selectedElement = mySelectedElements.iterator().next();
       if (selectedElement instanceof ClassMemberWithElement) {
         sink.put(
             LangDataKeys.PSI_ELEMENT, ((ClassMemberWithElement) selectedElement).getElement());
       }
     }
   }
 }
コード例 #27
0
 // ## operation setReactantTree(LinkedHashSet)
 public void setReactantTree(LinkedHashSet p_treeSet) {
   // #[ operation setReactantTree(LinkedHashSet)
   if (p_treeSet == null) throw new InvalidReactantTreeException();
   int size = p_treeSet.size();
   if (size == 0) throw new InvalidReactantTreeException();
   Iterator iter = p_treeSet.iterator();
   while (iter.hasNext()) {
     HierarchyTree tree = (HierarchyTree) iter.next();
     addReactantTree(tree);
   }
   return;
   // #]
 }
コード例 #28
0
 private String constructAmendedMessage() {
   Set<VirtualFile> selectedRoots = getVcsRoots(getSelectedFilePaths()); // get only selected files
   LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet();
   if (myMessagesForRoots != null) {
     for (VirtualFile root : selectedRoots) {
       String message = myMessagesForRoots.get(root);
       if (message != null) {
         messages.add(message);
       }
     }
   }
   return DvcsUtil.joinMessagesOrNull(messages);
 }
コード例 #29
0
ファイル: ViewState.java プロジェクト: PRBonneau2/cs-studio
  /**
   * Insert the method's description here. Creation date: (21.12.2000 22:24:23)
   *
   * @return boolean
   * @param object com.cosylab.vdct.graphics.objects.VisibleObject
   * @param zoomOnHilited sets the option whether the hilited object should be zoomed in
   */
  public boolean setAsHilited(VisibleObject object, boolean zoomOnHilited) {
    this.zoomOnHilited = zoomOnHilited;

    if (zoomOnHilited) {
      DrawingSurface.getInstance().repaint();
      hilitedObjects.clear();
      if (hilitedObject != null) {
        hilitedObjects.add(hilitedObject);
      }
    }

    if (object == null) {
      hilitedObjects.clear();
      hilitedObject = null;
      return false;
    }

    if (object != hilitedObject || hilitedObjects.size() == 1) {

      hilitedObject = object;

      // initialization
      hilitedObjects.clear();
      hilitedObjects.add(hilitedObject);
      Object obj = hilitedObject;

      // inlinks
      Vector outlinks = null;
      if (obj instanceof MultiInLink) {
        outlinks = ((MultiInLink) obj).getOutlinks();
      } else if (obj instanceof InLink) {
        outlinks = new Vector();
        outlinks.add(((InLink) obj).getOutput());
      }

      if (!zoomOnHilited) {
        if (outlinks != null)
          for (int i = 0; i < outlinks.size(); i++) {
            obj = outlinks.elementAt(i);
            hilitedObjects.add(obj);
            while (obj instanceof InLink) {
              obj = ((InLink) obj).getOutput();
              hilitedObjects.add(obj);
            }
          }

        // outLinks
        obj = hilitedObject;
        while (obj instanceof OutLink) {
          obj = ((OutLink) obj).getInput();
          hilitedObjects.add(obj);
        }
      }
      return true;
    } else return false;
  }
コード例 #30
0
 private static LinkedHashSet getProvidersNotUsingCache(
     String serviceName,
     String algName,
     String attrName,
     String filterValue,
     Provider[] allProviders) {
   LinkedHashSet candidates = new LinkedHashSet(5);
   for (int i = 0; i < allProviders.length; i++) {
     if (isCriterionSatisfied(allProviders[i], serviceName, algName, attrName, filterValue)) {
       candidates.add(allProviders[i]);
     }
   }
   return candidates;
 }