Search in sources :

Example 66 with Entity

use of net.minecraft.server.v1_16_R2.Entity in project jmix-docs by Haulmont.

the class DataGridScreen method createCloseButton.

// end::details-generator[]
// tag::create-close-button[]
protected Component createCloseButton(Customer entity) {
    Button closeButton = uiComponents.create(Button.class);
    closeButton.setIcon("font-icon:TIMES");
    BaseAction closeAction = new BaseAction("closeAction").withHandler(actionPerformedEvent -> detailsGrid.setDetailsVisible(entity, false)).withCaption("");
    closeButton.setAction(closeAction);
    return closeButton;
}
Also used : CollectionLoader(io.jmix.ui.model.CollectionLoader) ValueSource(io.jmix.ui.component.data.ValueSource) ThemeClassNames(io.jmix.ui.theme.ThemeClassNames) CollectionContainer(io.jmix.ui.model.CollectionContainer) Date(java.util.Date) Collection(java.util.Collection) Autowired(org.springframework.beans.factory.annotation.Autowired) ContainerDataGridItems(io.jmix.ui.component.data.datagrid.ContainerDataGridItems) ExcelExportAction(io.jmix.uiexport.action.ExcelExportAction) Notifications(io.jmix.ui.Notifications) JmixIcon(io.jmix.ui.icon.JmixIcon) DateUtils(org.apache.commons.lang3.time.DateUtils) UiComponents(io.jmix.ui.UiComponents) Icons(io.jmix.ui.icon.Icons) io.jmix.ui.screen(io.jmix.ui.screen) ui.ex1.entity(ui.ex1.entity) Map(java.util.Map) BaseAction(io.jmix.ui.action.BaseAction) Named(javax.inject.Named) io.jmix.ui.component(io.jmix.ui.component) BaseAction(io.jmix.ui.action.BaseAction)

Example 67 with Entity

use of net.minecraft.server.v1_16_R2.Entity in project nomulus by google.

the class BulkDeleteDatastorePipeline method setupPipeline.

// org.apache.beam.sdk.transforms.Reshuffle
@SuppressWarnings("deprecation")
private void setupPipeline(Pipeline pipeline) {
    checkState(!FORBIDDEN_PROJECTS.contains(options.getProject()), "Bulk delete is forbidden in %s", options.getProject());
    // Pre-allocated tags to label entities by kind. In the case of delete-all, we must use a guess.
    TupleTagList deletionTags;
    PCollection<String> kindsToDelete;
    if (options.getKindsToDelete().equals("*")) {
        deletionTags = getDeletionTags(options.getNumOfKindsHint());
        kindsToDelete = pipeline.apply("DiscoverEntityKinds", discoverEntityKinds(options.getProject()));
    } else {
        ImmutableList<String> kindsToDeleteParam = parseKindsToDelete(options);
        checkState(!kindsToDeleteParam.contains("*"), "The --kindsToDelete argument should not contain both '*' and other kinds.");
        deletionTags = getDeletionTags(kindsToDeleteParam.size());
        kindsToDelete = pipeline.apply("UseProvidedKinds", Create.of(kindsToDeleteParam));
    }
    // Map each kind to a tag. The "SplitByKind" stage below will group entities by kind using
    // this mapping. In practice, this has been effective at avoiding entity group contentions.
    PCollectionView<Map<String, TupleTag<Entity>>> kindToTagMapping = mapKindsToDeletionTags(kindsToDelete, deletionTags).apply("GetKindsToTagMap", View.asMap());
    PCollectionTuple entities = kindsToDelete.apply("GenerateQueries", ParDo.of(new GenerateQueries())).apply("ReadEntities", DatastoreV1.read().withProjectId(options.getProject())).apply("SplitByKind", ParDo.of(new SplitEntities(kindToTagMapping)).withSideInputs(kindToTagMapping).withOutputTags(getOneDeletionTag("placeholder"), deletionTags));
    for (TupleTag<?> tag : deletionTags.getAll()) {
        entities.get((TupleTag<Entity>) tag).apply("RebalanceLoad", Reshuffle.viaRandomKey()).apply("DeleteEntities_" + tag.getId(), DatastoreIO.v1().deleteEntity().withProjectId(options.getProject()));
    }
}
Also used : Entity(com.google.datastore.v1.Entity) TupleTagList(org.apache.beam.sdk.values.TupleTagList) PCollectionTuple(org.apache.beam.sdk.values.PCollectionTuple) Map(java.util.Map)

Example 68 with Entity

use of net.minecraft.server.v1_16_R2.Entity in project java-language by googleapis.

the class Analyze method entitySentimentText.

/**
 * Detects the entity sentiments in the string {@code text} using the Language Beta API.
 */
public static void entitySentimentText(String text) throws Exception {
    // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
    try (LanguageServiceClient language = LanguageServiceClient.create()) {
        Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();
        AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder().setDocument(doc).setEncodingType(EncodingType.UTF16).build();
        // detect entity sentiments in the given string
        AnalyzeEntitySentimentResponse response = language.analyzeEntitySentiment(request);
        // Print the response
        for (Entity entity : response.getEntitiesList()) {
            System.out.printf("Entity: %s\n", entity.getName());
            System.out.printf("Salience: %.3f\n", entity.getSalience());
            System.out.printf("Sentiment : %s\n", entity.getSentiment());
            for (EntityMention mention : entity.getMentionsList()) {
                System.out.printf("Begin offset: %d\n", mention.getText().getBeginOffset());
                System.out.printf("Content: %s\n", mention.getText().getContent());
                System.out.printf("Magnitude: %.3f\n", mention.getSentiment().getMagnitude());
                System.out.printf("Sentiment score : %.3f\n", mention.getSentiment().getScore());
                System.out.printf("Type: %s\n\n", mention.getType());
            }
        }
    }
// [END language_entity_sentiment_text]
}
Also used : LanguageServiceClient(com.google.cloud.language.v1.LanguageServiceClient) Entity(com.google.cloud.language.v1.Entity) EntityMention(com.google.cloud.language.v1.EntityMention) AnalyzeEntitySentimentRequest(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) Document(com.google.cloud.language.v1.Document) AnalyzeEntitySentimentResponse(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)

