本文整理汇总了Java中jline.internal.Log.warn方法的典型用法代码示例。如果您正苦于以下问题:Java Log.warn方法的具体用法?Java Log.warn怎么用?Java Log.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jline.internal.Log
的用法示例。
在下文中一共展示了Log.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hashCode
import jline.internal.Log; //导入方法依赖的package包/类
@Override
public int hashCode() {
if(keyFields != null && keyFields.size() > 0) {
switch(keyFields.size()) {
case 1:
return properties.get(keyFields.iterator().next()).hashCode();
case 2:
Iterator<String> it = keyFields.iterator();
String a = it.next();
String b = it.next();
return Objects.hash(properties.get(a), properties.get(b));
default:
Log.warn("Not implemented");
return 0; // FIXME
}
} else {
int result = Arrays.hashCode(points);
result = 31 * result + (properties != null ? properties.hashCode() : 0);
return result;
}
}
示例2: stringArrayToEnumArray
import jline.internal.Log; //导入方法依赖的package包/类
public static <T extends Enum<T>> T[] stringArrayToEnumArray(String[] stringArray, Class<T> clazz) {
List<T> tmp = new ArrayList<>();
boolean addNull = false;
for(String s : stringArray) {
if(s == null || s.length() == 0) {
addNull = true;
continue;
}
try {
tmp.add(T.valueOf(clazz, s));
} catch (IllegalArgumentException e) {
Log.warn("Enum value " + s + " not found in " + clazz.toString());
}
}
// this is to distinguish between a null value and an empty array
if(tmp.size() == 0 && addNull) tmp.add(null);
return tmp.toArray((T[]) Array.newInstance(clazz, tmp.size()));
}
示例3: deserialize
import jline.internal.Log; //导入方法依赖的package包/类
@Override
public T deserialize(VPackSlice parent, VPackSlice vpack, VPackDeserializationContext vPackDeserializationContext) throws VPackException {
String v;
if(vpack.getType() == ValueType.INT || vpack.getType() == ValueType.UINT || vpack.getType() == ValueType.SMALLINT)
v = ((Integer) vpack.getAsInt()).toString();
else if(vpack.getType() == ValueType.DOUBLE)
v = ((Double) vpack.getAsDouble()).toString();
else if(vpack.getType() == ValueType.BOOL)
v = ((Boolean) vpack.getAsBoolean()).toString().toUpperCase();
else
v = vpack.getAsString();
if(v.equals("")) return nullValue;
try {
return (T) T.valueOf(tClass, v);
} catch (IllegalArgumentException e) {
Log.warn("Value " + v + " not found in enum constant.");
return nullValue;
}
}
示例4: flush
import jline.internal.Log; //导入方法依赖的package包/类
public void flush() throws IOException {
Log.trace("Flushing history");
if (!file.exists()) {
File dir = file.getParentFile();
if (!dir.exists() && !dir.mkdirs()) {
Log.warn("Failed to create directory: ", dir);
}
if (!file.createNewFile()) {
Log.warn("Failed to create file: ", file);
}
}
PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file)));
try {
for (Entry entry : this) {
out.println(entry.value());
}
}
finally {
out.close();
}
}
示例5: bake
import jline.internal.Log; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
final IModel model = loadBaseModel(state, format, bakedTextureGetter);
IBlockState blockState = null;
if (defaultBlockState.isPresent()) {
final Block defaultBlock = Block.REGISTRY.getObject(defaultBlockState.get());
if (defaultBlock != Blocks.AIR) {
blockState = defaultBlock.getDefaultState();
if (!(blockState instanceof IExtendedBlockState) ||
!((IExtendedBlockState)blockState).getUnlistedNames().contains(EvalModelState.PROPERTY)) {
Log.warn("State %s does not contain eval state property", blockState);
}
} else {
Log.warn("Can't find default block: %s", defaultBlockState.get());
}
}
final IVarExpander expander = evaluatorFactory.createExpander();
return new BakedEvalExpandModel(model, state, format, bakedTextureGetter, blockState, expander);
}
示例6: TaxonPrivileges
import jline.internal.Log; //导入方法依赖的package包/类
public TaxonPrivileges(String[] taxa, String[] privileges) {
this.applicableTaxa = taxa;
if(this.privileges == null) this.privileges = new HashSet<>();
for(String p : privileges) {
try {
this.privileges.add(Privileges.valueOf(p));
} catch (IllegalArgumentException e) {
Log.warn("Privilege " + p + " not found.");
}
}
}
示例7: processKMLFeature
import jline.internal.Log; //导入方法依赖的package包/类
/**
* Recursively process a KML and spit out all placemarks in all folders
* @param feature
* @param output
*/
private void processKMLFeature(List<Feature> feature, List<Inventory> output) {
for (int i = 0; i < feature.size(); i++) {
if(Folder.class.isAssignableFrom(feature.get(i).getClass())) {
Folder folder = (Folder) feature.get(i);
processKMLFeature(folder.getFeature(), output);
continue;
}
if(Placemark.class.isAssignableFrom(feature.get(i).getClass())) {
Placemark pm = (Placemark) feature.get(i);
if(Point.class.isAssignableFrom(pm.getGeometry().getClass())) {
Point p = (Point) pm.getGeometry();
Inventory inv = new Inventory();
inv.setLatitude((float) p.getCoordinates().get(0).getLatitude());
inv.setLongitude((float) p.getCoordinates().get(0).getLongitude());
inv.setCode(pm.getName());
inv.setPubNotes(pm.getDescription());
if (mainObserver)
inv.setObservers(new String[] {user.getID()});
inv.setMaintainer(user.getID());
inv.getUnmatchedOccurrences().add(new OBSERVED_IN(true));
// System.out.println(pm.getName()+": "+ p.getCoordinates().get(0).getObservationLatitude()+", "+p.getCoordinates().get(0).getObservationLongitude());
output.add(inv);
} else
Log.warn("Skipped non-point placemark in KML");
}
}
}
示例8: PolygonTheme
import jline.internal.Log; //导入方法依赖的package包/类
/**
* Create from geoJson and construct a map.
* @param geoJsonStream
* @param keyFieldName The name of the field for use as the key. Key needs not be unique.
*/
public PolygonTheme(InputStream geoJsonStream, String keyFieldName) {
FeatureCollection features;
try {
features = new ObjectMapper().readValue(geoJsonStream, FeatureCollection.class);
geoJsonStream.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
int npoly = 0;
// Multimap to allow multiple polygons with the same key
this.polygons = ArrayListMultimap.create();
String key;
for(Feature f : features) {
if(Polygon.class.isInstance(f.getGeometry())) {
pt.floraon.geometry.Polygon pol = new pt.floraon.geometry.Polygon();
List<LngLatAlt> tmp2 = ((Polygon) f.getGeometry()).getExteriorRing();
LngLatAlt ll;
for (int i = 0; i < tmp2.size() - 1; i++) {
ll = tmp2.get(i);
pol.add(new Point2D(ll.getLongitude(), ll.getLatitude()));
}
pol.setProperties(f.getProperties());
if(keyFieldName != null)
key = f.getProperties().get(keyFieldName).toString();
else
key = "" + npoly;
this.polygons.put(key, pol);
npoly++;
} else Log.warn("Feature of type "+f.getGeometry().getClass()+" ignored.");
}
}
示例9: getAllSpeciesOrInferiorTaxEnt
import jline.internal.Log; //导入方法依赖的package包/类
@Override
public List<TaxEnt> getAllSpeciesOrInferiorTaxEnt(Boolean onlyCurrent, boolean higherTaxa, String territory, Integer offset, Integer count) throws FloraOnException {
String query = null;
boolean withLimit = false;
if(!(offset==null && count==null)) {
if(offset==null) offset=0;
if(count==null) count=50;
withLimit=true;
}
if(territory == null) {
return Collections.emptyList();
// FIXME return all taxa - should know the root node?
} else {
Log.warn("Possibly omitting taxa from the checklist.");
query=AQLQueries.getString("ListDriver.8"
, territory
, onlyCurrent ? "&& thistaxon.current" : ""
, withLimit ? "LIMIT "+offset+","+count : ""
, higherTaxa ? ", OUTBOUND PART_OF" : ""
);
System.out.println(query);
}
try {
return database.query(query, null, null, TaxEnt.class).asListRemaining();
} catch (ArangoDBException e) {
throw new FloraOnException(e.getMessage());
}
}
示例10: purge
import jline.internal.Log; //导入方法依赖的package包/类
public void purge() throws IOException {
Log.trace("Purging history");
clear();
if (!file.delete()) {
Log.warn("Failed to delete history file: ", file);
}
}
示例11: stop
import jline.internal.Log; //导入方法依赖的package包/类
/**
* Stop the sshd daemon.
*/
public void stop() {
if (sshd != null) {
try {
sshd.stop();
} catch (InterruptedException e) {
Log.warn("Couldn't stop the sshd daemon gracefully", e);
}
}
}
示例12: addFilledBucket
import jline.internal.Log; //导入方法依赖的package包/类
public ContainerBucketFillHandler addFilledBucket(ItemStack filledBucket) {
FluidStack containedFluid = FluidUtil.getFluidContained(filledBucket);
if (containedFluid != null) {
buckets.add(Pair.of(containedFluid.copy(), filledBucket.copy()));
} else {
Log.warn("Item %s is not a filled bucket", filledBucket);
}
return this;
}
示例13: matchTaxEntNames
import jline.internal.Log; //导入方法依赖的package包/类
@Override
public void matchTaxEntNames(Inventory inventory, boolean createNew, boolean doMatch, InventoryList inventories) throws FloraOnException {
INodeWorker nwd = driver.getNodeWorkerDriver();
MutableBoolean ask = new MutableBoolean(false);
for(OBSERVED_IN oi : inventory.getUnmatchedOccurrences()) {
TaxEnt te, te1;
List<TaxEnt> matched;
Log.info("Verbose name: "+ oi.getVerbTaxon());
if(oi.getVerbTaxon() == null) continue;
if(oi.getVerbTaxon().trim().equals("")) {
Log.info(" Empty name, clearing");
// if(inventories != null) inventories.addNoMatch(oi);
oi.setTaxEntMatch("");
continue;
}
try {
te = TaxEnt.parse(oi.getVerbTaxon());
} catch (FloraOnException e) { // could not even parse the name
if(inventories != null)
// inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
inventories.addParseError(oi.getVerbTaxon());
Log.warn(e.getMessage());
oi.setTaxEntMatch("");
continue;
}
Log.info(" Parsed name: "+ te.getFullName(false));
matched = nwd.getTaxEnt(te, ask);
switch(matched.size()) {
case 0:
if (createNew) {
te1 = nwd.createTaxEntFromTaxEnt(te);
Log.warn(" No match, created new taxon");
if(inventories != null) inventories.addNoMatch(oi);
oi.setTaxEntMatch(te1.getID());
} else {
Log.warn(" No match, do you want to add new taxon?");
if(inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
//inventories.addNoMatch(oi);
oi.setTaxEntMatch("");
}
break;
default:
if(!ask.booleanValue()) {
Log.info(" Matched name: " + matched.get(0).getFullName(false), " -- ", matched.get(0).getID());
oi.setTaxEntMatch(matched.get(0).getID());
if(doMatch && inventories != null) {
Map<String, TaxonomicChange> tmp1 = new HashMap<>();
tmp1.put(oi.getVerbTaxon(), new TaxonomicChange(matched.get(0).getID(), oi.getUuid().toString(), null));
replaceTaxEntMatch(tmp1);
inventories.getVerboseWarnings().add("Automatically matched " + oi.getVerbTaxon() + " to " + matched.get(0).getID());
//inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), matched.get(0));
}
} else {
if(matched.size() == 0 && inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
else {
for (TaxEnt tmp : matched) {
if (inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), tmp);
}
}
oi.setTaxEntMatch("");
}
break;
}
}
}
示例14: onAskingForIt
import jline.internal.Log; //导入方法依赖的package包/类
@SubscribeEvent
public static void onAskingForIt(ServerChatEvent event)
{
if(!Configurator.VOLCANO.enableVolcano) return;
EntityPlayerMP player = event.getPlayer();
if(player.getHeldItemMainhand().getItem() == Items.LAVA_BUCKET && event.getMessage().toLowerCase().contains("volcanos are awesome"))
{
long time = CommonProxy.currentTimeMillis();
if(event.getUsername() == lastTroubleMaker
&& player.getPosition().equals(lastAttemptLocation)
&& time - lastAttemptTimeMillis < 30000)
{
//FIXME" check for volcano nearby
attemptsAtTrouble++;
//FIXME: localize
if(attemptsAtTrouble == 1)
{
player.sendMessage(new TextComponentString(String.format("This is a really bad idea, %s", player.getDisplayNameString())));
}
else if(attemptsAtTrouble == 2)
{
player.sendMessage(new TextComponentString(String.format("I hope there isn't anything nearby you want to keep.", player.getDisplayNameString())));
}
else if(attemptsAtTrouble == 3)
{
player.sendMessage(new TextComponentString(String.format("Now would be a good time to run away.", player.getDisplayNameString())));
player.world.setBlockState(new BlockPos(lastAttemptLocation.getX(), 0, lastAttemptLocation.getZ()), ModBlocks.volcano_block.getDefaultState());
}
}
else
{
attemptsAtTrouble = 0;
}
lastTroubleMaker = event.getUsername();
lastAttemptLocation = player.getPosition();
lastAttemptTimeMillis = time;
Log.warn("player is asking for it at " + event.getPlayer().posX + " " + event.getPlayer().posZ);
}
}
示例15: start
import jline.internal.Log; //导入方法依赖的package包/类
/**
* Start the ssh daemon.
*/
public void start() {
final String portString = System.getProperty(COMMANDER_SSH_PORT);
if (portString == null) {
Log.warn("No 'commander.ssh.port' specified, ssh support will not be enabled!");
return;
}
int port;
try {
port = Integer.parseInt(portString);
} catch (NumberFormatException ex) {
Log.error("Bad port '" + portString + "' specified, ssh support will not be enabled!");
return;
}
final String username = System.getProperty(COMMANDER_SSH_USERNAME);
if (username == null) {
Log.warn("No 'commander.ssh.username' specified, ssh support will not be enabled!");
return;
}
final String password = System.getProperty(COMMANDER_SSH_PASSWORD);
if (password == null) {
Log.warn("No 'commander.ssh.password' specified, ssh support will not be enabled!");
return;
}
this.sshd = SshServer.setUpDefaultServer();
sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
@Override
public boolean authenticate(@Nullable String u, @Nullable String p, ServerSession serverSession) {
if (p == null || u == null) {
return false;
}
return MessageDigest.isEqual(username.getBytes(StandardCharsets.UTF_8), u.getBytes(StandardCharsets.UTF_8))
&& MessageDigest.isEqual(password.getBytes(StandardCharsets.UTF_8), p.getBytes(StandardCharsets.UTF_8));
}
});
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
sshd.setPort(port);
sshd.setShellFactory(new CommanderSshCommandFactory());
try {
sshd.start();
Log.info("Ssh support started on port " + port);
} catch (IOException e) {
Log.error("Couldn't start the ssh daemon", e);
}
}