Java Examples for java.util.List

The following java examples will help you to understand the usage of java.util.List. These source code samples are taken from different open source projects.

Example 1
Project: extFM-Tooling-master  File: MtextDebugMessage.java View source code
public static MtextDebugMessage deserialize(String response) {
    java.util.List<String> parts = org.feature.multi.perspective.mapping.viewmapping.resource.mtext.util.MtextStringUtil.decode(response, DELIMITER);
    String messageType = parts.get(0);
    String[] arguments = new String[parts.size() - 1];
    for (int i = 1; i < parts.size(); i++) {
        arguments[i - 1] = parts.get(i);
    }
    org.feature.multi.perspective.mapping.viewmapping.resource.mtext.debug.EMtextDebugMessageTypes type = org.feature.multi.perspective.mapping.viewmapping.resource.mtext.debug.EMtextDebugMessageTypes.valueOf(messageType);
    MtextDebugMessage message = new MtextDebugMessage(type, arguments);
    return message;
}
Example 2
Project: rascal-master  File: Variant.java View source code
@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
    if (getLocation().getBeginLine() == $line) {
        $result.add(this);
    }
    ISourceLocation $l;
    $l = name.getLocation();
    if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
        name.addForLineNumber($line, $result);
    }
    if ($l.getBeginLine() > $line) {
        return;
    }
    for (AbstractAST $elem : arguments) {
        $l = $elem.getLocation();
        if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
            $elem.addForLineNumber($line, $result);
        }
        if ($l.getBeginLine() > $line) {
            return;
        }
    }
    $l = keywordArguments.getLocation();
    if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
        keywordArguments.addForLineNumber($line, $result);
    }
    if ($l.getBeginLine() > $line) {
        return;
    }
}
Example 3
Project: openjdk-master  File: T6824493.java View source code
void run() {
    // for each of the options, we run javap and check for some
    // marker strings in the output that generally indicate the
    // presence of the expected output, without being as specific
    // as a full golden file test.
    test("-XDdetails:source", "for (int i = 0; i < 10; i++) {", "System.out.println(s + i);");
    test("-XDdetails:tryBlocks", "try[0]", "end try[0]", "catch[0]");
    test("-XDdetails:stackMaps", "StackMap locals:  this java/lang/String int", "StackMap stack:  java/lang/Throwable");
    test("-XDdetails:localVariables", "start local 3 // java.util.List list", "end local 3 // java.util.List list");
    test("-XDdetails:localVariableTypes", "start generic local 3 // java.util.List<java.lang.String> list", "end generic local 3 // java.util.List<java.lang.String> list");
    if (errors > 0)
        throw new Error(errors + " errors found");
}
Example 4
Project: teiid-designer-master  File: ModeShapeModelProcessor.java View source code
/**
     * [email protected]}
     * 
     * @see org.teiid.designer.jdbc.relational.impl.RelationalModelProcessorImpl#createNewObject(org.teiid.designer.jdbc.metadata.JdbcNode,
     *      org.teiid.designer.metamodels.relational.RelationalEntity, org.teiid.designer.jdbc.relational.impl.JdbcModelStructure,
     *      java.util.Map, org.teiid.designer.jdbc.relational.impl.Context, int, int, int,
     *      org.eclipse.core.runtime.IProgressMonitor, java.util.List, java.util.List)
     */
