当前位置: 首页>>代码示例>>Java>>正文


Java Log.trace方法代码示例

本文整理汇总了Java中com.esotericsoftware.minlog.Log.trace方法的典型用法代码示例。如果您正苦于以下问题:Java Log.trace方法的具体用法?Java Log.trace怎么用?Java Log.trace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esotericsoftware.minlog.Log的用法示例。


在下文中一共展示了Log.trace方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBiomeLegend

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * Create a map of all Biomes, mapping the biome name to the url of the biome image.
 * The map is ordered by its keys.
 * @return
 */
private static Map<String, String> getBiomeLegend() {
    Map<String, String> result = new TreeMap<>();

    // Get list of all biomeicons in 32px folder
    File tilesDir = Paths.get(Uristmaps.conf.fetch("Paths", "tiles"), "32").toFile();
    for (File tileFile : tilesDir.listFiles(filename -> filename.getName().endsWith(".png"))) {
        String biomeName = FilenameUtils.removeExtension(tileFile.getName());
        if (biomeName.startsWith("castle") || biomeName.startsWith("village")
                || biomeName.startsWith("river") || biomeName.startsWith("wall")
                || biomeName.startsWith("road") || biomeName.startsWith("tunnel")
                || biomeName.startsWith("farmland") || biomeName.startsWith("bridge")) {
            Log.trace("TemplateRenderer", "Skipping " + biomeName + " in biome legend.");
            continue;
        }

        // Add icon under the biome name to the result map.
        result.put(WordUtils.capitalize(biomeName.replace("_", " ")), "biome_legend/" + tileFile.getName().replace(" ", "_"));
    }

    return result;
}
 
开发者ID:dominiks,项目名称:uristmapsj,代码行数:27,代码来源:TemplateRenderer.java

示例2: replaceFriend

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * replace connection with a random new one
 * @param agent agent who will be connected to a new friend
 * @param friendBeingReplaced old friend whose connection will be removed
 * @param ignoreDirection should I check if the connection exists ignoring directions?
 * @return new friend
 */
public Fisher replaceFriend(Fisher agent,
                            Fisher friendBeingReplaced,
                            boolean ignoreDirection,
                            MersenneTwisterFast random,
                            List<Fisher> fishers)
{
    FriendshipEdge edge = network.findEdge(agent, friendBeingReplaced);
    if(ignoreDirection && edge == null)
        edge = network.findEdge(friendBeingReplaced,agent);
    Preconditions.checkArgument(edge!=null, "cannot remove a friendship that isn't here!");
    network.removeEdge(edge);


    Fisher newFriend = null;
    while(newFriend == null)
    {
        Fisher candidate = fishers.get(random.nextInt(fishers.size()));
        //if you are not already friends
        if(     candidate != friendBeingReplaced &&
                candidate != agent  &&
                !network.isPredecessor(agent,candidate) &&
                (!ignoreDirection || !network.isSuccessor(agent,candidate)))
            newFriend = candidate;
    }

    network.addEdge(new FriendshipEdge(),agent,newFriend);

    //log the change, if anybody is listening
    if(Log.TRACE)
        Log.trace(agent + " changed friends from " + friendBeingReplaced + " to " + newFriend);



    return newFriend;

}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:44,代码来源:SocialNetwork.java

示例3: reactToSale

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**burn through quotas; because of "maximum biomass sellable"  method, I expect here that the biomass
 * sold is less or equal to the quota available
 *
 * @param species  the species of fish sold
 * @param seller  agent selling the fish
 * @param biomass how much biomass has been sold
 * @param revenue how much money was made off it
 */
