Example usage for java.util List set

List of usage examples for java.util List set

Introduction

In this page you can find the example usage for java.util List set.

Prototype

E set(int index, E element);

Source Link

Document

Replaces the element at the specified position in this list with the specified element (optional operation).

Usage

From source file:jp.co.tis.gsp.tools.db.beans.Erd.java

public void init() {
    for (Entity entity : entityList) {
        entity.setErd(this);
        entity.init();/*from w w  w .  j av  a  2  s  .co m*/
    }

    for (ModelView modelView : modelViewList) {
        // MODELVIEW?ENTITY?ID????????????
        List<Entity> modelViewEntityList = modelView.getEntityList();
        if (modelViewEntityList != null) {
            for (int i = 0; i < modelViewEntityList.size(); i++) {
                Entity genuineEntity = getEntity(modelViewEntityList.get(i).getId());
                modelViewEntityList.set(i, genuineEntity);
            }
        }
        // MODELVIEW?VIEW?ID????????????
        List<View> modelViewViewList = modelView.getViewList();
        if (modelViewViewList != null) {
            for (int i = 0; i < modelViewViewList.size(); i++) {
                View genuineView = getView(modelViewViewList.get(i).getId());
                modelViewViewList.set(i, genuineView);
            }
        }
    }

}

From source file:com.norconex.importer.handler.tagger.impl.CharacterCaseTagger.java