Example 69 with Entity

use of net.minecraft.server.v1_16_R2.Entity in project java-language by googleapis.

the class Analyze method analyzeEntitiesText.

/**
 * Identifies entities in the string {@code text}.
 */
public static void analyzeEntitiesText(String text) throws Exception {
    // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
    try (LanguageServiceClient language = LanguageServiceClient.create()) {
        Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();
        AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder().setDocument(doc).setEncodingType(EncodingType.UTF16).build();
        AnalyzeEntitiesResponse response = language.analyzeEntities(request);
        // Print the response
        for (Entity entity : response.getEntitiesList()) {
            System.out.printf("Entity: %s", entity.getName());
            System.out.printf("Salience: %.3f\n", entity.getSalience());
            System.out.println("Metadata: ");
            for (Map.Entry<String, String> entry : entity.getMetadataMap().entrySet()) {
                System.out.printf("%s : %s", entry.getKey(), entry.getValue());
            }
            for (EntityMention mention : entity.getMentionsList()) {
                System.out.printf("Begin offset: %d\n", mention.getText().getBeginOffset());
                System.out.printf("Content: %s\n", mention.getText().getContent());
                System.out.printf("Type: %s\n\n", mention.getType());
            }
        }
    }
// [END language_entities_text]
}
Also used : LanguageServiceClient(com.google.cloud.language.v1.LanguageServiceClient) Entity(com.google.cloud.language.v1.Entity) AnalyzeEntitiesRequest(com.google.cloud.language.v1.AnalyzeEntitiesRequest) EntityMention(com.google.cloud.language.v1.EntityMention) AnalyzeEntitiesResponse(com.google.cloud.language.v1.AnalyzeEntitiesResponse) Document(com.google.cloud.language.v1.Document) Map(java.util.Map)

Example 70 with Entity

use of net.minecraft.server.v1_16_R2.Entity in project java-language by googleapis.

the class Analyze method entitySentimentFile.

/**
 * Identifies the entity sentiments in the the GCS hosted file using the Language Beta API.
 */
public static void entitySentimentFile(String gcsUri) throws Exception {
    // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
    try (LanguageServiceClient language = LanguageServiceClient.create()) {
        Document doc = Document.newBuilder().setGcsContentUri(gcsUri).setType(Type.PLAIN_TEXT).build();
        AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder().setDocument(doc).setEncodingType(EncodingType.UTF16).build();
        // Detect entity sentiments in the given file
        AnalyzeEntitySentimentResponse response = language.analyzeEntitySentiment(request);
        // Print the response
        for (Entity entity : response.getEntitiesList()) {
            System.out.printf("Entity: %s\n", entity.getName());
            System.out.printf("Salience: %.3f\n", entity.getSalience());
            System.out.printf("Sentiment : %s\n", entity.getSentiment());
            for (EntityMention mention : entity.getMentionsList()) {
                System.out.printf("Begin offset: %d\n", mention.getText().getBeginOffset());
                System.out.printf("Content: %s\n", mention.getText().getContent());
                System.out.printf("Magnitude: %.3f\n", mention.getSentiment().getMagnitude());
                System.out.printf("Sentiment score : %.3f\n", mention.getSentiment().getScore());
                System.out.printf("Type: %s\n\n", mention.getType());
            }
        }
    }
// [END language_entity_sentiment_gcs]
}
Also used : LanguageServiceClient(com.google.cloud.language.v1.LanguageServiceClient) Entity(com.google.cloud.language.v1.Entity) EntityMention(com.google.cloud.language.v1.EntityMention) AnalyzeEntitySentimentRequest(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) Document(com.google.cloud.language.v1.Document) AnalyzeEntitySentimentResponse(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)94 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 net.minecraft.world.entity (net.minecraft.world.entity)32 org.bukkit.entity (org.bukkit.entity)32 Entity (com.google.datastore.v1.Entity)31 Location (org.bukkit.Location)30 ArrayList (java.util.ArrayList)22 Test (org.junit.Test)21 Entity (net.minecraft.server.v1_12_R1.Entity)20 Entity (net.minecraft.server.v1_16_R3.Entity)19 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)18 Entity (net.minecraft.server.v1_8_R3.Entity)17 Entity (net.minecraft.server.v1_11_R1.Entity)16 Mob (net.minecraft.world.entity.Mob)16 CraftEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity)16 org.bukkit.craftbukkit.v1_17_R1.entity (org.bukkit.craftbukkit.v1_17_R1.entity)16 PathEntity (net.minecraft.server.v1_16_R3.PathEntity)13 Entity (net.minecraft.server.v1_15_R1.Entity)12 Entity (net.minecraft.server.v1_13_R2.Entity)11 PathEntity (net.minecraft.server.v1_15_R1.PathEntity)11