@Override
protected RelationalEntity createNewObject(JdbcNode node, RelationalEntity parent, JdbcModelStructure modelStructure, Map nodesToModelObjects, Context context, int totalNum, int unitsPerModelObject, int index, IProgressMonitor monitor, List problems, List newTableObjects) throws JdbcException {
    RelationalEntity entity = super.createNewObject(node, parent, modelStructure, nodesToModelObjects, context, totalNum, unitsPerModelObject, index, monitor, problems, newTableObjects);
    // make sure tables are not updateable
    if (entity instanceof Table) {
        Table table = (Table) entity;
        table.setSupportsUpdate(false);
    }
    return entity;
}
Example 5
Project: aws-sdk-android-master  File: AttributeValueJsonMarshaller.java View source code
public void marshall(AttributeValue attributeValue, AwsJsonWriter jsonWriter) throws Exception {
    jsonWriter.beginObject();
    if (attributeValue.getS() != null) {
        String s = attributeValue.getS();
        jsonWriter.name("S");
        jsonWriter.value(s);
    }
    if (attributeValue.getN() != null) {
        String n = attributeValue.getN();
        jsonWriter.name("N");
        jsonWriter.value(n);
    }
    if (attributeValue.getB() != null) {
        java.nio.ByteBuffer b = attributeValue.getB();
        jsonWriter.name("B");
        jsonWriter.value(b);
    }
    if (attributeValue.getSS() != null) {
        java.util.List<String> sS = attributeValue.getSS();
        jsonWriter.name("SS");
        jsonWriter.beginArray();
        for (String sSItem : sS) {
            if (sSItem != null) {
                jsonWriter.value(sSItem);
            }
        }
        jsonWriter.endArray();
    }
    if (attributeValue.getNS() != null) {
        java.util.List<String> nS = attributeValue.getNS();
        jsonWriter.name("NS");
        jsonWriter.beginArray();
        for (String nSItem : nS) {
            if (nSItem != null) {
                jsonWriter.value(nSItem);
            }
        }
        jsonWriter.endArray();
    }
    if (attributeValue.getBS() != null) {
        java.util.List<java.nio.ByteBuffer> bS = attributeValue.getBS();
        jsonWriter.name("BS");
        jsonWriter.beginArray();
        for (java.nio.ByteBuffer bSItem : bS) {
            if (bSItem != null) {
                jsonWriter.value(bSItem);
            }
        }
        jsonWriter.endArray();
    }
    if (attributeValue.getM() != null) {
        java.util.Map<String, AttributeValue> m = attributeValue.getM();
        jsonWriter.name("M");
        jsonWriter.beginObject();
        for (java.util.Map.Entry<String, AttributeValue> mEntry : m.entrySet()) {
            AttributeValue mValue = mEntry.getValue();
            if (mValue != null) {
                jsonWriter.name(mEntry.getKey());
                AttributeValueJsonMarshaller.getInstance().marshall(mValue, jsonWriter);
            }
        }
        jsonWriter.endObject();
    }
    if (attributeValue.getL() != null) {
        java.util.List<AttributeValue> l = attributeValue.getL();
        jsonWriter.name("L");
        jsonWriter.beginArray();
        for (AttributeValue lItem : l) {
            if (lItem != null) {
                AttributeValueJsonMarshaller.getInstance().marshall(lItem, jsonWriter);
            }
        }
        jsonWriter.endArray();
    }
    if (attributeValue.getNULL() != null) {
        Boolean nULL = attributeValue.getNULL();
        jsonWriter.name("NULL");
        jsonWriter.value(nULL);
    }
    if (attributeValue.getBOOL() != null) {
        Boolean bOOL = attributeValue.getBOOL();
        jsonWriter.name("BOOL");
        jsonWriter.value(bOOL);
    }
    jsonWriter.endObject();
}
Example 6
Project: eclipselink.runtime-master  File: MemoryQueryAcrossAggregateCollectionMapping.java View source code
public void setup() {
    customers = new Vector();
    queryAll = new ReadAllQuery();
    queryAll.setReferenceClass(cls);
    queryAll.setSelectionCriteria(new ExpressionBuilder().anyOf("customers").get("name").greaterThan("Alan Greenspan"));
    getSession().removeQuery("getAllCustomers");
    getSession().addQuery("getAllCustomers", queryAll);
    allCustomers = (Vector) getSession().executeQuery("getAllCustomers");
    for (int i = 0; i < allCustomers.size(); i++) {
        List eachCustomer = AgentBuilderHelper.getCustomers(allCustomers.get(i));
        customers.addAll(eachCustomer);
    //trigger all the value holders of customers
    }
}
Example 7
Project: xmind-master  File: CheckOpenFilesProcess.java View source code
/*
     * (non-Javadoc)
     *
     * @see
     * org.xmind.cathy.internal.jobs.OpenFilesJob#filterFilesToOpen(java.util
     * .List, org.eclipse.core.runtime.IProgressMonitor)
     */
