Search in sources :

Example 76 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_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 77 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_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 78 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_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 79 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_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 80 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_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)114 Entity (org.hypertrace.entity.data.service.v1.Entity)110 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)102 Test (org.junit.jupiter.api.Test)95 CraftEntity (org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity)53 Entity (net.minecraft.world.entity.Entity)42 Location (org.bukkit.Location)41 ArrayList (java.util.ArrayList)39 Entity (com.google.datastore.v1.Entity)33 net.minecraft.world.entity (net.minecraft.world.entity)33 org.bukkit.entity (org.bukkit.entity)32 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)32 Player (org.bukkit.entity.Player)29 ServerPlayer (net.minecraft.server.level.ServerPlayer)28 LivingEntity (net.minecraft.world.entity.LivingEntity)28 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)28 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)27 Event (org.hypertrace.core.datamodel.Event)27 Mob (net.minecraft.world.entity.Mob)25 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)23