@Override
public void tagApplicableDocument(String reference, InputStream document, ImporterMetadata metadata,
        boolean parsed) throws ImporterHandlerException {

    for (String fieldName : fieldCases.keySet()) {
        String type = fieldCases.get(fieldName);
        List<String> values = metadata.getStrings(fieldName);
        if (values != null) {
            for (int i = 0; i < values.size(); i++) {
                String value = values.get(i);
                if (CASE_UPPER.equals(type)) {
                    values.set(i, StringUtils.upperCase(value));
                } else if (CASE_LOWER.equals(type)) {
                    values.set(i, StringUtils.lowerCase(value));
                } else if (CASE_WORDS.equals(type)) {
                    values.set(i, WordUtils.capitalizeFully(value));
                } else {
                    LOG.warn("Unsupported character case type: " + type);
                }//from ww w. j  ava  2s .  c  o  m
            }
            metadata.setString(fieldName, values.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
        }
    }
}

From source file:com.headstrong.fusion.messaging.service.CBRProcessor.java

/**
 * Sets the index values to null if the sublist at that index is empty.
 * Required for the content based router.
 * /*from   w  w w  .  j av a  2s .  co m*/
 * @param list
 */
private void clearEmptySubLists(List<List<Object>> list) {
    for (int i = 0; i < list.size(); i++) {
        List<Object> subList = list.get(i);
        if (subList != null && subList.isEmpty()) {
            list.set(i, FusionConstants.EMPTY_LIST);
        }
    }
}

From source file:edu.iu.common.MultiFileInputFormat.java

private void randomizeFileListOrder(List<FileStatus> files) {
    Random random = new Random(System.currentTimeMillis());
    int numFiles = files.size();
    for (int i = numFiles - 1; i > 0; i--) {
        int nextRandom = random.nextInt(i + 1);
        if (nextRandom != i) {
            FileStatus tmpFile = files.get(i);
            files.set(i, files.get(nextRandom));
            files.set(nextRandom, tmpFile);
        }/*from w ww  . jav  a  2 s.  c  om*/
    }
}

From source file:edu.iu.fileformat.MultiFileInputFormat.java

@SuppressWarnings("unused")
private void randomizeFileListOrder(List<FileStatus> files) {
    Random random = new Random(System.currentTimeMillis());
    int numFiles = files.size();
    for (int i = numFiles - 1; i > 0; i--) {
        int nextRandom = random.nextInt(i + 1);
        if (nextRandom != i) {
            FileStatus tmpFile = files.get(i);
            files.set(i, files.get(nextRandom));
            files.set(nextRandom, tmpFile);
        }//from w  w  w.  j ava  2 s  .co  m
    }
}

From source file:banner.tagging.dictionary.DictionaryTagger.java

protected List<String> process(String input) {
    if (input == null)
        throw new IllegalArgumentException();
    List<String> tokens = tokenizer.getTokens(input);
    for (int i = 0; i < tokens.size(); i++)
        tokens.set(i, transform(tokens.get(i)));
    return tokens;
}

From source file:com.sk89q.craftbook.sponge.mechanics.area.complex.ComplexArea.java

@Listener
public void onSignChange(ChangeSignEvent event, @First Player player) {
    for (String line : getValidSigns()) {
        if (SignUtil.getTextRaw(event.getText(), 1).equalsIgnoreCase(line)) {
            if (!createPermissions.hasPermission(player)
                    && !("[SaveArea]".equals(line) && createSavePermissions.hasPermission(player))) {
                player.sendMessage(/*  w w w  . jav a2s .co  m*/
                        Text.of(TextColors.RED, "You do not have permission to create this mechanic!"));
                event.setCancelled(true);
            } else {
                List<Text> lines = event.getText().lines().get();
                lines.set(1, Text.of(line));

                String namespace = lines.get(0).toPlain();
                boolean personal = false;
                if ("global".equals(namespace.toLowerCase())) {
                    if (!createGlobalPermissions.hasPermission(player)) {
                        player.sendMessage(Text.of(TextColors.RED,
                                "You do not have permission to create global ToggleAreas!"));
                        event.setCancelled(true);
                        return;
                    } else {
                        namespace = "GLOBAL";
                    }
                } else if (namespace.trim().isEmpty() || !createOtherPermissions.hasPermission(player)) {
                    namespace = player.getUniqueId().toString();
                    personal = true;
                }

                lines.set(0, Text.of(personal ? player.getName() : namespace));

                if (!isValidArea(namespace, lines.get(2).toPlain(), lines.get(3).toPlain())) {
                    player.sendMessage(Text.of(TextColors.RED, "This area is missing!"));
                    event.setCancelled(true);
                    return;
                }

                event.getTargetTile().offer(new NamespaceData(namespace));

                event.getText().set(Keys.SIGN_LINES, lines);

                player.sendMessage(Text.of(TextColors.YELLOW, "Created ToggleArea!"));
            }

            break;
        }
    }
}

From source file:delfos.rs.contentbased.vsm.booleanvsm.BooleanFeaturesTransformation.java

public List<Double> getDoubleVector(SparseVector<Long> sparseVector) {

    List<Double> ret = new ArrayList<>(numFeatures);
    for (int i = 0; i < numFeatures; i++) {
        ret.add(0.0);//from   www  .java  2  s.co  m
    }
    for (Pair<Long, Double> entry : sparseVector.entrySet()) {
        ret.set(entry.getKey().intValue(), (double) entry.getValue());
    }
    return ret;
}

From source file:io.servicecomb.swagger.generator.pojo.PojoSwaggerGeneratorContext.java

protected void replaceBodyBasedParameter(OperationGenerator operationGenerator, Parameter bodyBasedParameter) {
    if (ParamUtils.isRealBodyParameter(bodyBasedParameter)) {
        return;/*from   w  ww .  j ava 2s  .  c om*/
    }

    List<Parameter> swaggerParameters = operationGenerator.getSwaggerParameters();
    int idx = swaggerParameters.indexOf(bodyBasedParameter);
    String bodyParamName = bodyBasedParameter.getName();
    BodyParameter bodyParameter = ((PendingBodyParameter) bodyBasedParameter)
            .createBodyParameter(bodyParamName);
    swaggerParameters.set(idx, bodyParameter);
}

From source file:edu.usf.cutr.fdot7.io.IndividualCsvEntityReader.java

public void handleLine(List<String> line) throws Exception {

    if (line.size() == 0)
        return;//from   ww w .  ja  v a2 s .  co  m

    if (_trimValues) {
        for (int i = 0; i < line.size(); i++)
            line.set(i, line.get(i).trim());
    }

    if (!_initialized) {
        readSchema(line);
        _initialized = true;
    } else {
        readEntity(line);
    }
    _line++;
    if (_verbose && _line % 1000 == 0)
        System.out.println("entities=" + _line);
}