@Override
protected void filterFilesToOpen(List<String> filesToOpen) {
    Log opening = Log.get(Log.OPENING);
    if (opening.exists()) {
        String[] contents = opening.getContents();
        for (String line : contents) {
            if (line.startsWith("xmind:") || new File(line).exists()) {
                //$NON-NLS-1$
                filesToOpen.add(line);
            }
        }
        opening.delete();
    }
}
Example 8
Project: dataverse-master  File: IndexUtil.java View source code
public static List<Long> findDvObjectIdsToProcessMod(List<Long> dvObjectIds, long mod, long which) {
    List<Long> subsetToProcess = new ArrayList<>();
    for (Long dvObjectId : dvObjectIds) {
        Long toAdd = dvObjectId % mod;
        if (toAdd.equals(which)) {
            subsetToProcess.add(dvObjectId);
        }
    }
    return subsetToProcess;
}
Example 9
Project: alien4cloud-master  File: MockLocationMatchOrchestratorFilter.java View source code
@Override
public void filter(List<ILocationMatch> toFilter, Topology topology) {
    for (Iterator<ILocationMatch> it = toFilter.iterator(); it.hasNext(); ) {
        ILocationMatch locationMatch = it.next();
        if (!locationMatch.getOrchestrator().getPluginId().equals(selfContext.getPlugin().getId())) {
            it.remove();
        }
    }
}
Example 10
Project: FallUML2013-master  File: FileUtil.java View source code
public static FileInfo getFile(String extension, List<FileInfo> fileList) {
    FileInfo info = null;
    for (int i = 0; i < fileList.size(); i++) {
        String extn = fileList.get(i).getFileName().substring(fileList.get(i).getFileName().lastIndexOf(".") + 1, fileList.get(i).getFileName().length());
        if (extn.equals(extension)) {
            info = fileList.get(i);
        }
    }
    return info;
}
Example 11
Project: dcache-master  File: NamedCellUtil.java View source code
public static String findDomainOfUniqueCell(Map<String, List<String>> domains, String cell) {
    String domain = "";
    for (Map.Entry<String, List<String>> entry : domains.entrySet()) {
        if (entry.getValue().contains(cell)) {
            domain = entry.getKey();
            break;
        }
    }
    return domain;
}
Example 12
Project: many-ql-master  File: ListenerHelper.java View source code
public Component getComponentByName(ID id, List<Component> componentList) {
    Component result = null;
    for (Component component : componentList) {
        if (id.getValue().equals(component.getName())) {
            result = component;
        }
    }
    return result;
}
Example 13
Project: airlift-master  File: ConfigDefaults.java View source code
static <T> ConfigDefaults<T> configDefaults(List<? extends ConfigDefaults<T>> configDefaults) {
    List<ConfigDefaults<T>> finalConfigDefaults = ImmutableList.copyOf(configDefaults);
    return  config -> {
        for (ConfigDefaults<T> configDefault : finalConfigDefaults) {
            configDefault.setDefaults(config);
        }
    };
}
Example 14
Project: hibernate-core-ogm-master  File: PersistentList.java View source code
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException {
    List deletes = new ArrayList();
    List sn = (List) getSnapshot();
    int end;
    if (sn.size() > list.size()) {
        for (int i = list.size(); i < sn.size(); i++) {
            deletes.add(indexIsFormula ? sn.get(i) : new Integer(i));
        }
        end = list.size();
    } else {
        end = sn.size();
    }
    for (int i = 0; i < end; i++) {
        if (list.get(i) == null && sn.get(i) != null) {
            deletes.add(indexIsFormula ? sn.get(i) : new Integer(i));
        }
    }
    return deletes.iterator();
}
Example 15
Project: openmap-master  File: TTFeatureInfoHandler.java View source code
/*
    * (non-Javadoc)
    * 
    * @see
    * com.bbn.openmap.layer.vpf.VPFFeatureInfoHandler#updateInfoForOMGraphic
    * (com.bbn.openmap.omGraphics.OMGraphic,
    * com.bbn.openmap.layer.vpf.FeatureClassInfo, java.util.List)
    */
public void updateInfoForOMGraphic(OMGraphic omg, FeatureClassInfo fci, List<Object> fcirow) {
    DcwColumnInfo[] colInfo = fci.getColumnInfo();
    int columnCount = colInfo.length;
    StringBuffer sBuf = new StringBuffer("<html><body>");
    for (int i = 0; i < columnCount; i++) {
        sBuf.append("<b>" + colInfo[i].getColumnDescription() + ":</b> " + fcirow.get(i).toString() + "<br>");
    }
    sBuf.append("</body></html>");
    omg.putAttribute(OMGraphicConstants.TOOLTIP, sBuf.toString());
}
Example 16
Project: windowtester-master  File: InvalidEventStreamWriter.java View source code
/* (non-Javadoc)
     * @see com.windowtester.swt.event.writer.IEventStreamWriter#write(java.util.List)
     */
public void write(List events) {
    //        Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
    //        MessageDialog.openError(shell, Messages.getString("InvalidEventStreamWriter.STREAM_ERROR_TITLE"), _msg); //$NON-NLS-1$
    Tracer.trace(ICodeGenPluginTraceOptions.BASIC, "write called on invalid stream writer: " + _msg);
}
Example 17
Project: sosies-generator-master  File: ParameterizedTypeTest.java View source code
public void testOurTypeFunctionality() throws Exception {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(), this, "testOurTypeFunctionality");
    Type parameterizedType = new TypeToken<java.util.List<java.lang.String>>() {
    }.getType();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3224, ourType, 3223, ourType.getOwnerType());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3225, java.lang.String.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3226, ourType.getActualTypeArguments()[0]);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3227, java.util.List.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3229, ourType, 3228, ourType.getRawType());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3230, parameterizedType);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 2740, ourType);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 3232, parameterizedType, 3231, parameterizedType.hashCode());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 2744, ourType, 2743, ourType.hashCode());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