@Override
public void reactToSale(Species species, Fisher seller, double biomass, double revenue) {
    double newQuota = quotaRemaining[species.getIndex()] - biomass;
    if(Log.TRACE)
        Log.trace("lowering quota for " + species + " owned by " + seller + "to " +
                          newQuota);
    setQuotaRemaining(species.getIndex(), newQuota);
    Preconditions.checkArgument(quotaRemaining[species.getIndex()]>=- FishStateUtilities.EPSILON, quotaRemaining[species.getIndex()]);
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:18,代码来源:MultiQuotaRegulation.java

示例4: answer

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * Grabs the list of current options and returns the list of all options that are acceptable
 * @param currentOptions list of options, possibly already filtered by others. It is <b>unmodifiable</b>
 * @param representation
 * @param state          the model   @return a list of acceptable options or null if there is pure indifference among them
 * @param fisher   */
@Override
public List<T> answer(
        List<T> currentOptions, FeatureExtractors<T> representation, FishState state, Fisher fisher) {
    Preconditions.checkArgument(!currentOptions.isEmpty());
    if(Log.TRACE)
        Log.trace(" picking a random option");

    return Collections.singletonList(currentOptions.get(state.getRandom().nextInt(currentOptions.size())));
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:16,代码来源:RandomAnswer.java

示例5: apply

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
@Override
public void apply(Fisher fisher1, Gear change, FishState model) {
    if (Log.TRACE)
        Log.trace(fisher1 + " is about to change gear");
    //predictions are wrong: reset at the end of the trip
    fisher1.addDockingListener(new DockingListener() {
        boolean active = true;
        @Override
        public void dockingEvent(Fisher fisher, Port port)
        {
            if(!active)
                return;
            fisher1.setGear(change.makeCopy());
            Log.trace(fisher1 + " has changed gear and will reset its predictor");
            fisher1.resetDailyCatchesPredictors();
            active=false;
            DockingListener outer = this;
            //schedule to remove the listener
            model.scheduleOnce((Steppable) simState -> fisher1.removeDockingListener(outer), StepOrder.DAWN);


        }
    });



}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:28,代码来源:GearImitationAnalysis.java

示例6: processWidget

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * Process the given widget. Called after a widget has been built by the
 * <code>WidgetBuilder</code>, and before it is added to the <code>Layout</code>.
 *
 * @param widget      the widget to process. Never null
 * @param elementName XML node name of the business field. Typically 'entity', 'property' or 'action'.
 *                    Never null
 * @param attributes  attributes of the widget to process. Never null. This Map is modifiable - changes
 *                    will be passed to subsequent WidgetProcessors and Layouts
 * @param metawidget  the parent Metawidget. Never null
 * @return generally the original widget (as passed in to the first argument). Can be a
 * different widget if the WidgetProcessor wishes to substitute the original widget for
 * another. Can be null if the WidgetProcessor wishes to cancel all further processing
 * of this widget (including laying out)
 */
@Override
public JComponent processWidget(
        JComponent widget, String elementName, Map<String, String> attributes, SwingMetawidget metawidget) {
    Class<?> clazz = WidgetBuilderUtils.getActualClassOrType(attributes, String.class );
    if(clazz!=null) {
        try {
            if (clazz.isArray()) {

                //nested address? no problem
                String address = StrategyFactoryWidgetProcessor.addressFromPath(
                        attributes,metawidget);
                //current class

                String toDisplay =
                        FishStateUtilities.deepToStringArray(
                                PropertyUtils.getProperty(metawidget.getToInspect(), address), " , ","|");

                JLabel label = new JLabel(toDisplay);

                widget.add(label);
            }
        } catch (Exception e) {
            Log.trace("cannot display " + attributes.get("name"));

        }
    }
    return widget;
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:44,代码来源:ArrayWidgetProcessor.java

示例7: Kryo

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/** @param referenceResolver May be null to disable references. */
public Kryo (ClassResolver classResolver, ReferenceResolver referenceResolver, StreamFactory streamFactory) {
	if (classResolver == null) throw new IllegalArgumentException("classResolver cannot be null.");

	this.classResolver = classResolver;
	classResolver.setKryo(this);

	this.streamFactory = streamFactory;
	streamFactory.setKryo(this);

	this.referenceResolver = referenceResolver;
	if (referenceResolver != null) {
		referenceResolver.setKryo(this);
		references = true;
	}

	addDefaultSerializer(byte[].class, ByteArraySerializer.class);
	addDefaultSerializer(char[].class, CharArraySerializer.class);
	addDefaultSerializer(short[].class, ShortArraySerializer.class);
	addDefaultSerializer(int[].class, IntArraySerializer.class);
	addDefaultSerializer(long[].class, LongArraySerializer.class);
	addDefaultSerializer(float[].class, FloatArraySerializer.class);
	addDefaultSerializer(double[].class, DoubleArraySerializer.class);
	addDefaultSerializer(boolean[].class, BooleanArraySerializer.class);
	addDefaultSerializer(String[].class, StringArraySerializer.class);
	addDefaultSerializer(Object[].class, ObjectArraySerializer.class);
	addDefaultSerializer(KryoSerializable.class, KryoSerializableSerializer.class);
	addDefaultSerializer(BigInteger.class, BigIntegerSerializer.class);
	addDefaultSerializer(BigDecimal.class, BigDecimalSerializer.class);
	addDefaultSerializer(Class.class, ClassSerializer.class);
	addDefaultSerializer(Date.class, DateSerializer.class);
	addDefaultSerializer(Enum.class, EnumSerializer.class);
	addDefaultSerializer(EnumSet.class, EnumSetSerializer.class);
	addDefaultSerializer(Currency.class, CurrencySerializer.class);
	addDefaultSerializer(StringBuffer.class, StringBufferSerializer.class);
	addDefaultSerializer(StringBuilder.class, StringBuilderSerializer.class);
	addDefaultSerializer(Collections.EMPTY_LIST.getClass(), CollectionsEmptyListSerializer.class);
	addDefaultSerializer(Collections.EMPTY_MAP.getClass(), CollectionsEmptyMapSerializer.class);
	addDefaultSerializer(Collections.EMPTY_SET.getClass(), CollectionsEmptySetSerializer.class);
	addDefaultSerializer(Collections.singletonList(null).getClass(), CollectionsSingletonListSerializer.class);
	addDefaultSerializer(Collections.singletonMap(null, null).getClass(), CollectionsSingletonMapSerializer.class);
	addDefaultSerializer(Collections.singleton(null).getClass(), CollectionsSingletonSetSerializer.class);
	addDefaultSerializer(TreeSet.class, TreeSetSerializer.class);
	addDefaultSerializer(Collection.class, CollectionSerializer.class);
	addDefaultSerializer(TreeMap.class, TreeMapSerializer.class);
	addDefaultSerializer(Map.class, MapSerializer.class);
	addDefaultSerializer(TimeZone.class, TimeZoneSerializer.class);
	addDefaultSerializer(Calendar.class, CalendarSerializer.class);
	addDefaultSerializer(Locale.class, LocaleSerializer.class);
	lowPriorityDefaultSerializerCount = defaultSerializers.size();

	// Primitives and string. Primitive wrappers automatically use the same registration as primitives.
	register(int.class, new IntSerializer());
	register(String.class, new StringSerializer());
	register(float.class, new FloatSerializer());
	register(boolean.class, new BooleanSerializer());
	register(byte.class, new ByteSerializer());
	register(char.class, new CharSerializer());
	register(short.class, new ShortSerializer());
	register(long.class, new LongSerializer());
	register(double.class, new DoubleSerializer());
	register(void.class, new VoidSerializer());
	
	// Lambdas support
	// Enable only if JVM supports it
	try {
		String version = System.getProperty("java.version");
		char minor = version.charAt(2);
		if (minor >= '8') {
			register(Class.forName("java.lang.invoke.SerializedLambda"));
			register(Closure.class, (Serializer)Class.forName("com.esotericsoftware.kryo.serializers.ClosureSerializer")
				.newInstance());
		}
	} catch (Exception e) {
		Log.trace("Serialization of Java8 lambdas is not available on this system.");
	}
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:78,代码来源:Kryo.java

示例8: thresholdAnswer

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * generic method to be shared between ThresholdAnswer and FeatureThresholdAnswer
 @param currentOptions list of options, possibly already filtered by others. It is <b>unmodifiable</b>
  * @param thresholdExtractor the function returning the threshold for any option we are testing
 * @param minimumNumberOfObservations the minimum number of observations we need before this answer applies
 * @param <T> the type of candidate we are thresholding on
 * @return the list of all the acceptable candidates (or null if none apply)
 */
public static <T> List<T> thresholdAnswer (List<T> currentOptions,
                                           Map<T, Double> features,
                                           Function<T,Double> thresholdExtractor,
                                           int minimumNumberOfObservations,
                                           boolean goodAboveThreshold)
{

    //no feature, indifference
    if(features == null || features.isEmpty())
    {
        if(Log.TRACE)
            Log.trace("Threshold filter found no features and is therefore indifferent");
        return null;
    }


    //not enough features, indifferent
    List<T> actualOptions = new LinkedList<>(currentOptions);
    actualOptions.retainAll(features.keySet());
    if(actualOptions.size() < minimumNumberOfObservations)
    {
        if(Log.TRACE)
            Log.trace("Threshold filter found " + actualOptions.size() +
                              " options with features: too few compared to the minimum of " + minimumNumberOfObservations);
        return null;
    }
    else
    {
        //you have enough! take only the ones that pass the threshold
        LinkedList<T> passTheTest = new LinkedList<>();
        for(Map.Entry<T,Double> feature : features.entrySet())
        {
            double minimumThreshold = thresholdExtractor.apply(feature.getKey());
            if(Double.isFinite(minimumThreshold) &&
                    actualOptions.contains(feature.getKey()))
                if( (goodAboveThreshold  && feature.getValue() >= minimumThreshold ) ||
                        (!goodAboveThreshold  && feature.getValue() <= minimumThreshold )   )
                passTheTest.add(feature.getKey());
        }
        if(Log.TRACE)
            Log.trace("Threshold filter  found " + passTheTest +
                              " as acceptable, a total of " + passTheTest.size() + " options out of " +
                              features.size() + " available");
        return passTheTest;
    }
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:55,代码来源:ThresholdAnswer.java

示例9: defaultMarketTransaction

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
/**
 * does some standard stuff relating to selling fish:
 * 1) finds out how much is actually legal to sell
 * 2) give fisher money
 * 3) tell regulation
 * notice that it doesn't tell fisher to clear its hold, that should be the fisher responsibility
 * @param biomass pounds of fish to sell
 * @param fisher the seller
 * @param regulation the regulation object the seller abides to
 * @param state the model
 * @param biomassToRevenue a function to find out how much money does the biomass sold actually command
 * @return biomass actually sold
 */
static TradeInfo defaultMarketTransaction(
        double biomass, Fisher fisher, Regulation regulation,
        FishState state, Function<Double, Double> biomassToRevenue, Species species
)
{

    //find out legal biomass sold
    double biomassActuallySellable = Math.min(biomass,
                                              regulation.maximumBiomassSellable(fisher, species, state));

    if(Log.TRACE && biomassActuallySellable < biomass)
        Log.trace("Regulations allow only " + biomassActuallySellable + " to be sold by " + fisher);

    if(biomassActuallySellable <=0)
        return new TradeInfo(0, species, 0);



    double revenue = biomassToRevenue.apply(biomassActuallySellable);

    //give fisher the money
    fisher.earn(revenue);

    //tell regulation
    regulation.reactToSale(species, fisher , biomassActuallySellable, revenue);

    //return biomass sellable
    return new TradeInfo(biomassActuallySellable, species, revenue);

}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:44,代码来源:Market.java

示例10: recordTrade

import com.esotericsoftware.minlog.Log; //导入方法依赖的package包/类
public void recordTrade(TradeInfo info)
{
    if(Log.TRACE && info.getBiomassTraded() >  0)
        Log.trace("recorded the following trade: " + info);
    dailyCounter.count(EARNINGS_COLUMN_NAME,info.getMoneyExchanged());
    dailyCounter.count(LANDINGS_COLUMN_NAME, info.getBiomassTraded());



}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:11,代码来源:AbstractMarket.java


注:本文中的com.esotericsoftware.minlog.Log.trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。