Example 18
Project: molgenis-master  File: AggregateAnonymizerImpl.java View source code
@Override
public AnonymizedAggregateResult anonymize(final AggregateResult result, final int threshold) {
    List<List<Long>> anonymizedmatrix = Lists.newArrayList();
    for (List<Long> row : result.getMatrix()) {
        List<Long> anonymizedRow = Lists.transform(row, new Function<Long, Long>() {

            @Override
            public Long apply(Long input) {
                if (input == null)
                    return null;
                return input <= threshold ? AGGREGATE_ANONYMIZATION_VALUE : input;
            }
        });
        anonymizedmatrix.add(anonymizedRow);
    }
    return new AnonymizedAggregateResult(anonymizedmatrix, result.getxLabels(), result.getyLabels(), threshold);
}
Example 19
Project: hashtag-view-master  File: SortUtil.java View source code
public static <T> void symmetricSort(List<T> list) {
    @SuppressWarnings("unchecked") T[] array = (T[]) new Object[list.size()];
    for (int i = 0; i < list.size(); i++) {
        if (i % 2 == 0) {
            array[(list.size() - i) / 2 + (list.size() % 2 - 1)] = list.get(i);
        } else {
            array[(list.size() + i) / 2] = list.get(i);
        }
    }
    int j = 0;
    ListIterator<T> it = list.listIterator();
    while (it.hasNext()) {
        it.next();
        it.set(array[j++]);
    }
}
Example 20
Project: eclipse-commons-master  File: CollectionUtils.java View source code
/**
	 * Compares two lists lexicographically that contain comparable elements.
	 */
public static <T extends Comparable<? super T>> int compare(List<T> list1, List<T> list2) {
    int size1 = list1.size();
    int size2 = list2.size();
    int minSize = Math.min(size1, size2);
    for (int i = 0; i < minSize; i++) {
        int difference = list1.get(i).compareTo(list2.get(i));
        if (difference != 0) {
            return difference;
        }
    }
    if (size1 == size2) {
        return 0;
    } else {
        return size1 - size2;
    }
}
Example 21
Project: ehour-master  File: UserUtil.java View source code
public static List<User> filterUserOnRole(List<User> users, UserRole userRole) {
    List<User> validUsers = new ArrayList<>();
    // result of bad many-to-many mapping. should fix once..
    for (User user : users) {
        if (user.getUserRoles().contains(userRole)) {
            validUsers.add(user);
        }
    }
    return validUsers;
}
Example 22
Project: Yhb-2.0-master  File: PathHelper.java View source code
public static Path pathFromPoints(List<Point> points) {
    Path path = new Path();
    Point start = points.get(0);
    path.moveTo((float) start.x, (float) start.y);
    int l = points.size();
    for (int i = 1; i < l; i++) {
        Point point = points.get(i);
        path.lineTo((float) point.x, (float) point.y);
    }
    return path;
}
Example 23
Project: polly-master  File: AbstractLogOutput.java View source code
public String formatLogs(List<LogEntry> logs, LogFormatter formatter, FormatManager pollyFormat) {
    StringWriter string = new StringWriter();
    PrintWriter pw = new PrintWriter(string);
    Iterator<LogEntry> it = logs.iterator();
    while (it.hasNext()) {
        LogEntry log = it.next();
        pw.print(formatter.formatLog(log, pollyFormat));
        if (it.hasNext()) {
            pw.println();
        }
    }
    return string.toString();
}
Example 24
Project: PortalWaitingList-master  File: SearchUtil.java View source code
public static void searchByPortalName(List<PortalDetail> allPortals, List<PortalDetail> resultPortals, String queryText) {
    resultPortals.clear();
    if (queryText.equals("")) {
        MailProcessUtil.getInstance().filterAndSort(SettingUtil.TypeFilterMethod.ALL, SettingUtil.ResultFilterMethod.EVERYTHING, SettingUtil.SortOrder.LAST_DATE_DESC, allPortals, resultPortals);
    } else {
        for (PortalDetail eachPortal : allPortals) {
            if (eachPortal.getName().contains(queryText))
                resultPortals.add(eachPortal);
        }
    }
}
Example 25
Project: ProjectModel-master  File: MyAjax.java View source code
public static void createAjaxResponseContent(Object object, javax.servlet.http.HttpServletResponse response, String type) {
    response.setContentType("text/" + type + "; charset=utf-8");
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Expires", "0");
    java.io.PrintWriter out = null;
    try {
        out = response.getWriter();
    } catch (java.io.IOException e) {
    }
    out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    out.println("<HigherUp>");
    if (object instanceof String)
        out.println("<![CDATA[" + object + "]]>");
    else if (object instanceof java.util.List) {
        java.util.List list = (java.util.List) object;
        for (int i = 0; i < list.size(); i++) {
            Object obj[] = (Object[]) list.get(i);
            out.println("<Child>");
            for (int j = 0; i < obj.length; j++) {
                String value = obj[j] == null ? "" : obj[j].toString();
                out.println("<Value" + (j + 1) + "><![CDATA[" + value + "]]></Value" + (j + i) + ">");
            }
            out.println("</Child>");
        }
    }
    out.println("</HigherUp>");
}
Example 26
Project: dk-master  File: PaginationCallback.java View source code
public Pagination<T> getPage(List<Map<String, Object>> datas, Pagination<T> page) {
    int size = datas.size();
    List<T> results = new ArrayList<T>(size);
    for (int i = 0; i < size; i++) {
        Map<String, Object> data = datas.get(i);
        results.add(toCustomizedBean(data));
    }
    page.setRows(results);
    return page;
}
Example 27
Project: financius-public-master  File: SharpPathMaker.java View source code
@Override
public Path makePath(List<PointF> points) {
    final Path path = new Path();
    for (int i = 0, size = points != null ? points.size() : 0; i < size; i++) {
        final PointF point = points.get(i);
        if (point == null) {
            continue;
        }
        if (i == 0 || points.get(i - 1) == null) {
            path.moveTo(point.x, point.y);
        } else {
            path.lineTo(point.x, point.y);
        }
    }
    return path;
}
Example 28
Project: cms-ce-master  File: TermFacetResultSetCreator.java View source code
protected FacetResultSet create(final String facetName, final TermsFacet facet) {
    TermsFacetResultSet termsFacetResultSet = new TermsFacetResultSet();
    termsFacetResultSet.setName(facetName);
    termsFacetResultSet.setTotal(facet.getTotalCount());
    termsFacetResultSet.setMissing(facet.getMissingCount());
    termsFacetResultSet.setOther(facet.getOtherCount());
    final List<? extends TermsFacet.Entry> entries = facet.getEntries();
    for (TermsFacet.Entry entry : entries) {
        termsFacetResultSet.addResult(entry.getTerm().toString(), entry.getCount());
    }
    return termsFacetResultSet;
}
Example 29
Project: ocr-tools-master  File: Merger.java View source code
public void mergeBuffered(List<InputStream> inputs, OutputStream output) throws IOException {
    BufferedOutputStream bufferedOutput = new BufferedOutputStream(output, 8 * 1024);
    try {
        merge(inputs, bufferedOutput);
    } finally {
        bufferedOutput.flush();
        bufferedOutput.close();
    }
}
Example 30
Project: FireflowEngine20-master  File: JsonAopConfigration.java View source code
public void setItemList(List<List<String>> itemList) {
    List<AopConfigrationItem> aopItemList = new ArrayList<AopConfigrationItem>();
    for (List<String> list : itemList) {
        AopConfigrationItem item = new AopConfigrationItem();
        item.setClassName(list.get(0));
        item.setMethodName(list.get(1));
        item.setInterceptor(list.get(2));
        if (list.size() == 4)
            item.setSingleton(Boolean.parseBoolean(list.get(3)));
        aopItemList.add(item);
    }
    super.setAopItemList(aopItemList);
}
Example 31
Project: AIDR-master  File: TaggerCrisisAttributesResponse.java View source code
/*
    public void setCrisisAttributes(List<TaggerCrisesAttribute> crisisAttributes) {
        this.crisisAttributes = crisisAttributes;
    }
    */
public void setCrisisAttributes(List<CrisisAttributesDTO> dtoList) {
    if (dtoList != null) {
        List<TaggerCrisesAttribute> list = new ArrayList<TaggerCrisesAttribute>();
        for (CrisisAttributesDTO dto : dtoList) {
            TaggerCrisesAttribute attribute = new TaggerCrisesAttribute(dto);
            list.add(attribute);
        }
        this.crisisAttributes = list;
    }
}
Example 32
Project: MUtils-master  File: ListSizeComparator.java View source code
@Override
public int compare(List<?> lhs, List<?> rhs) {
    int diff = lhs.size() - rhs.size();
    if (diff > 0) {
        return mOrder == Order.ASC ? 1 : -1;
    } else if (diff < 0) {
        return mOrder == Order.ASC ? -1 : 1;
    } else {
        return 0;
    }
}
Example 33
Project: tdq-studio-se-master  File: MatchRuleAnlaysisUtilsTest.java View source code
/**
     * Test method for
     * [email protected] [email protected]eAnlaysisUtils#sortDataByColumn(org.talend.dataquality.record.linkage.ui.composite.table.SortState, java.util.List, java.util.List)}
     * .
     */
public void testSortDataByColumn_int() {
    // ASC
    sortState.getNextSortDirection();
    Integer[] intArray = { new Integer(3) };
    Integer[] intArray2 = { new Integer(2) };
    Integer[] intArray4 = { new Integer(4) };
    Integer[] intArray3 = { new Integer(1) };
    sortData.add(intArray);
    sortData.add(intArray2);
    sortData.add(intArray4);
    sortData.add(intArray3);
    sqlDataType.setName("INT");
    sqlDataType.setJavaDataType(Types.INTEGER);
    List<Object[]> sortResult = MatchRuleAnlaysisUtils.sortDataByColumn(sortState, sortData, columns);
    Assert.assertEquals(4, sortResult.size());
    Assert.assertTrue(((Integer) sortResult.get(0)[0]).compareTo(1) == 0);
    Assert.assertTrue(((Integer) sortResult.get(1)[0]).compareTo(2) == 0);
    Assert.assertTrue(((Integer) sortResult.get(2)[0]).compareTo(3) == 0);
    sortState.setSelectedColumnIndex(0);
    // DESC
    sortState.getNextSortDirection();
    sortResult = MatchRuleAnlaysisUtils.sortDataByColumn(sortState, sortData, columns);
    Assert.assertEquals(((Integer) sortResult.get(0)[0]).intValue(), 4);
    Assert.assertEquals(((Integer) sortResult.get(1)[0]).intValue(), 3);
    Assert.assertEquals(((Integer) sortResult.get(2)[0]).intValue(), 2);
}
Example 34
Project: solmix-master  File: InternalExtensionParserTest.java View source code
@Test
public void test() {
    URL url = this.getClass().getResource("java.util.List");
    List<ExtensionInfo> extensions = new InternalExtensionParser(null).getExtensions(url);
    Assert.assertEquals("Unexpected number of Extension elements.", 2, extensions.size());
    ExtensionInfo e1 = extensions.get(0);
    Assert.assertTrue(e1.isDeferred());
    Assert.assertTrue(e1.isOptional());
    ExtensionInfo e2 = extensions.get(1);
    Assert.assertEquals("java.util.LinkedList", e2.getClassname());
    Assert.assertEquals("java.util.List", e2.getInterfaceName());
    Assert.assertTrue(LinkedList.class == e2.getClassObject(Thread.currentThread().getContextClassLoader()));
}
Example 35
Project: tmdm-studio-se-master  File: ViewMainPage.java View source code
@Override
protected void refreshData() {
    try {
        if (this.comitting) {
            return;
        }
        this.refreshing = true;
        WSView wsObject = getWsViewObject();
        //$NON-NLS-1$
        desAntionComposite.setText(wsObject.getDescription() == null ? "" : wsObject.getDescription());
        btnRunProcess.setSelection(wsObject.getIsTransformerActive().isTrue());
        if (btnRunProcess.getSelection()) {
            cboProcessList.setEnabled(true);
            cboProcessList.setText(wsObject.getTransformerPK());
        } else {
            cboProcessList.setEnabled(false);
            //$NON-NLS-1$
            cboProcessList.setText("");
        }
        java.util.List<Line> vlines = new ArrayList<Line>();
        java.util.List<String> vis = wsObject.getViewableBusinessElements();
        if (vis != null) {
            for (String vi : vis) {
                String strings[] = new String[] { vi };
                Line line = new Line(viewableElementColumns, strings);
                vlines.add(line);
            }
        }
        viewableViewer.getViewer().setInput(vlines);
        java.util.List<Line> slines = new ArrayList<Line>();
        java.util.List<String> ses = wsObject.getSearchableBusinessElements();
        if (ses != null) {
            for (String se : ses) {
                String strings[] = new String[] { se };
                Line line = new Line(searchableElementColumns, strings);
                slines.add(line);
            }
        }
        searchableViewer.getViewer().setInput(slines);
        java.util.List<Line> lines = new ArrayList<Line>();
        for (WSWhereCondition wc : wsObject.getWhereConditions()) {
            Line line = new Line(conditionsColumns, Util.convertWhereCondition(wc));
            lines.add(line);
        }
        conditionViewer.getViewer().setInput(lines);
        this.refreshing = false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages.ViewMainPage_ErrorRefreshPage, Messages.bind(Messages.ViewMainPage_ErrorRefreshPageXX, e.getLocalizedMessage()));
    }
}
Example 36
Project: FreeBuilder-master  File: ImportManagerTest.java View source code
@Test
public void testTypeMirrorShortening() {
    ImportManager manager = new ImportManager.Builder().build();
    assertEquals("String", manager.shorten(newTopLevelClass("java.lang.String")));
    assertEquals("List", manager.shorten(newTopLevelClass("java.util.List")));
    assertEquals("java.awt.List", manager.shorten(newTopLevelClass("java.awt.List")));
    ClassTypeImpl mapType = newTopLevelClass("java.util.Map");
    assertEquals("Map", manager.shorten(mapType));
    assertEquals("Map.Entry", manager.shorten(newNestedClass(mapType.asElement(), "Entry")));
    assertThat(manager.getClassImports()).containsExactly("java.util.List", "java.util.Map").inOrder();
}
Example 37
Project: Eclipse-Postfix-Code-Completion-master  File: NewDefiningMethodProposal.java View source code
/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.ui.text.correction.proposals.AbstractMethodCorrectionProposal#addNewParameters(org.eclipse.jdt.core.dom.rewrite.ASTRewrite, java.util.List, java.util.List)
	 */
@Override
protected void addNewParameters(ASTRewrite rewrite, List<String> takenNames, List<SingleVariableDeclaration> params) throws CoreException {
    AST ast = rewrite.getAST();
    ImportRewrite importRewrite = getImportRewrite();
    ITypeBinding[] bindings = fMethod.getParameterTypes();
    IJavaProject project = getCompilationUnit().getJavaProject();
    String[][] paramNames = StubUtility.suggestArgumentNamesWithProposals(project, fParamNames);
    for (int i = 0; i < bindings.length; i++) {
        ITypeBinding curr = bindings[i];
        String[] proposedNames = paramNames[i];
        SingleVariableDeclaration newParam = ast.newSingleVariableDeclaration();
        newParam.setType(importRewrite.addImport(curr, ast));
        newParam.setName(ast.newSimpleName(proposedNames[0]));
        params.add(newParam);
        //$NON-NLS-1$
        String groupId = "arg_name_" + i;
        addLinkedPosition(rewrite.track(newParam.getName()), false, groupId);
        for (int k = 0; k < proposedNames.length; k++) {
            addLinkedPositionProposal(groupId, proposedNames[k], null);
        }
    }
}
Example 38
Project: Valkyrie-RCP-master  File: CustomizableFocusTraversalPolicy.java View source code
/**
     * Sets a custom focus traversal order for the given container. Child
     * components for which there is no order specified will receive focus after
     * components that do have an order specified in the standard "layout"
     * order.
     *
     * @param container
     *            the container
     * @param componentsInOrder
     *            a list of child components in the order that thay should
     *            receive focus
     */
public static void customizeFocusTraversalOrder(JComponent container, java.util.List componentsInOrder) {
    for (Iterator i = componentsInOrder.iterator(); i.hasNext(); ) {
        Component comp = (Component) i.next();
        if (comp.getParent() != container) {
            throw new IllegalArgumentException("Component [" + comp + "] is not a child of [" + container + "].");
        }
    }
    container.putClientProperty(FOCUS_ORDER_PROPERTY_NAME, createOrderMapFromList(componentsInOrder));
}
Example 39
Project: JFugue-for-Android-master  File: XPathFunctionImpl.java View source code
/**
     * @see javax.xml.xpath.XPathFunction#evaluate(java.util.List)
     */
public Object evaluate(List args) throws XPathFunctionException {
    Vector argsVec = listToVector(args);
    try {
        // The method key and ExpressionContext are set to null.
        return m_handler.callFunction(m_funcName, argsVec, null, null);
    } catch (TransformerException e) {
        throw new XPathFunctionException(e);
    }
}
Example 40
Project: openjdk8-jdk-master  File: TargetFileListFrame.java View source code
public void drop(DropTargetDropEvent dtde) {
    list.removeAll();
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    java.util.List<File> fileList = extractListOfFiles(dtde);
    for (File file : fileList) {
        list.add(file.getName());
    }
    if (fileList.size() != expectationTransferredFilesNumber) {
        System.err.println("ERROR: Expected file number:" + expectationTransferredFilesNumber + "; Received file number: " + fileList.size());
        TargetFileListFrame.this.dispose();
        System.exit(InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET);
    }
    TargetFileListFrame.this.dispose();
}
Example 41
Project: LambdaDojo-master  File: S204LambdaInsteadOfAnonClass.java View source code
// 2-4 Lambda 式で書きかえてみましょう
private void rewriteByLambda() {
    Function<String, Integer> function = new Function<String, Integer>() {

        @Override
        public Integer apply(String word) {
            return word.length();
        }
    };
    List<String> words = Arrays.asList("one thing was certain that the white kitten had had nothing to do with it".split(" "));
    double average = 0.0;
    for (String word : words) {
        average += function.apply(word);
    }
    average /= words.size();
    System.out.println("Average: " + average);
}
Example 42
Project: octarine-master  File: Validation.java View source code
static <T> Validation<T> invalid(List<String> validationErrors) {
    return new Validation<T>() {

        @Override
        public boolean isValid() {
            return false;
        }

        @Override
        public List<String> validationErrors() {
            return validationErrors;
        }

        @Override
        public Valid<T> get() {
            throw new RecordValidationException(validationErrors());
        }
    };
}
Example 43
Project: breakout-master  File: CSVTest.java View source code
@Test
public void testParseLine() {
    CSVFormat csv = new CSVFormat();
    csv.trimWhitespace(false);
    String original = "\"Test \"  \"\"one,\"Test \"\" two\",1997\n,  Ford,,E350,\"Super, \"\"luxurious\"\" truck\",";
    List<String> fields = Arrays.asList("Test   one", "Test \" two", "1997\n", "  Ford", "", "E350", "Super, \"luxurious\" truck", "");
    List<String> parsed = csv.parseLine(original);
    Assert.assertEquals(fields, parsed);
    String formatted = csv.formatLine(fields);
    Assert.assertEquals("Test   one,\"Test \"\" two\",1997\n,  Ford,,E350,\"Super, \"\"luxurious\"\" truck\",", formatted);
}
Example 44
Project: erlide-master  File: IErlTypespecTest.java View source code
@Test
public void getName() throws Exception {
    final IErlModule module2 = ErlideTestUtils.createModule(project, "yy.erl", "-module(yy).\n" + "-spec return_error(integer(), any()) -> no_return().\n" + "return_error(Line, Message) ->\n" + "    throw({error, {Line, ?MODULE, Message}}).");
    module2.open(null);
    final List<IErlElement> childrenOfKind = module2.getChildrenOfKind(ErlElementKind.TYPESPEC);
    final IErlElement element = childrenOfKind.get(0);
    final IErlTypespec typespec = (IErlTypespec) element;
    assertEquals("return_error", typespec.getName());
}
Example 45
Project: dtangler-master  File: RuleMemberSelectorImpl.java View source code
public String selectRuleMember(List<String> groupNames) {
    ActionFactory actionFactory = new ActionFactory();
    SwingRuleMemberView view = new SwingRuleMemberView(actionFactory);
    RuleMemberModel model = new RuleMemberModel(groupNames);
    RuleMemberPresenter presenter = new RuleMemberPresenter(view, model);
    new RuleMemberGlue(actionFactory, presenter, windowManager, view);
    windowManager.showModal(view);
    return model.getValue();
}
Example 46
Project: btpka3.github.com-master  File: SpringTest.java View source code
public static void main(String[] args) throws BeansException {
    final int THREAD_COUNT = 10;
    ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext("applicationContext.xml");
    CuratorFramework client = (CuratorFramework) appCtx.getBean("zkClient");
    List<Thread> list = new ArrayList<Thread>();
    // 创建并启动线程
    for (int i = 0; i < THREAD_COUNT; i++) {
        Thread t = new Thread(new MyTask(client, i));
        t.start();
        list.add(t);
    }
    // 等待线程结束
    for (int i = 0; i < THREAD_COUNT; i++) {
        Thread t = list.get(i);
        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Example 47
Project: expenditures-master  File: MissionProcessProvider.java View source code
@Override
public Collection getSearchResults(Map<String, String> argsMap, String value, int maxCount) {
    final String currentValue = StringUtils.trim(value);
    final List<MissionProcess> result = new ArrayList<MissionProcess>();
    final MissionSystem missionSystem = MissionSystem.getInstance();
    for (final MissionProcess missionProcess : missionSystem.getMissionProcessesSet()) {
        String[] processIdParts = missionProcess.getProcessNumber().split("/M");
        if (missionProcess.getProcessIdentification().equals(currentValue) || processIdParts[processIdParts.length - 1].equals(currentValue)) {
            result.add(missionProcess);
        }
    }
    return result;
}
Example 48
Project: FTL-Hyperion-master  File: EventAction.java View source code
@Override
public void preform(String action, Object... params) {
    Ship ship = game.getShip((String) params[0]);
    MapEvent event = game.getEvent(ship);
    String s1 = (String) params[1];
    if (s1.equals("ListActions")) {
        List<String> actions = event.getActions();
        for (int i = 0; i < actions.size(); i++) {
            System.out.println("" + i + ": " + actions.get(i));
        }
    } else {
        int actionIndex = Integer.parseInt(s1);
        List<String> actions = event.getActions();
        String eventAction = actions.get(actionIndex);
        event.preformAction(eventAction);
    }
}
Example 49
Project: avaje-ebeanorm-master  File: CustomerTest.java View source code
@Test
public void canInsert() {
    Customer customer = new Customer();
    customer.setName("Rob");
    //customer.setFoo("one");
    customer.save();
//
//    assertThat(customer.getId()).isNotNull();
//    Customer rob = Ebean.find(Customer.class)
//        .where().eq("name", "Rob")
//        .findUnique();
//
//    rob.setShortDesc("cone");
//    Ebean.save(rob);
//    long now = System.currentTimeMillis();
//    Timestamp ts = new Timestamp(now - 1000*60*10);
//
//    List<Customer> list = Ebean.find(Customer.class)
//        .asOf(ts)
//        .findList();
//
//    System.out.print("asd");
}
Example 50
Project: traffic-balance-master  File: JSONMessageComposer.java View source code
@Override
public String composeLocationDataMessage(List<Location> locations) {
    JSONArray array = new JSONArray();
    try {
        for (Location loc : locations) {
            JSONObject object = new JSONObject();
            object.put("lon", loc.getLongitude());
            object.put("lat", loc.getLatitude());
            object.put("time", loc.getTime());
            object.put("speed", loc.getSpeed());
            object.put("acc", loc.getAccuracy());
            object.put("course", loc.getBearing());
            array.put(object);
        }
    } catch (JSONException e) {
        Log.e("JSONComposer", e.toString());
    }
    return array.toString();
}
Example 51
Project: sonar-java-master  File: ToArrayCheck.java View source code
<E extends T> Object[] foo(List<String> list, Set rawSet, Collection<E> col) {
    // Noncompliant [[sc=30;ec=44]] {{Pass "new String[0]" as argument to "toArray".}}
    String[] a1 = (String[]) list.toArray();
    // Noncompliant [[sc=30;ec=46]] {{Pass "new Number[0]" as argument to "toArray".}}
    Number[] a2 = (Number[]) rawSet.toArray();
    // Compliant
    Object[] a3 = list.toArray();
    // Compliant
    String[] a4 = list.toArray(new String[0]);
    // Compliant
    Object[] a5 = (Object[]) list.toArray();
    // Compliant
    E[] a6 = (E[]) col.toArray();
    // Compliant
    Object o = (Object) list.toArray();
    // Compliant
    return list.toArray();
}