repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
melrief/HFSP
src/main/java/org/apache/hadoop/conf/FieldType.java
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class BooleanConfiguration extends ConfigurationDescription<Boolean> { // // public BooleanConfiguration(String key, String description, // Boolean defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Boolean get(Configuration conf) { // return conf.getBoolean(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class ClassConfiguration extends ConfigurationDescription<Class<?>> { // // public ClassConfiguration(String key, String description, // Class<?> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Class<?> get(Configuration conf) { // return conf.getClass(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class FloatConfiguration extends ConfigurationDescription<Float> { // // public FloatConfiguration(String key, String description, Float defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Float get(Configuration conf) { // return conf.getFloat(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntConfiguration extends ConfigurationDescription<Integer> { // // public IntConfiguration(String key, String description, Integer defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Integer get(Configuration conf) { // return conf.getInt(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntegerRangesConfiguration extends // ConfigurationDescription<IntegerRanges> { // // public IntegerRangesConfiguration(String key, String description, // IntegerRanges defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected IntegerRanges get(Configuration conf) { // return conf.getRange(this.getKey(), this.getDefaultValue().toString()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class LongConfiguration extends ConfigurationDescription<Long> { // // public LongConfiguration(String key, String description, Long defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Long get(Configuration conf) { // return conf.getLong(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringCollectionConfiguration extends // ConfigurationDescription<Collection<String>> { // // public StringCollectionConfiguration(String key, String description, // Collection<String> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Collection<String> get(Configuration conf) { // Collection<String> value = conf.getStringCollection(this.getKey()); // return value.isEmpty() ? this.getDefaultValue() : value; // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringConfiguration extends ConfigurationDescription<String> { // // public StringConfiguration(String key, String description, // String defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected String get(Configuration conf) { // return conf.get(this.getKey(), this.getDefaultValue()); // } // // }
import java.util.Collection; import java.util.HashMap; import org.apache.hadoop.conf.Configuration.IntegerRanges; import org.apache.hadoop.conf.ConfigurationDescription.BooleanConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.ClassConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.FloatConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntegerRangesConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.LongConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringCollectionConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringConfiguration;
package org.apache.hadoop.conf; public class FieldType<T> { static HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>> saferRegisteredClasses = new HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>>(); static { saferRegisteredClasses.put(new FieldType<Class>(Class.class), ClassConfiguration.class); // saferRegisteredClasses.put(new FieldType<Enum>(Enum.class), (Class<? // extends ConfigurationDescription<?>>) EnumConfiguration.class); saferRegisteredClasses.put(new FieldType<Collection>(Collection.class), StringCollectionConfiguration.class); } public final static FieldType<Boolean> Boolean = registerNewConfiguration( Boolean.class, BooleanConfiguration.class); // public final static FieldType<Class> Class = // registerNewConfiguration(Class.class, ClassConfiguration.class); // public final static FieldType<Enum> Enum = // registerNewConfiguration(Enum.class, EnumConfiguration.class); public final static FieldType<Integer> Integer = registerNewConfiguration( Integer.class, IntConfiguration.class); public final static FieldType<IntegerRanges> IntegerRanges = registerNewConfiguration( IntegerRanges.class, IntegerRangesConfiguration.class); public final static FieldType<Long> Long = registerNewConfiguration( Long.class, LongConfiguration.class); public final static FieldType<Float> Float = registerNewConfiguration(
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class BooleanConfiguration extends ConfigurationDescription<Boolean> { // // public BooleanConfiguration(String key, String description, // Boolean defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Boolean get(Configuration conf) { // return conf.getBoolean(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class ClassConfiguration extends ConfigurationDescription<Class<?>> { // // public ClassConfiguration(String key, String description, // Class<?> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Class<?> get(Configuration conf) { // return conf.getClass(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class FloatConfiguration extends ConfigurationDescription<Float> { // // public FloatConfiguration(String key, String description, Float defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Float get(Configuration conf) { // return conf.getFloat(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntConfiguration extends ConfigurationDescription<Integer> { // // public IntConfiguration(String key, String description, Integer defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Integer get(Configuration conf) { // return conf.getInt(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntegerRangesConfiguration extends // ConfigurationDescription<IntegerRanges> { // // public IntegerRangesConfiguration(String key, String description, // IntegerRanges defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected IntegerRanges get(Configuration conf) { // return conf.getRange(this.getKey(), this.getDefaultValue().toString()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class LongConfiguration extends ConfigurationDescription<Long> { // // public LongConfiguration(String key, String description, Long defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Long get(Configuration conf) { // return conf.getLong(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringCollectionConfiguration extends // ConfigurationDescription<Collection<String>> { // // public StringCollectionConfiguration(String key, String description, // Collection<String> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Collection<String> get(Configuration conf) { // Collection<String> value = conf.getStringCollection(this.getKey()); // return value.isEmpty() ? this.getDefaultValue() : value; // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringConfiguration extends ConfigurationDescription<String> { // // public StringConfiguration(String key, String description, // String defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected String get(Configuration conf) { // return conf.get(this.getKey(), this.getDefaultValue()); // } // // } // Path: src/main/java/org/apache/hadoop/conf/FieldType.java import java.util.Collection; import java.util.HashMap; import org.apache.hadoop.conf.Configuration.IntegerRanges; import org.apache.hadoop.conf.ConfigurationDescription.BooleanConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.ClassConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.FloatConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntegerRangesConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.LongConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringCollectionConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringConfiguration; package org.apache.hadoop.conf; public class FieldType<T> { static HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>> saferRegisteredClasses = new HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>>(); static { saferRegisteredClasses.put(new FieldType<Class>(Class.class), ClassConfiguration.class); // saferRegisteredClasses.put(new FieldType<Enum>(Enum.class), (Class<? // extends ConfigurationDescription<?>>) EnumConfiguration.class); saferRegisteredClasses.put(new FieldType<Collection>(Collection.class), StringCollectionConfiguration.class); } public final static FieldType<Boolean> Boolean = registerNewConfiguration( Boolean.class, BooleanConfiguration.class); // public final static FieldType<Class> Class = // registerNewConfiguration(Class.class, ClassConfiguration.class); // public final static FieldType<Enum> Enum = // registerNewConfiguration(Enum.class, EnumConfiguration.class); public final static FieldType<Integer> Integer = registerNewConfiguration( Integer.class, IntConfiguration.class); public final static FieldType<IntegerRanges> IntegerRanges = registerNewConfiguration( IntegerRanges.class, IntegerRangesConfiguration.class); public final static FieldType<Long> Long = registerNewConfiguration( Long.class, LongConfiguration.class); public final static FieldType<Float> Float = registerNewConfiguration(
Float.class, FloatConfiguration.class);
melrief/HFSP
src/main/java/org/apache/hadoop/conf/FieldType.java
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class BooleanConfiguration extends ConfigurationDescription<Boolean> { // // public BooleanConfiguration(String key, String description, // Boolean defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Boolean get(Configuration conf) { // return conf.getBoolean(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class ClassConfiguration extends ConfigurationDescription<Class<?>> { // // public ClassConfiguration(String key, String description, // Class<?> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Class<?> get(Configuration conf) { // return conf.getClass(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class FloatConfiguration extends ConfigurationDescription<Float> { // // public FloatConfiguration(String key, String description, Float defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Float get(Configuration conf) { // return conf.getFloat(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntConfiguration extends ConfigurationDescription<Integer> { // // public IntConfiguration(String key, String description, Integer defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Integer get(Configuration conf) { // return conf.getInt(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntegerRangesConfiguration extends // ConfigurationDescription<IntegerRanges> { // // public IntegerRangesConfiguration(String key, String description, // IntegerRanges defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected IntegerRanges get(Configuration conf) { // return conf.getRange(this.getKey(), this.getDefaultValue().toString()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class LongConfiguration extends ConfigurationDescription<Long> { // // public LongConfiguration(String key, String description, Long defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Long get(Configuration conf) { // return conf.getLong(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringCollectionConfiguration extends // ConfigurationDescription<Collection<String>> { // // public StringCollectionConfiguration(String key, String description, // Collection<String> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Collection<String> get(Configuration conf) { // Collection<String> value = conf.getStringCollection(this.getKey()); // return value.isEmpty() ? this.getDefaultValue() : value; // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringConfiguration extends ConfigurationDescription<String> { // // public StringConfiguration(String key, String description, // String defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected String get(Configuration conf) { // return conf.get(this.getKey(), this.getDefaultValue()); // } // // }
import java.util.Collection; import java.util.HashMap; import org.apache.hadoop.conf.Configuration.IntegerRanges; import org.apache.hadoop.conf.ConfigurationDescription.BooleanConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.ClassConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.FloatConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntegerRangesConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.LongConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringCollectionConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringConfiguration;
package org.apache.hadoop.conf; public class FieldType<T> { static HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>> saferRegisteredClasses = new HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>>(); static { saferRegisteredClasses.put(new FieldType<Class>(Class.class), ClassConfiguration.class); // saferRegisteredClasses.put(new FieldType<Enum>(Enum.class), (Class<? // extends ConfigurationDescription<?>>) EnumConfiguration.class); saferRegisteredClasses.put(new FieldType<Collection>(Collection.class), StringCollectionConfiguration.class); } public final static FieldType<Boolean> Boolean = registerNewConfiguration( Boolean.class, BooleanConfiguration.class); // public final static FieldType<Class> Class = // registerNewConfiguration(Class.class, ClassConfiguration.class); // public final static FieldType<Enum> Enum = // registerNewConfiguration(Enum.class, EnumConfiguration.class); public final static FieldType<Integer> Integer = registerNewConfiguration( Integer.class, IntConfiguration.class); public final static FieldType<IntegerRanges> IntegerRanges = registerNewConfiguration( IntegerRanges.class, IntegerRangesConfiguration.class); public final static FieldType<Long> Long = registerNewConfiguration( Long.class, LongConfiguration.class); public final static FieldType<Float> Float = registerNewConfiguration( Float.class, FloatConfiguration.class); public final static FieldType<String> String = registerNewConfiguration(
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class BooleanConfiguration extends ConfigurationDescription<Boolean> { // // public BooleanConfiguration(String key, String description, // Boolean defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Boolean get(Configuration conf) { // return conf.getBoolean(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class ClassConfiguration extends ConfigurationDescription<Class<?>> { // // public ClassConfiguration(String key, String description, // Class<?> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Class<?> get(Configuration conf) { // return conf.getClass(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class FloatConfiguration extends ConfigurationDescription<Float> { // // public FloatConfiguration(String key, String description, Float defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Float get(Configuration conf) { // return conf.getFloat(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntConfiguration extends ConfigurationDescription<Integer> { // // public IntConfiguration(String key, String description, Integer defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Integer get(Configuration conf) { // return conf.getInt(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class IntegerRangesConfiguration extends // ConfigurationDescription<IntegerRanges> { // // public IntegerRangesConfiguration(String key, String description, // IntegerRanges defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected IntegerRanges get(Configuration conf) { // return conf.getRange(this.getKey(), this.getDefaultValue().toString()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class LongConfiguration extends ConfigurationDescription<Long> { // // public LongConfiguration(String key, String description, Long defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Long get(Configuration conf) { // return conf.getLong(this.getKey(), this.getDefaultValue()); // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringCollectionConfiguration extends // ConfigurationDescription<Collection<String>> { // // public StringCollectionConfiguration(String key, String description, // Collection<String> defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected Collection<String> get(Configuration conf) { // Collection<String> value = conf.getStringCollection(this.getKey()); // return value.isEmpty() ? this.getDefaultValue() : value; // } // // } // // Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescription.java // static class StringConfiguration extends ConfigurationDescription<String> { // // public StringConfiguration(String key, String description, // String defaultValue) { // super(key, description, defaultValue); // } // // @Override // protected String get(Configuration conf) { // return conf.get(this.getKey(), this.getDefaultValue()); // } // // } // Path: src/main/java/org/apache/hadoop/conf/FieldType.java import java.util.Collection; import java.util.HashMap; import org.apache.hadoop.conf.Configuration.IntegerRanges; import org.apache.hadoop.conf.ConfigurationDescription.BooleanConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.ClassConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.FloatConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.IntegerRangesConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.LongConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringCollectionConfiguration; import org.apache.hadoop.conf.ConfigurationDescription.StringConfiguration; package org.apache.hadoop.conf; public class FieldType<T> { static HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>> saferRegisteredClasses = new HashMap<FieldType<?>, Class<? extends ConfigurationDescription<?>>>(); static { saferRegisteredClasses.put(new FieldType<Class>(Class.class), ClassConfiguration.class); // saferRegisteredClasses.put(new FieldType<Enum>(Enum.class), (Class<? // extends ConfigurationDescription<?>>) EnumConfiguration.class); saferRegisteredClasses.put(new FieldType<Collection>(Collection.class), StringCollectionConfiguration.class); } public final static FieldType<Boolean> Boolean = registerNewConfiguration( Boolean.class, BooleanConfiguration.class); // public final static FieldType<Class> Class = // registerNewConfiguration(Class.class, ClassConfiguration.class); // public final static FieldType<Enum> Enum = // registerNewConfiguration(Enum.class, EnumConfiguration.class); public final static FieldType<Integer> Integer = registerNewConfiguration( Integer.class, IntConfiguration.class); public final static FieldType<IntegerRanges> IntegerRanges = registerNewConfiguration( IntegerRanges.class, IntegerRangesConfiguration.class); public final static FieldType<Long> Long = registerNewConfiguration( Long.class, LongConfiguration.class); public final static FieldType<Float> Float = registerNewConfiguration( Float.class, FloatConfiguration.class); public final static FieldType<String> String = registerNewConfiguration(
String.class, StringConfiguration.class);
melrief/HFSP
src/main/java/org/apache/hadoop/mapred/CompositeTrainer.java
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescriptionToXMLConverter.java // public class ConfigurationDescriptionToXMLConverter { // // Document doc; // Element root; // HashSet<String> keys; // // private ConfigurationDescriptionToXMLConverter(Document doc) { // this.doc = doc; // this.root = this.doc.createElement("configuration"); // this.doc.appendChild(root); // this.keys = new HashSet<String>(); // } // // public static ConfigurationDescriptionToXMLConverter newInstance() // throws ParserConfigurationException { // Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() // .newDocument(); // return new ConfigurationDescriptionToXMLConverter(doc); // } // // /** // * Try to add many configuration descriptions // * // * @return a list of all the configuration not added // */ // public List<ConfigurationDescription> addConfigurationDescriptions( // ConfigurationDescription[] confs) { // List<ConfigurationDescription> notAdded = new ArrayList<ConfigurationDescription>(); // for (ConfigurationDescription conf : confs) { // if (!this.addConfigurationDescription(conf)) { // notAdded.add(conf); // } // } // return notAdded; // } // // public boolean addConfigurationDescription(ConfigurationDescription conf) { // String key = conf.getKey(); // // if (keys.contains(key)) { // return false; // } // // keys.add(key); // // Element prop = this.doc.createElement("property"); // // Element name = this.doc.createElement("name"); // name.appendChild(this.doc.createTextNode(key)); // prop.appendChild(name); // // Element value = this.doc.createElement("value"); // value.appendChild(this.doc // .createTextNode(conf.getDefaultValue().toString())); // prop.appendChild(value); // // Element type = this.doc.createElement("type"); // type.appendChild(this.doc.createTextNode(conf.getType())); // prop.appendChild(type); // // Element description = this.doc.createElement("description"); // description.appendChild(this.doc.createTextNode(conf.getDescription())); // prop.appendChild(description); // // this.root.appendChild(prop); // // return true; // } // // public void write(StreamResult result) { // try { // TransformerFactory transformerFactory = TransformerFactory.newInstance(); // Transformer transformer = transformerFactory.newTransformer(); // transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // transformer.setOutputProperty(OutputKeys.METHOD, "xml"); // transformer.setOutputProperty( // "{http://xml.apache.org/xslt}indent-amount", "2"); // DOMSource source = new DOMSource(this.doc); // transformer.transform(source, result); // } catch (TransformerException tfe) { // tfe.printStackTrace(); // } // } // // public void write(OutputStream stream) { // this.write(new StreamResult(stream)); // } // }
import java.lang.reflect.InvocationTargetException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.ConfigurationDescriptionToXMLConverter; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.mapreduce.TaskType;
@Override public void followJob(JobInProgress jip, TaskType type) { this.getTrainer(type).followJob(jip, type); } @Override public void unfollowJob(JobInProgress jip, TaskType type) { this.getTrainer(type).unfollowJob(jip, type); } @Override public boolean isReady(JobInProgress jip, TaskType type) { return this.getTrainer(type).isReady(jip, type); } @Override public JobDurationInfo getJobDurationInfo(JobInProgress jip, TaskType type) { Trainer<JobDurationInfo> trainer = this.getTrainer(type); LOG.debug("forwarding getJobDurationInfo to " + type + " trainer " + trainer.getClass()); return trainer.getJobDurationInfo(jip, type); } @Override public void update(TaskTrackerManager taskTrackerManager) { this.mapTrainer.update(taskTrackerManager); this.reduceTrainer.update(taskTrackerManager); } @Override
// Path: src/main/java/org/apache/hadoop/conf/ConfigurationDescriptionToXMLConverter.java // public class ConfigurationDescriptionToXMLConverter { // // Document doc; // Element root; // HashSet<String> keys; // // private ConfigurationDescriptionToXMLConverter(Document doc) { // this.doc = doc; // this.root = this.doc.createElement("configuration"); // this.doc.appendChild(root); // this.keys = new HashSet<String>(); // } // // public static ConfigurationDescriptionToXMLConverter newInstance() // throws ParserConfigurationException { // Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() // .newDocument(); // return new ConfigurationDescriptionToXMLConverter(doc); // } // // /** // * Try to add many configuration descriptions // * // * @return a list of all the configuration not added // */ // public List<ConfigurationDescription> addConfigurationDescriptions( // ConfigurationDescription[] confs) { // List<ConfigurationDescription> notAdded = new ArrayList<ConfigurationDescription>(); // for (ConfigurationDescription conf : confs) { // if (!this.addConfigurationDescription(conf)) { // notAdded.add(conf); // } // } // return notAdded; // } // // public boolean addConfigurationDescription(ConfigurationDescription conf) { // String key = conf.getKey(); // // if (keys.contains(key)) { // return false; // } // // keys.add(key); // // Element prop = this.doc.createElement("property"); // // Element name = this.doc.createElement("name"); // name.appendChild(this.doc.createTextNode(key)); // prop.appendChild(name); // // Element value = this.doc.createElement("value"); // value.appendChild(this.doc // .createTextNode(conf.getDefaultValue().toString())); // prop.appendChild(value); // // Element type = this.doc.createElement("type"); // type.appendChild(this.doc.createTextNode(conf.getType())); // prop.appendChild(type); // // Element description = this.doc.createElement("description"); // description.appendChild(this.doc.createTextNode(conf.getDescription())); // prop.appendChild(description); // // this.root.appendChild(prop); // // return true; // } // // public void write(StreamResult result) { // try { // TransformerFactory transformerFactory = TransformerFactory.newInstance(); // Transformer transformer = transformerFactory.newTransformer(); // transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // transformer.setOutputProperty(OutputKeys.METHOD, "xml"); // transformer.setOutputProperty( // "{http://xml.apache.org/xslt}indent-amount", "2"); // DOMSource source = new DOMSource(this.doc); // transformer.transform(source, result); // } catch (TransformerException tfe) { // tfe.printStackTrace(); // } // } // // public void write(OutputStream stream) { // this.write(new StreamResult(stream)); // } // } // Path: src/main/java/org/apache/hadoop/mapred/CompositeTrainer.java import java.lang.reflect.InvocationTargetException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.ConfigurationDescriptionToXMLConverter; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.mapreduce.TaskType; @Override public void followJob(JobInProgress jip, TaskType type) { this.getTrainer(type).followJob(jip, type); } @Override public void unfollowJob(JobInProgress jip, TaskType type) { this.getTrainer(type).unfollowJob(jip, type); } @Override public boolean isReady(JobInProgress jip, TaskType type) { return this.getTrainer(type).isReady(jip, type); } @Override public JobDurationInfo getJobDurationInfo(JobInProgress jip, TaskType type) { Trainer<JobDurationInfo> trainer = this.getTrainer(type); LOG.debug("forwarding getJobDurationInfo to " + type + " trainer " + trainer.getClass()); return trainer.getJobDurationInfo(jip, type); } @Override public void update(TaskTrackerManager taskTrackerManager) { this.mapTrainer.update(taskTrackerManager); this.reduceTrainer.update(taskTrackerManager); } @Override
public void accept(ConfigurationDescriptionToXMLConverter converter) {
yuv422/z80editor
org.efry.z80editor.ide/src/org/efry/z80editor/ide/Z80IdeSetup.java
// Path: org.efry.z80editor/src/org/efry/z80editor/Z80RuntimeModule.java // public class Z80RuntimeModule extends org.efry.z80editor.AbstractZ80RuntimeModule { // // @Override // public Class<? extends IContainer.Manager> bindIContainer$Manager() { // return StateBasedContainerManager.class; // // } // // @Override // public Class<? extends org.eclipse.xtext.naming.IQualifiedNameProvider> bindIQualifiedNameProvider() { // return Z80QualifiedNameProvider.class; // } // // @Override // public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() { // return org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.class; // } // } // // Path: org.efry.z80editor/src/org/efry/z80editor/Z80StandaloneSetup.java // public class Z80StandaloneSetup extends Z80StandaloneSetupGenerated{ // // public static void doSetup() { // new Z80StandaloneSetup().createInjectorAndDoEMFRegistration(); // } // }
import com.google.inject.Guice; import com.google.inject.Injector; import org.eclipse.xtext.util.Modules2; import org.efry.z80editor.Z80RuntimeModule; import org.efry.z80editor.Z80StandaloneSetup;
/* * generated by Xtext 2.20.0 */ package org.efry.z80editor.ide; /** * Initialization support for running Xtext languages as language servers. */ public class Z80IdeSetup extends Z80StandaloneSetup { @Override public Injector createInjector() {
// Path: org.efry.z80editor/src/org/efry/z80editor/Z80RuntimeModule.java // public class Z80RuntimeModule extends org.efry.z80editor.AbstractZ80RuntimeModule { // // @Override // public Class<? extends IContainer.Manager> bindIContainer$Manager() { // return StateBasedContainerManager.class; // // } // // @Override // public Class<? extends org.eclipse.xtext.naming.IQualifiedNameProvider> bindIQualifiedNameProvider() { // return Z80QualifiedNameProvider.class; // } // // @Override // public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() { // return org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.class; // } // } // // Path: org.efry.z80editor/src/org/efry/z80editor/Z80StandaloneSetup.java // public class Z80StandaloneSetup extends Z80StandaloneSetupGenerated{ // // public static void doSetup() { // new Z80StandaloneSetup().createInjectorAndDoEMFRegistration(); // } // } // Path: org.efry.z80editor.ide/src/org/efry/z80editor/ide/Z80IdeSetup.java import com.google.inject.Guice; import com.google.inject.Injector; import org.eclipse.xtext.util.Modules2; import org.efry.z80editor.Z80RuntimeModule; import org.efry.z80editor.Z80StandaloneSetup; /* * generated by Xtext 2.20.0 */ package org.efry.z80editor.ide; /** * Initialization support for running Xtext languages as language servers. */ public class Z80IdeSetup extends Z80StandaloneSetup { @Override public Injector createInjector() {
return Guice.createInjector(Modules2.mixin(new Z80RuntimeModule(), new Z80IdeModule()));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/entity/EntityZombieCow.java
// Path: src/main/java/com/zalthonethree/zombieinfection/api/IZombieInfectionMob.java // public interface IZombieInfectionMob { // public int getPlayerInfectionChance(); // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // }
import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.api.IZombieInfectionMob; import com.zalthonethree.zombieinfection.init.ModRegistry;
if (this.world.isDaytime() && !this.world.isRemote && !this.isChild()) { float f = this.getBrightness(); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canBlockSeeSky(new BlockPos(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ)))) { this.setFire(8); } } super.onLivingUpdate(); } @Override public void onKillEntity(EntityLivingBase entityLivingIn) { super.onKillEntity(entityLivingIn); if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD && !entityLivingIn.isChild()) && entityLivingIn instanceof EntityCow) { if (this.world.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean()) { return; } EntityZombieCow entityzombiecow = new EntityZombieCow(this.world); entityzombiecow.copyLocationAndAnglesFrom(entityLivingIn); this.world.removeEntity(entityLivingIn); entityzombiecow.onInitialSpawn(this.world.getDifficultyForLocation(this.getPosition()), (IEntityLivingData) null); this.world.spawnEntity(entityzombiecow); } } @Override public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!stack.isEmpty() && stack.getItem() == Items.BUCKET) { if ((stack.getCount() - 1) == 1) {
// Path: src/main/java/com/zalthonethree/zombieinfection/api/IZombieInfectionMob.java // public interface IZombieInfectionMob { // public int getPlayerInfectionChance(); // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/entity/EntityZombieCow.java import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.api.IZombieInfectionMob; import com.zalthonethree.zombieinfection.init.ModRegistry; if (this.world.isDaytime() && !this.world.isRemote && !this.isChild()) { float f = this.getBrightness(); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canBlockSeeSky(new BlockPos(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ)))) { this.setFire(8); } } super.onLivingUpdate(); } @Override public void onKillEntity(EntityLivingBase entityLivingIn) { super.onKillEntity(entityLivingIn); if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD && !entityLivingIn.isChild()) && entityLivingIn instanceof EntityCow) { if (this.world.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean()) { return; } EntityZombieCow entityzombiecow = new EntityZombieCow(this.world); entityzombiecow.copyLocationAndAnglesFrom(entityLivingIn); this.world.removeEntity(entityLivingIn); entityzombiecow.onInitialSpawn(this.world.getDifficultyForLocation(this.getPosition()), (IEntityLivingData) null); this.world.spawnEntity(entityzombiecow); } } @Override public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!stack.isEmpty() && stack.getItem() == Items.BUCKET) { if ((stack.getCount() - 1) == 1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ModRegistry.INFECTED_MILK));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/ModelHelper.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java // public class LogHelper { // public static void log(Level logLevel, Object... object) { // for (Object o : object) { // FMLLog.log(Reference.MOD_ID, logLevel, String.valueOf(o)); // } // } // // public static void all(Object... object) { // log(Level.ALL, object); // } // // public static void debug(Object... object) { // log(Level.DEBUG, object); // } // // public static void error(Object... object) { // log(Level.ERROR, object); // } // // public static void fatal(Object... object) { // log(Level.FATAL, object); // } // // public static void info(Object... object) { // log(Level.INFO, object); // } // // public static void off(Object... object) { // log(Level.OFF, object); // } // // public static void trace(Object... object) { // log(Level.TRACE, object); // } // // public static void warn(Object... object) { // log(Level.WARN, object); // } // }
import java.util.ArrayList; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.LogHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
package com.zalthonethree.zombieinfection.handler; @SideOnly(Side.CLIENT) public class ModelHelper { public static void registerItemInternal(Item item, String[] registryNames, int[] registryMetas) { if (registryNames.length != registryMetas.length) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java // public class LogHelper { // public static void log(Level logLevel, Object... object) { // for (Object o : object) { // FMLLog.log(Reference.MOD_ID, logLevel, String.valueOf(o)); // } // } // // public static void all(Object... object) { // log(Level.ALL, object); // } // // public static void debug(Object... object) { // log(Level.DEBUG, object); // } // // public static void error(Object... object) { // log(Level.ERROR, object); // } // // public static void fatal(Object... object) { // log(Level.FATAL, object); // } // // public static void info(Object... object) { // log(Level.INFO, object); // } // // public static void off(Object... object) { // log(Level.OFF, object); // } // // public static void trace(Object... object) { // log(Level.TRACE, object); // } // // public static void warn(Object... object) { // log(Level.WARN, object); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/ModelHelper.java import java.util.ArrayList; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.LogHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; package com.zalthonethree.zombieinfection.handler; @SideOnly(Side.CLIENT) public class ModelHelper { public static void registerItemInternal(Item item, String[] registryNames, int[] registryMetas) { if (registryNames.length != registryMetas.length) {
LogHelper.warn("Could not register models for " + item.getUnlocalizedName() + ": registryNames and registryMetas do not have matching lengths.");
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/ModelHelper.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java // public class LogHelper { // public static void log(Level logLevel, Object... object) { // for (Object o : object) { // FMLLog.log(Reference.MOD_ID, logLevel, String.valueOf(o)); // } // } // // public static void all(Object... object) { // log(Level.ALL, object); // } // // public static void debug(Object... object) { // log(Level.DEBUG, object); // } // // public static void error(Object... object) { // log(Level.ERROR, object); // } // // public static void fatal(Object... object) { // log(Level.FATAL, object); // } // // public static void info(Object... object) { // log(Level.INFO, object); // } // // public static void off(Object... object) { // log(Level.OFF, object); // } // // public static void trace(Object... object) { // log(Level.TRACE, object); // } // // public static void warn(Object... object) { // log(Level.WARN, object); // } // }
import java.util.ArrayList; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.LogHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
package com.zalthonethree.zombieinfection.handler; @SideOnly(Side.CLIENT) public class ModelHelper { public static void registerItemInternal(Item item, String[] registryNames, int[] registryMetas) { if (registryNames.length != registryMetas.length) { LogHelper.warn("Could not register models for " + item.getUnlocalizedName() + ": registryNames and registryMetas do not have matching lengths."); return; } ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); for (int i = 0; i < registryNames.length; i ++) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java // public class LogHelper { // public static void log(Level logLevel, Object... object) { // for (Object o : object) { // FMLLog.log(Reference.MOD_ID, logLevel, String.valueOf(o)); // } // } // // public static void all(Object... object) { // log(Level.ALL, object); // } // // public static void debug(Object... object) { // log(Level.DEBUG, object); // } // // public static void error(Object... object) { // log(Level.ERROR, object); // } // // public static void fatal(Object... object) { // log(Level.FATAL, object); // } // // public static void info(Object... object) { // log(Level.INFO, object); // } // // public static void off(Object... object) { // log(Level.OFF, object); // } // // public static void trace(Object... object) { // log(Level.TRACE, object); // } // // public static void warn(Object... object) { // log(Level.WARN, object); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/ModelHelper.java import java.util.ArrayList; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.LogHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; package com.zalthonethree.zombieinfection.handler; @SideOnly(Side.CLIENT) public class ModelHelper { public static void registerItemInternal(Item item, String[] registryNames, int[] registryMetas) { if (registryNames.length != registryMetas.length) { LogHelper.warn("Could not register models for " + item.getUnlocalizedName() + ": registryNames and registryMetas do not have matching lengths."); return; } ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); for (int i = 0; i < registryNames.length; i ++) {
mesher.register(item, registryMetas[i], new ModelResourceLocation(Reference.RESOURCE_PREFIX + registryNames[i], "inventory"));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/ConfigurationHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // }
import java.io.File; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference;
package com.zalthonethree.zombieinfection.handler; public class ConfigurationHandler { public static Configuration configuration; private static final String CATEGORY_CHANCES = "Chances"; private static final String CATEGORY_EFFECTS = "Effects"; private static boolean enableEasterEggs = true; private static int spreadDistance = 3; private static int animalInfectionChance = 25; private static int playerInfectionChance = 10; private static int villagerInfectionChance = 25; private static int poisonFoodInfectionChance = 10; private static int rawFoodInfectionChance = 5; private static int spiderEyeInfectionChance = 20; private static boolean enableBurning = true; private static boolean enableHunger = true; private static boolean enableMiningFatigue = true; private static boolean enableSlowness = true; private static boolean enableWeakness = true; private static boolean enableWither = true; public static void init(File configFile) { if (configuration == null) { configuration = new Configuration(configFile); loadConfiguration(); } } @SubscribeEvent public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/ConfigurationHandler.java import java.io.File; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference; package com.zalthonethree.zombieinfection.handler; public class ConfigurationHandler { public static Configuration configuration; private static final String CATEGORY_CHANCES = "Chances"; private static final String CATEGORY_EFFECTS = "Effects"; private static boolean enableEasterEggs = true; private static int spreadDistance = 3; private static int animalInfectionChance = 25; private static int playerInfectionChance = 10; private static int villagerInfectionChance = 25; private static int poisonFoodInfectionChance = 10; private static int rawFoodInfectionChance = 5; private static int spiderEyeInfectionChance = 20; private static boolean enableBurning = true; private static boolean enableHunger = true; private static boolean enableMiningFatigue = true; private static boolean enableSlowness = true; private static boolean enableWeakness = true; private static boolean enableWither = true; public static void init(File configFile) { if (configuration == null) { configuration = new Configuration(configFile); loadConfiguration(); } } @SubscribeEvent public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.getModID().equalsIgnoreCase(Reference.MOD_ID)) {
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemKnowledgeBook.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class IdTracking { // public static final int BOOK = 1; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/ZombieInfection.java // @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, updateJSON = "https://raw.githubusercontent.com/Zalth-One-Three/Zombie-Infection/versions/versions.json") public class ZombieInfection { // @Mod.Instance(Reference.MOD_ID) public static ZombieInfection instance; // @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static ServerProxy proxy; // // @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { // ConfigurationHandler.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new ConfigurationHandler()); // // PacketHandler.INSTANCE.ordinal(); // LogHelper.info("Pre-Init Complete"); // } // // @Mod.EventHandler public void init(FMLInitializationEvent event) { // proxy.init(); // proxy.registerRenderers(); // // NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); // EasterEggs.init(); // EntityInit.init(); // BuiltInAPI.init(); // LogHelper.info("Init Complete"); // } // // @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { // LogHelper.info("Post-Init Complete"); // } // // @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { // proxy.init(); // } // }
import java.util.List; import javax.annotation.Nullable; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.Reference.IdTracking; import com.zalthonethree.zombieinfection.ZombieInfection;
package com.zalthonethree.zombieinfection.item; public class ItemKnowledgeBook extends ItemBase { public ItemKnowledgeBook() { super(); this.setNames("knowledgebook"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class IdTracking { // public static final int BOOK = 1; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/ZombieInfection.java // @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, updateJSON = "https://raw.githubusercontent.com/Zalth-One-Three/Zombie-Infection/versions/versions.json") public class ZombieInfection { // @Mod.Instance(Reference.MOD_ID) public static ZombieInfection instance; // @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static ServerProxy proxy; // // @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { // ConfigurationHandler.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new ConfigurationHandler()); // // PacketHandler.INSTANCE.ordinal(); // LogHelper.info("Pre-Init Complete"); // } // // @Mod.EventHandler public void init(FMLInitializationEvent event) { // proxy.init(); // proxy.registerRenderers(); // // NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); // EasterEggs.init(); // EntityInit.init(); // BuiltInAPI.init(); // LogHelper.info("Init Complete"); // } // // @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { // LogHelper.info("Post-Init Complete"); // } // // @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { // proxy.init(); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemKnowledgeBook.java import java.util.List; import javax.annotation.Nullable; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.Reference.IdTracking; import com.zalthonethree.zombieinfection.ZombieInfection; package com.zalthonethree.zombieinfection.item; public class ItemKnowledgeBook extends ItemBase { public ItemKnowledgeBook() { super(); this.setNames("knowledgebook"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
playerIn.openGui(ZombieInfection.instance, IdTracking.BOOK, worldIn, 0, 0, 0);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemKnowledgeBook.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class IdTracking { // public static final int BOOK = 1; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/ZombieInfection.java // @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, updateJSON = "https://raw.githubusercontent.com/Zalth-One-Three/Zombie-Infection/versions/versions.json") public class ZombieInfection { // @Mod.Instance(Reference.MOD_ID) public static ZombieInfection instance; // @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static ServerProxy proxy; // // @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { // ConfigurationHandler.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new ConfigurationHandler()); // // PacketHandler.INSTANCE.ordinal(); // LogHelper.info("Pre-Init Complete"); // } // // @Mod.EventHandler public void init(FMLInitializationEvent event) { // proxy.init(); // proxy.registerRenderers(); // // NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); // EasterEggs.init(); // EntityInit.init(); // BuiltInAPI.init(); // LogHelper.info("Init Complete"); // } // // @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { // LogHelper.info("Post-Init Complete"); // } // // @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { // proxy.init(); // } // }
import java.util.List; import javax.annotation.Nullable; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.Reference.IdTracking; import com.zalthonethree.zombieinfection.ZombieInfection;
package com.zalthonethree.zombieinfection.item; public class ItemKnowledgeBook extends ItemBase { public ItemKnowledgeBook() { super(); this.setNames("knowledgebook"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class IdTracking { // public static final int BOOK = 1; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/ZombieInfection.java // @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, updateJSON = "https://raw.githubusercontent.com/Zalth-One-Three/Zombie-Infection/versions/versions.json") public class ZombieInfection { // @Mod.Instance(Reference.MOD_ID) public static ZombieInfection instance; // @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static ServerProxy proxy; // // @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { // ConfigurationHandler.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new ConfigurationHandler()); // // PacketHandler.INSTANCE.ordinal(); // LogHelper.info("Pre-Init Complete"); // } // // @Mod.EventHandler public void init(FMLInitializationEvent event) { // proxy.init(); // proxy.registerRenderers(); // // NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); // EasterEggs.init(); // EntityInit.init(); // BuiltInAPI.init(); // LogHelper.info("Init Complete"); // } // // @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { // LogHelper.info("Post-Init Complete"); // } // // @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { // proxy.init(); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemKnowledgeBook.java import java.util.List; import javax.annotation.Nullable; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.Reference.IdTracking; import com.zalthonethree.zombieinfection.ZombieInfection; package com.zalthonethree.zombieinfection.item; public class ItemKnowledgeBook extends ItemBase { public ItemKnowledgeBook() { super(); this.setNames("knowledgebook"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
playerIn.openGui(ZombieInfection.instance, IdTracking.BOOK, worldIn, 0, 0, 0);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // }
import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities;
package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec());
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities; package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec());
if (Utilities.isClientSide()) addClientHandler();
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // }
import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities;
package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities; package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler());
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // }
import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities;
package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); } @SideOnly(Side.SERVER) private void addServerHandler() { // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) {
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities; package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); } @SideOnly(Side.SERVER) private void addServerHandler() { // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) {
ZITimeInfectedMessage msg = new ZITimeInfectedMessage();
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // }
import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities;
package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); } @SideOnly(Side.SERVER) private void addServerHandler() { // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) { ZITimeInfectedMessage msg = new ZITimeInfectedMessage(); msg.index = 0; msg.secondsInfected = Seconds; return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) {
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java // public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { // @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception { // TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java // public class Utilities { // @SideOnly(Side.CLIENT) public static String translate(String string) { // return I18n.format(string); // } // // @SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) { // return I18n.format(string, formatargs); // } // // public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; } // public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java import io.netty.channel.ChannelFutureListener; import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler; import com.zalthonethree.zombieinfection.utility.Utilities; package com.zalthonethree.zombieinfection.handler; public enum PacketHandler { INSTANCE; private EnumMap<Side, FMLEmbeddedChannel> channels; private PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); if (Utilities.isClientSide()) addClientHandler(); if (Utilities.isServerSide()) addServerHandler(); } @SideOnly(Side.CLIENT) private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); } @SideOnly(Side.SERVER) private void addServerHandler() { // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) { ZITimeInfectedMessage msg = new ZITimeInfectedMessage(); msg.index = 0; msg.secondsInfected = Seconds; return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) {
ZIFoodChangeMessage msg = new ZIFoodChangeMessage();
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/BookButton.java // public class BookButton extends GuiButton { // private ItemStack buttonImage; // // public BookButton(int buttonId, ItemStack image, int x, int y, String buttonText) { // super(buttonId, x, y, buttonText); // this.buttonImage = image; // } // // public BookButton(int buttonId, ItemStack image, int x, int y, int widthIn, int heightIn, String buttonText) { // super(buttonId, x, y, widthIn, heightIn, buttonText); // this.buttonImage = image; // } // // @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { // if (this.visible) { // FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; // this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; // Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(this.buttonImage, this.x, this.y); // this.mouseDragged(mc, mouseX, mouseY); // this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, 0); // } // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java // public class KnowledgeBook extends GuiScreen { // public static KnowledgeBook instance = new KnowledgeBook(); // private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); // private GuiScreen currentPage; // public static int[] topLeft = new int[] {0, 0}; // // @Override public final void initGui() { // super.initGui(); // currentPage = MainPage.instance; // instance = this; // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.color(1F, 1F, 1F, 1F); // mc.renderEngine.bindTexture(background); // int xSize = 96; // int ySize = 128; // int xPos = width / 2 - xSize / 2; // int yPos = height / 2 - ySize / 2; // topLeft = new int[] {xPos - (xSize / 2), yPos}; // drawScaledCustomSizeModalRect(xPos - (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // drawScaledCustomSizeModalRect(xPos + (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // currentPage.drawScreen(mouseX, mouseY, partialTicks); // super.drawScreen(mouseX, mouseY, partialTicks); // } // // @Override protected void actionPerformed(GuiButton button) { // // } // // @Override public boolean doesGuiPauseGame() { return false; } // }
import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import com.zalthonethree.zombieinfection.client.gui.BookButton; import com.zalthonethree.zombieinfection.client.gui.KnowledgeBook;
package com.zalthonethree.zombieinfection.client.gui.bookpages; public class MainPage extends GuiScreen { public static final MainPage instance = new MainPage(); public MainPage() { super(); } @Override public void initGui() {
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/BookButton.java // public class BookButton extends GuiButton { // private ItemStack buttonImage; // // public BookButton(int buttonId, ItemStack image, int x, int y, String buttonText) { // super(buttonId, x, y, buttonText); // this.buttonImage = image; // } // // public BookButton(int buttonId, ItemStack image, int x, int y, int widthIn, int heightIn, String buttonText) { // super(buttonId, x, y, widthIn, heightIn, buttonText); // this.buttonImage = image; // } // // @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { // if (this.visible) { // FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; // this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; // Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(this.buttonImage, this.x, this.y); // this.mouseDragged(mc, mouseX, mouseY); // this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, 0); // } // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java // public class KnowledgeBook extends GuiScreen { // public static KnowledgeBook instance = new KnowledgeBook(); // private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); // private GuiScreen currentPage; // public static int[] topLeft = new int[] {0, 0}; // // @Override public final void initGui() { // super.initGui(); // currentPage = MainPage.instance; // instance = this; // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.color(1F, 1F, 1F, 1F); // mc.renderEngine.bindTexture(background); // int xSize = 96; // int ySize = 128; // int xPos = width / 2 - xSize / 2; // int yPos = height / 2 - ySize / 2; // topLeft = new int[] {xPos - (xSize / 2), yPos}; // drawScaledCustomSizeModalRect(xPos - (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // drawScaledCustomSizeModalRect(xPos + (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // currentPage.drawScreen(mouseX, mouseY, partialTicks); // super.drawScreen(mouseX, mouseY, partialTicks); // } // // @Override protected void actionPerformed(GuiButton button) { // // } // // @Override public boolean doesGuiPauseGame() { return false; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import com.zalthonethree.zombieinfection.client.gui.BookButton; import com.zalthonethree.zombieinfection.client.gui.KnowledgeBook; package com.zalthonethree.zombieinfection.client.gui.bookpages; public class MainPage extends GuiScreen { public static final MainPage instance = new MainPage(); public MainPage() { super(); } @Override public void initGui() {
this.buttonList.add(new BookButton(100, new ItemStack(Items.ROTTEN_FLESH), 100, 200, 100, 50, "The Infection"));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/BookButton.java // public class BookButton extends GuiButton { // private ItemStack buttonImage; // // public BookButton(int buttonId, ItemStack image, int x, int y, String buttonText) { // super(buttonId, x, y, buttonText); // this.buttonImage = image; // } // // public BookButton(int buttonId, ItemStack image, int x, int y, int widthIn, int heightIn, String buttonText) { // super(buttonId, x, y, widthIn, heightIn, buttonText); // this.buttonImage = image; // } // // @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { // if (this.visible) { // FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; // this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; // Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(this.buttonImage, this.x, this.y); // this.mouseDragged(mc, mouseX, mouseY); // this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, 0); // } // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java // public class KnowledgeBook extends GuiScreen { // public static KnowledgeBook instance = new KnowledgeBook(); // private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); // private GuiScreen currentPage; // public static int[] topLeft = new int[] {0, 0}; // // @Override public final void initGui() { // super.initGui(); // currentPage = MainPage.instance; // instance = this; // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.color(1F, 1F, 1F, 1F); // mc.renderEngine.bindTexture(background); // int xSize = 96; // int ySize = 128; // int xPos = width / 2 - xSize / 2; // int yPos = height / 2 - ySize / 2; // topLeft = new int[] {xPos - (xSize / 2), yPos}; // drawScaledCustomSizeModalRect(xPos - (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // drawScaledCustomSizeModalRect(xPos + (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // currentPage.drawScreen(mouseX, mouseY, partialTicks); // super.drawScreen(mouseX, mouseY, partialTicks); // } // // @Override protected void actionPerformed(GuiButton button) { // // } // // @Override public boolean doesGuiPauseGame() { return false; } // }
import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import com.zalthonethree.zombieinfection.client.gui.BookButton; import com.zalthonethree.zombieinfection.client.gui.KnowledgeBook;
package com.zalthonethree.zombieinfection.client.gui.bookpages; public class MainPage extends GuiScreen { public static final MainPage instance = new MainPage(); public MainPage() { super(); } @Override public void initGui() { this.buttonList.add(new BookButton(100, new ItemStack(Items.ROTTEN_FLESH), 100, 200, 100, 50, "The Infection")); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GlStateManager.scale(0.5F, 0.5F, 0.5F);
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/BookButton.java // public class BookButton extends GuiButton { // private ItemStack buttonImage; // // public BookButton(int buttonId, ItemStack image, int x, int y, String buttonText) { // super(buttonId, x, y, buttonText); // this.buttonImage = image; // } // // public BookButton(int buttonId, ItemStack image, int x, int y, int widthIn, int heightIn, String buttonText) { // super(buttonId, x, y, widthIn, heightIn, buttonText); // this.buttonImage = image; // } // // @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { // if (this.visible) { // FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; // this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; // Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(this.buttonImage, this.x, this.y); // this.mouseDragged(mc, mouseX, mouseY); // this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, 0); // } // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java // public class KnowledgeBook extends GuiScreen { // public static KnowledgeBook instance = new KnowledgeBook(); // private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); // private GuiScreen currentPage; // public static int[] topLeft = new int[] {0, 0}; // // @Override public final void initGui() { // super.initGui(); // currentPage = MainPage.instance; // instance = this; // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.color(1F, 1F, 1F, 1F); // mc.renderEngine.bindTexture(background); // int xSize = 96; // int ySize = 128; // int xPos = width / 2 - xSize / 2; // int yPos = height / 2 - ySize / 2; // topLeft = new int[] {xPos - (xSize / 2), yPos}; // drawScaledCustomSizeModalRect(xPos - (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // drawScaledCustomSizeModalRect(xPos + (xSize / 2), yPos, 0, 0, 256, 256, xSize, ySize, 256, 256); // currentPage.drawScreen(mouseX, mouseY, partialTicks); // super.drawScreen(mouseX, mouseY, partialTicks); // } // // @Override protected void actionPerformed(GuiButton button) { // // } // // @Override public boolean doesGuiPauseGame() { return false; } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import com.zalthonethree.zombieinfection.client.gui.BookButton; import com.zalthonethree.zombieinfection.client.gui.KnowledgeBook; package com.zalthonethree.zombieinfection.client.gui.bookpages; public class MainPage extends GuiScreen { public static final MainPage instance = new MainPage(); public MainPage() { super(); } @Override public void initGui() { this.buttonList.add(new BookButton(100, new ItemStack(Items.ROTTEN_FLESH), 100, 200, 100, 50, "The Infection")); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GlStateManager.scale(0.5F, 0.5F, 0.5F);
int x = (KnowledgeBook.topLeft[0] * 2) + 8;
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/entity/EntityZombieChicken.java
// Path: src/main/java/com/zalthonethree/zombieinfection/api/IZombieInfectionMob.java // public interface IZombieInfectionMob { // public int getPlayerInfectionChance(); // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // }
import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.api.IZombieInfectionMob; import com.zalthonethree.zombieinfection.init.ModRegistry;
} super.onLivingUpdate(); this.lastWingRotation = this.wingRotation; this.lastDestPos = this.destPos; this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D); if (this.destPos < 0.0F) { this.destPos = 0.0F; } if (this.destPos > 1.0F) { this.destPos = 1.0F; } if (!this.onGround && this.wingRotDelta < 1.0F) { this.wingRotDelta = 1.0F; } this.wingRotDelta = (float) ((double) this.wingRotDelta * 0.9D); if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } this.wingRotation += this.wingRotDelta * 2.0F; if (!this.world.isRemote && !this.isChild() && this.timeUntilNextEgg-- <= 0) { this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
// Path: src/main/java/com/zalthonethree/zombieinfection/api/IZombieInfectionMob.java // public interface IZombieInfectionMob { // public int getPlayerInfectionChance(); // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/entity/EntityZombieChicken.java import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import com.zalthonethree.zombieinfection.api.IZombieInfectionMob; import com.zalthonethree.zombieinfection.init.ModRegistry; } super.onLivingUpdate(); this.lastWingRotation = this.wingRotation; this.lastDestPos = this.destPos; this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D); if (this.destPos < 0.0F) { this.destPos = 0.0F; } if (this.destPos > 1.0F) { this.destPos = 1.0F; } if (!this.onGround && this.wingRotDelta < 1.0F) { this.wingRotDelta = 1.0F; } this.wingRotDelta = (float) ((double) this.wingRotDelta * 0.9D); if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } this.wingRotation += this.wingRotDelta * 2.0F; if (!this.world.isRemote && !this.isChild() && this.timeUntilNextEgg-- <= 0) { this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(ModRegistry.INFECTED_EGG, 1);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemBase.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java // public class CreativeTab { // public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { // @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { // return new ItemStack(ModRegistry.CURE); // } // // @Override @SideOnly(Side.CLIENT) public String getTranslatedTabLabel() { // return I18n.format("itemGroup.zombieinfection"); // } // }; // }
import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.client.CreativeTab; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation;
package com.zalthonethree.zombieinfection.item; public class ItemBase extends Item { public ItemBase() { super(); this.setMaxStackSize(64);
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java // public class CreativeTab { // public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { // @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { // return new ItemStack(ModRegistry.CURE); // } // // @Override @SideOnly(Side.CLIENT) public String getTranslatedTabLabel() { // return I18n.format("itemGroup.zombieinfection"); // } // }; // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemBase.java import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.client.CreativeTab; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; package com.zalthonethree.zombieinfection.item; public class ItemBase extends Item { public ItemBase() { super(); this.setMaxStackSize(64);
this.setCreativeTab(CreativeTab.zombieInfection);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemBase.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java // public class CreativeTab { // public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { // @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { // return new ItemStack(ModRegistry.CURE); // } // // @Override @SideOnly(Side.CLIENT) public String getTranslatedTabLabel() { // return I18n.format("itemGroup.zombieinfection"); // } // }; // }
import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.client.CreativeTab; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation;
package com.zalthonethree.zombieinfection.item; public class ItemBase extends Item { public ItemBase() { super(); this.setMaxStackSize(64); this.setCreativeTab(CreativeTab.zombieInfection); this.setNoRepair(); } public ItemBase setNames(String name) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java // public class CreativeTab { // public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { // @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { // return new ItemStack(ModRegistry.CURE); // } // // @Override @SideOnly(Side.CLIENT) public String getTranslatedTabLabel() { // return I18n.format("itemGroup.zombieinfection"); // } // }; // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemBase.java import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.client.CreativeTab; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; package com.zalthonethree.zombieinfection.item; public class ItemBase extends Item { public ItemBase() { super(); this.setMaxStackSize(64); this.setCreativeTab(CreativeTab.zombieInfection); this.setNoRepair(); } public ItemBase setNames(String name) {
this.setRegistryName(new ResourceLocation(Reference.MOD_ID, name));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/potion/PotionHelper.java
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // }
import java.util.ArrayList; import com.zalthonethree.zombieinfection.init.ModRegistry; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect;
package com.zalthonethree.zombieinfection.potion; public class PotionHelper { private static PotionEffect createNewPotionEffect(Potion potion, int level) { PotionEffect effect = new PotionEffect(potion, (10 * 20) + 10, level, true, true); effect.setCurativeItems(new ArrayList<ItemStack>()); return effect; }
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/potion/PotionHelper.java import java.util.ArrayList; import com.zalthonethree.zombieinfection.init.ModRegistry; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; package com.zalthonethree.zombieinfection.potion; public class PotionHelper { private static PotionEffect createNewPotionEffect(Potion potion, int level) { PotionEffect effect = new PotionEffect(potion, (10 * 20) + 10, level, true, true); effect.setCurativeItems(new ArrayList<ItemStack>()); return effect; }
public static PotionEffect createInfection(int level) { return createNewPotionEffect(ModRegistry.POTION_INFECTION, level); }
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // }
import net.minecraftforge.fml.common.FMLLog; import org.apache.logging.log4j.Level; import com.zalthonethree.zombieinfection.Reference;
package com.zalthonethree.zombieinfection.utility; public class LogHelper { public static void log(Level logLevel, Object... object) { for (Object o : object) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/utility/LogHelper.java import net.minecraftforge.fml.common.FMLLog; import org.apache.logging.log4j.Level; import com.zalthonethree.zombieinfection.Reference; package com.zalthonethree.zombieinfection.utility; public class LogHelper { public static void log(Level logLevel, Object... object) { for (Object o : object) {
FMLLog.log(Reference.MOD_ID, logLevel, String.valueOf(o));
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTracking.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java // public enum PacketHandler { // INSTANCE; // // private EnumMap<Side, FMLEmbeddedChannel> channels; // // private PacketHandler() { // this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); // if (Utilities.isClientSide()) addClientHandler(); // if (Utilities.isServerSide()) addServerHandler(); // } // // @SideOnly(Side.CLIENT) private void addClientHandler() { // FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); // // String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); // } // // @SideOnly(Side.SERVER) private void addServerHandler() { // // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // // // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. // } // // @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) { // ZITimeInfectedMessage msg = new ZITimeInfectedMessage(); // msg.index = 0; // msg.secondsInfected = Seconds; // // return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); // } // // @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) { // ZIFoodChangeMessage msg = new ZIFoodChangeMessage(); // msg.index = 1; // msg.foodLevelChange = food; // msg.saturationChange = saturation; // // return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); // } // // public void sendTo(Packet<?> message, EntityPlayerMP player) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToAll(Packet<?> message) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToAllAround(Packet<?> message, NetworkRegistry.TargetPoint point) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToServer(Packet<?> message) { // this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); // this.channels.get(Side.CLIENT).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); // } // }
import com.zalthonethree.zombieinfection.handler.PacketHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP;
package com.zalthonethree.zombieinfection.utility; public class TimeInfectedTracking { public static void update(EntityPlayer player) { if (!player.getEntityData().hasKey("TimeInfectedTracking")) { player.getEntityData().setInteger("TimeInfectedTracking", 0); } else { player.getEntityData().setInteger("TimeInfectedTracking", player.getEntityData().getInteger("TimeInfectedTracking") + 1); }
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java // public enum PacketHandler { // INSTANCE; // // private EnumMap<Side, FMLEmbeddedChannel> channels; // // private PacketHandler() { // this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec()); // if (Utilities.isClientSide()) addClientHandler(); // if (Utilities.isServerSide()) addServerHandler(); // } // // @SideOnly(Side.CLIENT) private void addClientHandler() { // FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); // // String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler()); // } // // @SideOnly(Side.SERVER) private void addServerHandler() { // // FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); // // // String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class); // // Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed. // } // // @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) { // ZITimeInfectedMessage msg = new ZITimeInfectedMessage(); // msg.index = 0; // msg.secondsInfected = Seconds; // // return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); // } // // @SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) { // ZIFoodChangeMessage msg = new ZIFoodChangeMessage(); // msg.index = 1; // msg.foodLevelChange = food; // msg.saturationChange = saturation; // // return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); // } // // public void sendTo(Packet<?> message, EntityPlayerMP player) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToAll(Packet<?> message) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToAllAround(Packet<?> message, NetworkRegistry.TargetPoint point) { // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); // this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); // this.channels.get(Side.SERVER).writeAndFlush(message); // } // // public void sendToServer(Packet<?> message) { // this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); // this.channels.get(Side.CLIENT).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTracking.java import com.zalthonethree.zombieinfection.handler.PacketHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; package com.zalthonethree.zombieinfection.utility; public class TimeInfectedTracking { public static void update(EntityPlayer player) { if (!player.getEntityData().hasKey("TimeInfectedTracking")) { player.getEntityData().setInteger("TimeInfectedTracking", 0); } else { player.getEntityData().setInteger("TimeInfectedTracking", player.getEntityData().getInteger("TimeInfectedTracking") + 1); }
PacketHandler.INSTANCE.sendTo(PacketHandler.getTimeInfectedUpdatePacket(player.getEntityData().getInteger("TimeInfectedTracking")), (EntityPlayerMP) player);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/gui/GuiEyeInfection.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // }
import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient;
package com.zalthonethree.zombieinfection.client.gui; public class GuiEyeInfection extends Gui { private Minecraft minecraftInstance;
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/GuiEyeInfection.java import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient; package com.zalthonethree.zombieinfection.client.gui; public class GuiEyeInfection extends Gui { private Minecraft minecraftInstance;
private ResourceLocation uncracked = new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png");
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/gui/GuiEyeInfection.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // }
import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient;
package com.zalthonethree.zombieinfection.client.gui; public class GuiEyeInfection extends Gui { private Minecraft minecraftInstance; private ResourceLocation uncracked = new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png"); private ResourceLocation cracked = new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfectioncracked.png"); public GuiEyeInfection(Minecraft MC) { super(); minecraftInstance = MC; } @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Pre event) {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/GuiEyeInfection.java import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient; package com.zalthonethree.zombieinfection.client.gui; public class GuiEyeInfection extends Gui { private Minecraft minecraftInstance; private ResourceLocation uncracked = new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfection.png"); private ResourceLocation cracked = new ResourceLocation(Reference.MOD_ID.toLowerCase(), "textures/gui/eyeinfectioncracked.png"); public GuiEyeInfection(Minecraft MC) { super(); minecraftInstance = MC; } @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent.Pre event) {
int timeInfected = TimeInfectedTrackingClient.getSecondsInfected();
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // }
import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.init.ModRegistry; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
package com.zalthonethree.zombieinfection.client; public class CreativeTab { public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() {
// Path: src/main/java/com/zalthonethree/zombieinfection/Reference.java // public class Reference { // public static final String MOD_ID = "zombieinfection"; // public static final String MOD_NAME = "Zombie Infection"; // public static final String MINECRAFT_VERSION = "1.12"; // public static final String VERSION = "3.0.0"; // public static final String CLIENT_PROXY = "com.zalthonethree.zombieinfection.proxy.ClientProxy"; // public static final String SERVER_PROXY = "com.zalthonethree.zombieinfection.proxy.ServerProxy"; // public static final String RESOURCE_PREFIX = MOD_ID + ":"; // // public class IdTracking { // public static final int BOOK = 1; // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/CreativeTab.java import com.zalthonethree.zombieinfection.Reference; import com.zalthonethree.zombieinfection.init.ModRegistry; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; package com.zalthonethree.zombieinfection.client; public class CreativeTab { public static final CreativeTabs zombieInfection = new CreativeTabs(Reference.MOD_ID) { @Override @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() {
return new ItemStack(ModRegistry.CURE);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java // public class MainPage extends GuiScreen { // public static final MainPage instance = new MainPage(); // // public MainPage() { // super(); // } // // @Override public void initGui() { // this.buttonList.add(new BookButton(100, new ItemStack(Items.ROTTEN_FLESH), 100, 200, 100, 50, "The Infection")); // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.scale(0.5F, 0.5F, 0.5F); // int x = (KnowledgeBook.topLeft[0] * 2) + 8; // int y = (KnowledgeBook.topLeft[1] * 2) + 8; // Minecraft.getMinecraft().fontRenderer.drawString("HALLO THIS IS DOGE :D :D :D", x, y, (new Color(0, 0, 0)).getRGB()); // GlStateManager.scale(2F, 2F, 2F); // super.drawScreen(mouseX, mouseY, partialTicks); // } // }
import com.zalthonethree.zombieinfection.client.gui.bookpages.MainPage; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation;
package com.zalthonethree.zombieinfection.client.gui; public class KnowledgeBook extends GuiScreen { public static KnowledgeBook instance = new KnowledgeBook(); private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); private GuiScreen currentPage; public static int[] topLeft = new int[] {0, 0}; @Override public final void initGui() { super.initGui();
// Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/bookpages/MainPage.java // public class MainPage extends GuiScreen { // public static final MainPage instance = new MainPage(); // // public MainPage() { // super(); // } // // @Override public void initGui() { // this.buttonList.add(new BookButton(100, new ItemStack(Items.ROTTEN_FLESH), 100, 200, 100, 50, "The Infection")); // } // // @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { // GlStateManager.scale(0.5F, 0.5F, 0.5F); // int x = (KnowledgeBook.topLeft[0] * 2) + 8; // int y = (KnowledgeBook.topLeft[1] * 2) + 8; // Minecraft.getMinecraft().fontRenderer.drawString("HALLO THIS IS DOGE :D :D :D", x, y, (new Color(0, 0, 0)).getRGB()); // GlStateManager.scale(2F, 2F, 2F); // super.drawScreen(mouseX, mouseY, partialTicks); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/client/gui/KnowledgeBook.java import com.zalthonethree.zombieinfection.client.gui.bookpages.MainPage; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; package com.zalthonethree.zombieinfection.client.gui; public class KnowledgeBook extends GuiScreen { public static KnowledgeBook instance = new KnowledgeBook(); private static final ResourceLocation background = new ResourceLocation("zombieinfection", "textures/gui/book.png"); private GuiScreen currentPage; public static int[] topLeft = new int[] {0, 0}; @Override public final void initGui() { super.initGui();
currentPage = MainPage.instance;
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java
// Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // }
import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler;
package com.zalthonethree.zombieinfection.handler.timeinfected; public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception {
// Path: src/main/java/com/zalthonethree/zombieinfection/utility/TimeInfectedTrackingClient.java // public class TimeInfectedTrackingClient { // @SideOnly(Side.CLIENT) public static void setSecondsInfected(int Seconds) { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // player.getEntityData().setInteger("TimeInfectedTracking", Seconds); // } // // @SideOnly(Side.CLIENT) public static int getSecondsInfected() { // EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().player; // NBTTagCompound nbt = player.getEntityData(); // return nbt.hasKey("TimeInfectedTracking") ? nbt.getInteger("TimeInfectedTracking") : 0; // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java import com.zalthonethree.zombieinfection.utility.TimeInfectedTrackingClient; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; package com.zalthonethree.zombieinfection.handler.timeinfected; public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> { @Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception {
TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/ZombieInfectionCodec.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // }
import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec;
package com.zalthonethree.zombieinfection.handler; public class ZombieInfectionCodec extends FMLIndexedMessageToMessageCodec<ZIMessage> { public ZombieInfectionCodec() {
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/ZombieInfectionCodec.java import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec; package com.zalthonethree.zombieinfection.handler; public class ZombieInfectionCodec extends FMLIndexedMessageToMessageCodec<ZIMessage> { public ZombieInfectionCodec() {
addDiscriminator(0, ZITimeInfectedMessage.class);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/handler/ZombieInfectionCodec.java
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // }
import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec;
package com.zalthonethree.zombieinfection.handler; public class ZombieInfectionCodec extends FMLIndexedMessageToMessageCodec<ZIMessage> { public ZombieInfectionCodec() { addDiscriminator(0, ZITimeInfectedMessage.class);
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java // public class ZIFoodChangeMessage extends ZIMessage { // public int foodLevelChange; // public float saturationChange; // } // // Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java // public class ZITimeInfectedMessage extends ZIMessage { // public int secondsInfected; // } // Path: src/main/java/com/zalthonethree/zombieinfection/handler/ZombieInfectionCodec.java import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage; import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec; package com.zalthonethree.zombieinfection.handler; public class ZombieInfectionCodec extends FMLIndexedMessageToMessageCodec<ZIMessage> { public ZombieInfectionCodec() { addDiscriminator(0, ZITimeInfectedMessage.class);
addDiscriminator(1, ZIFoodChangeMessage.class);
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemNeedle.java
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/CustomDamageSource.java // public class CustomDamageSource extends DamageSource { // String message; // // public CustomDamageSource(String type, String deathmessage) { // super(type); // this.setDamageIsAbsolute(); // this.message = deathmessage; // } // // @Override public ITextComponent getDeathMessage(EntityLivingBase entity) { // return new TextComponentTranslation(this.message, entity.getDisplayName()); // } // }
import com.zalthonethree.zombieinfection.init.ModRegistry; import com.zalthonethree.zombieinfection.utility.CustomDamageSource; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.world.World;
package com.zalthonethree.zombieinfection.item; public class ItemNeedle extends ItemBase { /* META REFERENCE * 0 - Empty Needle * 1 - Needle, Regular Blood * 2 - Needle, Infected Blood * 3 - Needle, Cured Blood */ public static final String[] names = new String[] {"", "normal", "infected", "cured", "unknown"}; public ItemNeedle() { super(); this.setNames("needle"); this.setMaxStackSize(1); this.setHasSubtypes(true); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { ItemStack itemStackIn = playerIn.getHeldItem(hand); if (itemStackIn.getItemDamage() > 0) return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/CustomDamageSource.java // public class CustomDamageSource extends DamageSource { // String message; // // public CustomDamageSource(String type, String deathmessage) { // super(type); // this.setDamageIsAbsolute(); // this.message = deathmessage; // } // // @Override public ITextComponent getDeathMessage(EntityLivingBase entity) { // return new TextComponentTranslation(this.message, entity.getDisplayName()); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemNeedle.java import com.zalthonethree.zombieinfection.init.ModRegistry; import com.zalthonethree.zombieinfection.utility.CustomDamageSource; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.world.World; package com.zalthonethree.zombieinfection.item; public class ItemNeedle extends ItemBase { /* META REFERENCE * 0 - Empty Needle * 1 - Needle, Regular Blood * 2 - Needle, Infected Blood * 3 - Needle, Cured Blood */ public static final String[] names = new String[] {"", "normal", "infected", "cured", "unknown"}; public ItemNeedle() { super(); this.setNames("needle"); this.setMaxStackSize(1); this.setHasSubtypes(true); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { ItemStack itemStackIn = playerIn.getHeldItem(hand); if (itemStackIn.getItemDamage() > 0) return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
if (playerIn.isPotionActive(ModRegistry.POTION_CURE)) {
Zalth-One-Three/Zombie-Infection
src/main/java/com/zalthonethree/zombieinfection/item/ItemNeedle.java
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/CustomDamageSource.java // public class CustomDamageSource extends DamageSource { // String message; // // public CustomDamageSource(String type, String deathmessage) { // super(type); // this.setDamageIsAbsolute(); // this.message = deathmessage; // } // // @Override public ITextComponent getDeathMessage(EntityLivingBase entity) { // return new TextComponentTranslation(this.message, entity.getDisplayName()); // } // }
import com.zalthonethree.zombieinfection.init.ModRegistry; import com.zalthonethree.zombieinfection.utility.CustomDamageSource; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.world.World;
package com.zalthonethree.zombieinfection.item; public class ItemNeedle extends ItemBase { /* META REFERENCE * 0 - Empty Needle * 1 - Needle, Regular Blood * 2 - Needle, Infected Blood * 3 - Needle, Cured Blood */ public static final String[] names = new String[] {"", "normal", "infected", "cured", "unknown"}; public ItemNeedle() { super(); this.setNames("needle"); this.setMaxStackSize(1); this.setHasSubtypes(true); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { ItemStack itemStackIn = playerIn.getHeldItem(hand); if (itemStackIn.getItemDamage() > 0) return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn); if (playerIn.isPotionActive(ModRegistry.POTION_CURE)) { itemStackIn.setItemDamage(3); } else if (playerIn.isPotionActive(ModRegistry.POTION_INFECTION)) { itemStackIn.setItemDamage(2); } else { itemStackIn.setItemDamage(1); }
// Path: src/main/java/com/zalthonethree/zombieinfection/init/ModRegistry.java // @Mod.EventBusSubscriber() // public class ModRegistry { // public static final ItemBase CURE = new ItemCure(); // public static final ItemBase INFECTED_EGG = new ItemInfectedEgg(); // public static final ItemBase INFECTED_MILK = new ItemInfectedMilk(); // public static final ItemBase KNOWLEDGE_BOOK = new ItemKnowledgeBook(); // public static final ItemBase NEEDLE = new ItemNeedle(); // // public static final PotionZI POTION_INFECTION = new PotionZI(new ResourceLocation(Reference.MOD_ID, "infection"), new ResourceLocation(Reference.MOD_ID, "potion/infection.png"), false, 0xff00ff); // public static final PotionZI POTION_CURE = new PotionZI(new ResourceLocation(Reference.MOD_ID, "cure"), new ResourceLocation(Reference.MOD_ID, "potion/cure.png"), false, 0xff00ff); // // @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { // IForgeRegistry<Item> registry = event.getRegistry(); // // registry.register(CURE); // registry.register(INFECTED_EGG); // registry.register(INFECTED_MILK); // registry.register(KNOWLEDGE_BOOK); // registry.register(NEEDLE); // } // // @SubscribeEvent public static void registerPotions(RegistryEvent.Register<Potion> event) { // IForgeRegistry<Potion> registry = event.getRegistry(); // // registry.register(POTION_INFECTION); // registry.register(POTION_CURE); // } // } // // Path: src/main/java/com/zalthonethree/zombieinfection/utility/CustomDamageSource.java // public class CustomDamageSource extends DamageSource { // String message; // // public CustomDamageSource(String type, String deathmessage) { // super(type); // this.setDamageIsAbsolute(); // this.message = deathmessage; // } // // @Override public ITextComponent getDeathMessage(EntityLivingBase entity) { // return new TextComponentTranslation(this.message, entity.getDisplayName()); // } // } // Path: src/main/java/com/zalthonethree/zombieinfection/item/ItemNeedle.java import com.zalthonethree.zombieinfection.init.ModRegistry; import com.zalthonethree.zombieinfection.utility.CustomDamageSource; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.world.World; package com.zalthonethree.zombieinfection.item; public class ItemNeedle extends ItemBase { /* META REFERENCE * 0 - Empty Needle * 1 - Needle, Regular Blood * 2 - Needle, Infected Blood * 3 - Needle, Cured Blood */ public static final String[] names = new String[] {"", "normal", "infected", "cured", "unknown"}; public ItemNeedle() { super(); this.setNames("needle"); this.setMaxStackSize(1); this.setHasSubtypes(true); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { ItemStack itemStackIn = playerIn.getHeldItem(hand); if (itemStackIn.getItemDamage() > 0) return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn); if (playerIn.isPotionActive(ModRegistry.POTION_CURE)) { itemStackIn.setItemDamage(3); } else if (playerIn.isPotionActive(ModRegistry.POTION_INFECTION)) { itemStackIn.setItemDamage(2); } else { itemStackIn.setItemDamage(1); }
if (!worldIn.isRemote) playerIn.attackEntityFrom(new CustomDamageSource("needle", "zombieinfection.death.needle"), 5.0F);
lob/lob-java
src/test/java/com/lob/model/BulkIntlVerificationTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull;
package com.lob.model; public class BulkIntlVerificationTest extends BaseTest { @Test public void testBulkIntlVerification() throws Exception { List<IntlVerification.RequestBuilder> addresses = new ArrayList<IntlVerification.RequestBuilder>(); addresses.add(new IntlVerification.RequestBuilder() .setPrimaryLine("370 Water St") .setCity("Summerside") .setState("Prince Edward Island") .setPostalCode("C1N 1C4") .setCountry("CA"));
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/BulkIntlVerificationTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; package com.lob.model; public class BulkIntlVerificationTest extends BaseTest { @Test public void testBulkIntlVerification() throws Exception { List<IntlVerification.RequestBuilder> addresses = new ArrayList<IntlVerification.RequestBuilder>(); addresses.add(new IntlVerification.RequestBuilder() .setPrimaryLine("370 Water St") .setCity("Summerside") .setState("Prince Edward Island") .setPostalCode("C1N 1C4") .setCountry("CA"));
LobResponse<BulkIntlVerification> response = new BulkIntlVerification.RequestBuilder()
lob/lob-java
src/main/java/com/lob/net/APIResource.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/APIResource.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/APIResource.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/APIResource.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/APIResource.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/APIResource.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/APIResource.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/APIResource.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public abstract class APIResource { private static ResponseGetter responseGetter = new ResponseGetter(); public static final String CHARSET = "UTF-8"; public enum RequestMethod { GET, POST, DELETE } public enum RequestType { NORMAL, MULTIPART, JSON } public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, String url, Map<String, Object> params, Class<T> clazz,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/test/java/com/lob/model/BankAccountTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class BankAccountTest extends BaseTest { @Test public void testListBankAccounts() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/BankAccountTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class BankAccountTest extends BaseTest { @Test public void testListBankAccounts() throws Exception {
LobResponse<BankAccountCollection> response = BankAccount.list();
lob/lob-java
src/main/java/com/lob/net/IResponseGetter.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/IResponseGetter.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException;
lob/lob-java
src/main/java/com/lob/net/IResponseGetter.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/IResponseGetter.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException;
lob/lob-java
src/main/java/com/lob/net/IResponseGetter.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/IResponseGetter.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException;
lob/lob-java
src/main/java/com/lob/net/IResponseGetter.java
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // }
import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map;
package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // Path: src/main/java/com/lob/net/IResponseGetter.java import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import java.io.IOException; import java.util.Map; package com.lob.net; public interface IResponseGetter { <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException;
lob/lob-java
src/main/java/com/lob/model/Event.java
// Path: src/main/java/com/lob/net/APIResource.java // public abstract class APIResource { // // private static ResponseGetter responseGetter = new ResponseGetter(); // // public static final String CHARSET = "UTF-8"; // // public enum RequestMethod { // GET, POST, DELETE // } // // public enum RequestType { // NORMAL, MULTIPART, JSON // } // // public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, // String url, Map<String, Object> params, Class<T> clazz, // RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { // return responseGetter.request(method, url, params, clazz, type, options); // } // // public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, // String url, Map<String, Object> params, Map<String, Object> query, Class<T> clazz, // RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { // return responseGetter.request(method, url, params, query, clazz, type, options); // } // // }
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.lob.net.APIResource; import java.time.ZonedDateTime;
package com.lob.model; public class Event { @JsonProperty private final String id; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "object") @JsonSubTypes({ @JsonSubTypes.Type(value = Postcard.class, name = "postcard"), @JsonSubTypes.Type(value = Letter.class, name = "letter"), @JsonSubTypes.Type(value = Check.class, name = "check"), @JsonSubTypes.Type(value = Address.class, name = "address"), @JsonSubTypes.Type(value = BankAccount.class, name = "bank_account") })
// Path: src/main/java/com/lob/net/APIResource.java // public abstract class APIResource { // // private static ResponseGetter responseGetter = new ResponseGetter(); // // public static final String CHARSET = "UTF-8"; // // public enum RequestMethod { // GET, POST, DELETE // } // // public enum RequestType { // NORMAL, MULTIPART, JSON // } // // public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, // String url, Map<String, Object> params, Class<T> clazz, // RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { // return responseGetter.request(method, url, params, clazz, type, options); // } // // public static <T> LobResponse<T> request(APIResource.RequestMethod method, APIResource.RequestType type, // String url, Map<String, Object> params, Map<String, Object> query, Class<T> clazz, // RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { // return responseGetter.request(method, url, params, query, clazz, type, options); // } // // } // Path: src/main/java/com/lob/model/Event.java import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.lob.net.APIResource; import java.time.ZonedDateTime; package com.lob.model; public class Event { @JsonProperty private final String id; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "object") @JsonSubTypes({ @JsonSubTypes.Type(value = Postcard.class, name = "postcard"), @JsonSubTypes.Type(value = Letter.class, name = "letter"), @JsonSubTypes.Type(value = Check.class, name = "check"), @JsonSubTypes.Type(value = Address.class, name = "address"), @JsonSubTypes.Type(value = BankAccount.class, name = "bank_account") })
@JsonProperty private final APIResource body;
lob/lob-java
src/test/java/com/lob/model/LetterTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class LetterTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/LetterTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class LetterTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() {
Lob.init(System.getenv("LOB_API_KEY"));
lob/lob-java
src/test/java/com/lob/model/LetterTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class LetterTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/LetterTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class LetterTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try {
LobResponse<Template> templateResponse = new Template.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/LetterTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
.setCity("San Francisco") .setState("CA") .setZip("94107") .setCountry("US") ) .setFrom( new Address.RequestBuilder() .setName("Nathan") .setLine1("185 Berry St Ste 6100") .setCity("San Francisco") .setState("CA") .setZip("94107") .setCountry("US") ) .setColor(true) .setDoubleSided(false) .setAddressPlacement("insert_blank_page") .setMailType("usps_first_class") .create(); Letter letter = response.getResponseBody(); assertEquals(200, response.getResponseCode()); assertNotNull(letter.getId()); assertEquals("Test Letter with Merge Variable Object", letter.getDescription()); assertNotNull(letter.getUrl()); assertEquals(mergeVariables, letter.getMergeVariables()); assertEquals("letter", letter.getObject()); }
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/LetterTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; .setCity("San Francisco") .setState("CA") .setZip("94107") .setCountry("US") ) .setFrom( new Address.RequestBuilder() .setName("Nathan") .setLine1("185 Berry St Ste 6100") .setCity("San Francisco") .setState("CA") .setZip("94107") .setCountry("US") ) .setColor(true) .setDoubleSided(false) .setAddressPlacement("insert_blank_page") .setMailType("usps_first_class") .create(); Letter letter = response.getResponseBody(); assertEquals(200, response.getResponseCode()); assertNotNull(letter.getId()); assertEquals("Test Letter with Merge Variable Object", letter.getDescription()); assertNotNull(letter.getUrl()); assertEquals(mergeVariables, letter.getMergeVariables()); assertEquals("letter", letter.getObject()); }
@Test(expected=InvalidRequestException.class)
lob/lob-java
src/test/java/com/lob/model/AddressTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // // Path: src/main/java/com/lob/net/RequestOptions.java // public class RequestOptions { // public static RequestOptions getDefault() { // return new RequestOptions(Lob.apiKey, Lob.apiVersion, null, null); // } // // private final String apiKey; // private final String lobVersion; // private final String idempotencyKey; // private final Proxy proxy; // // private RequestOptions(String apiKey, String lobVersion, String idempotencyKey, Proxy proxy) { // this.apiKey = apiKey; // this.lobVersion = lobVersion; // this.idempotencyKey = idempotencyKey; // this.proxy = proxy; // } // // public String getApiKey() { // return apiKey; // } // // public String getLobVersion() { // return lobVersion; // } // // public String getIdempotencyKey() { // return idempotencyKey; // } // // public Proxy getProxy() { // return proxy; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // else if (o instanceof RequestOptions) { // RequestOptions that = (RequestOptions) o; // // if (!Objects.equals(this.apiKey, that.getApiKey())) { // return false; // } // // if (!Objects.equals(this.lobVersion, that.getLobVersion())) { // return false; // } // // if (!Objects.equals(this.idempotencyKey, that.getIdempotencyKey())) { // return false; // } // // return true; // } else { // return false; // } // } // // @Override // public int hashCode() { // return Objects.hash(apiKey, lobVersion, idempotencyKey); // } // // public static final class Builder { // private String apiKey; // private String lobVersion; // private String idempotencyKey; // private Proxy proxy; // // public Builder() { // this.apiKey = Lob.apiKey; // this.lobVersion = Lob.apiVersion; // } // // public String getApiKey() { // return this.apiKey; // } // // public Builder setApiKey(String apiKey) { // this.apiKey = apiKey; // return this; // } // // public Builder setLobVersion(String lobVersion) { // this.lobVersion = lobVersion; // return this; // } // // public String getLobVersion() { // return this.lobVersion; // } // // public Builder setIdempotencyKey(String idempotencyKey) { // this.idempotencyKey = idempotencyKey; // return this; // } // // public String getIdempotencyKey() { // return this.idempotencyKey; // } // // public Builder setProxy(Proxy proxy) { // this.proxy = proxy; // return this; // } // // public Proxy getProxy() { // return this.proxy; // } // // public RequestOptions build() { // return new RequestOptions(this.apiKey, this.lobVersion, this.idempotencyKey, this.proxy); // } // } // // }
import com.lob.BaseTest; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import com.lob.net.LobResponse; import com.lob.net.RequestOptions; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class AddressTest extends BaseTest { @Test public void testListAddresses() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // // Path: src/main/java/com/lob/net/RequestOptions.java // public class RequestOptions { // public static RequestOptions getDefault() { // return new RequestOptions(Lob.apiKey, Lob.apiVersion, null, null); // } // // private final String apiKey; // private final String lobVersion; // private final String idempotencyKey; // private final Proxy proxy; // // private RequestOptions(String apiKey, String lobVersion, String idempotencyKey, Proxy proxy) { // this.apiKey = apiKey; // this.lobVersion = lobVersion; // this.idempotencyKey = idempotencyKey; // this.proxy = proxy; // } // // public String getApiKey() { // return apiKey; // } // // public String getLobVersion() { // return lobVersion; // } // // public String getIdempotencyKey() { // return idempotencyKey; // } // // public Proxy getProxy() { // return proxy; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // else if (o instanceof RequestOptions) { // RequestOptions that = (RequestOptions) o; // // if (!Objects.equals(this.apiKey, that.getApiKey())) { // return false; // } // // if (!Objects.equals(this.lobVersion, that.getLobVersion())) { // return false; // } // // if (!Objects.equals(this.idempotencyKey, that.getIdempotencyKey())) { // return false; // } // // return true; // } else { // return false; // } // } // // @Override // public int hashCode() { // return Objects.hash(apiKey, lobVersion, idempotencyKey); // } // // public static final class Builder { // private String apiKey; // private String lobVersion; // private String idempotencyKey; // private Proxy proxy; // // public Builder() { // this.apiKey = Lob.apiKey; // this.lobVersion = Lob.apiVersion; // } // // public String getApiKey() { // return this.apiKey; // } // // public Builder setApiKey(String apiKey) { // this.apiKey = apiKey; // return this; // } // // public Builder setLobVersion(String lobVersion) { // this.lobVersion = lobVersion; // return this; // } // // public String getLobVersion() { // return this.lobVersion; // } // // public Builder setIdempotencyKey(String idempotencyKey) { // this.idempotencyKey = idempotencyKey; // return this; // } // // public String getIdempotencyKey() { // return this.idempotencyKey; // } // // public Builder setProxy(Proxy proxy) { // this.proxy = proxy; // return this; // } // // public Proxy getProxy() { // return this.proxy; // } // // public RequestOptions build() { // return new RequestOptions(this.apiKey, this.lobVersion, this.idempotencyKey, this.proxy); // } // } // // } // Path: src/test/java/com/lob/model/AddressTest.java import com.lob.BaseTest; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import com.lob.net.LobResponse; import com.lob.net.RequestOptions; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class AddressTest extends BaseTest { @Test public void testListAddresses() throws Exception {
LobResponse<AddressCollection> response = Address.list();
lob/lob-java
src/main/java/com/lob/net/RequestOptions.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // }
import java.net.Proxy; import java.util.Objects; import com.lob.Lob;
package com.lob.net; public class RequestOptions { public static RequestOptions getDefault() {
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // Path: src/main/java/com/lob/net/RequestOptions.java import java.net.Proxy; import java.util.Objects; import com.lob.Lob; package com.lob.net; public class RequestOptions { public static RequestOptions getDefault() {
return new RequestOptions(Lob.apiKey, Lob.apiVersion, null, null);
lob/lob-java
src/test/java/com/lob/model/USAutocompletionTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class USAutocompletionTest extends BaseTest { @Test public void testUSAutocompletion() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/USAutocompletionTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class USAutocompletionTest extends BaseTest { @Test public void testUSAutocompletion() throws Exception {
LobResponse<USAutocompletion> response = new USAutocompletion.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/BillingGroupTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // // Path: src/main/java/com/lob/net/RequestOptions.java // public class RequestOptions { // public static RequestOptions getDefault() { // return new RequestOptions(Lob.apiKey, Lob.apiVersion, null, null); // } // // private final String apiKey; // private final String lobVersion; // private final String idempotencyKey; // private final Proxy proxy; // // private RequestOptions(String apiKey, String lobVersion, String idempotencyKey, Proxy proxy) { // this.apiKey = apiKey; // this.lobVersion = lobVersion; // this.idempotencyKey = idempotencyKey; // this.proxy = proxy; // } // // public String getApiKey() { // return apiKey; // } // // public String getLobVersion() { // return lobVersion; // } // // public String getIdempotencyKey() { // return idempotencyKey; // } // // public Proxy getProxy() { // return proxy; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // else if (o instanceof RequestOptions) { // RequestOptions that = (RequestOptions) o; // // if (!Objects.equals(this.apiKey, that.getApiKey())) { // return false; // } // // if (!Objects.equals(this.lobVersion, that.getLobVersion())) { // return false; // } // // if (!Objects.equals(this.idempotencyKey, that.getIdempotencyKey())) { // return false; // } // // return true; // } else { // return false; // } // } // // @Override // public int hashCode() { // return Objects.hash(apiKey, lobVersion, idempotencyKey); // } // // public static final class Builder { // private String apiKey; // private String lobVersion; // private String idempotencyKey; // private Proxy proxy; // // public Builder() { // this.apiKey = Lob.apiKey; // this.lobVersion = Lob.apiVersion; // } // // public String getApiKey() { // return this.apiKey; // } // // public Builder setApiKey(String apiKey) { // this.apiKey = apiKey; // return this; // } // // public Builder setLobVersion(String lobVersion) { // this.lobVersion = lobVersion; // return this; // } // // public String getLobVersion() { // return this.lobVersion; // } // // public Builder setIdempotencyKey(String idempotencyKey) { // this.idempotencyKey = idempotencyKey; // return this; // } // // public String getIdempotencyKey() { // return this.idempotencyKey; // } // // public Builder setProxy(Proxy proxy) { // this.proxy = proxy; // return this; // } // // public Proxy getProxy() { // return this.proxy; // } // // public RequestOptions build() { // return new RequestOptions(this.apiKey, this.lobVersion, this.idempotencyKey, this.proxy); // } // } // // }
import com.lob.BaseTest; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import com.lob.net.LobResponse; import com.lob.net.RequestOptions; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class BillingGroupTest extends BaseTest { @Test public void testListBillingGroups() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // // Path: src/main/java/com/lob/net/RequestOptions.java // public class RequestOptions { // public static RequestOptions getDefault() { // return new RequestOptions(Lob.apiKey, Lob.apiVersion, null, null); // } // // private final String apiKey; // private final String lobVersion; // private final String idempotencyKey; // private final Proxy proxy; // // private RequestOptions(String apiKey, String lobVersion, String idempotencyKey, Proxy proxy) { // this.apiKey = apiKey; // this.lobVersion = lobVersion; // this.idempotencyKey = idempotencyKey; // this.proxy = proxy; // } // // public String getApiKey() { // return apiKey; // } // // public String getLobVersion() { // return lobVersion; // } // // public String getIdempotencyKey() { // return idempotencyKey; // } // // public Proxy getProxy() { // return proxy; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // else if (o instanceof RequestOptions) { // RequestOptions that = (RequestOptions) o; // // if (!Objects.equals(this.apiKey, that.getApiKey())) { // return false; // } // // if (!Objects.equals(this.lobVersion, that.getLobVersion())) { // return false; // } // // if (!Objects.equals(this.idempotencyKey, that.getIdempotencyKey())) { // return false; // } // // return true; // } else { // return false; // } // } // // @Override // public int hashCode() { // return Objects.hash(apiKey, lobVersion, idempotencyKey); // } // // public static final class Builder { // private String apiKey; // private String lobVersion; // private String idempotencyKey; // private Proxy proxy; // // public Builder() { // this.apiKey = Lob.apiKey; // this.lobVersion = Lob.apiVersion; // } // // public String getApiKey() { // return this.apiKey; // } // // public Builder setApiKey(String apiKey) { // this.apiKey = apiKey; // return this; // } // // public Builder setLobVersion(String lobVersion) { // this.lobVersion = lobVersion; // return this; // } // // public String getLobVersion() { // return this.lobVersion; // } // // public Builder setIdempotencyKey(String idempotencyKey) { // this.idempotencyKey = idempotencyKey; // return this; // } // // public String getIdempotencyKey() { // return this.idempotencyKey; // } // // public Builder setProxy(Proxy proxy) { // this.proxy = proxy; // return this; // } // // public Proxy getProxy() { // return this.proxy; // } // // public RequestOptions build() { // return new RequestOptions(this.apiKey, this.lobVersion, this.idempotencyKey, this.proxy); // } // } // // } // Path: src/test/java/com/lob/model/BillingGroupTest.java import com.lob.BaseTest; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import com.lob.net.LobResponse; import com.lob.net.RequestOptions; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class BillingGroupTest extends BaseTest { @Test public void testListBillingGroups() throws Exception {
LobResponse<BillingGroupCollection> response = BillingGroup.list();
lob/lob-java
src/test/java/com/lob/model/BulkUSVerificationTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull;
package com.lob.model; public class BulkUSVerificationTest extends BaseTest { @Test public void testBulkUsVerification() throws Exception { List<USVerification.RequestBuilder> addresses = new ArrayList<USVerification.RequestBuilder>(); addresses.add(new USVerification.RequestBuilder() .setRecipient("Donald") .setPrimaryLine("deliverable") .setSecondaryLine("Ste 6100") .setUrbanization("") .setCity("San Francisco") .setState("CA") .setZipCode("94107"));
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/BulkUSVerificationTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; package com.lob.model; public class BulkUSVerificationTest extends BaseTest { @Test public void testBulkUsVerification() throws Exception { List<USVerification.RequestBuilder> addresses = new ArrayList<USVerification.RequestBuilder>(); addresses.add(new USVerification.RequestBuilder() .setRecipient("Donald") .setPrimaryLine("deliverable") .setSecondaryLine("Ste 6100") .setUrbanization("") .setCity("San Francisco") .setState("CA") .setZipCode("94107"));
LobResponse<BulkUSVerification> response = new BulkUSVerification.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/USReverseGeocodeLookupTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class USReverseGeocodeLookupTest extends BaseTest { @Test public void testUSReverseGeocodeLookup() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/USReverseGeocodeLookupTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class USReverseGeocodeLookupTest extends BaseTest { @Test public void testUSReverseGeocodeLookup() throws Exception {
LobResponse<USReverseGeocodeLookup> response = new USReverseGeocodeLookup.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/USZipLookupTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class USZipLookupTest extends BaseTest { @Test public void testUSZipLookup() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/USZipLookupTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class USZipLookupTest extends BaseTest { @Test public void testUSZipLookup() throws Exception {
LobResponse<USZipLookup> response = new USZipLookup.RequestBuilder()
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; package com.lob.net; public class ResponseGetter implements IResponseGetter { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.of("UTC")); private static final ObjectMapper MAPPER = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private static final class Parameter { public final String key; public final Object value; public Parameter(String key, Object value) { this.key = key; this.value = value; } } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type,
RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException {
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
} @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { return _request(method, url, data, query, clazz, type, options); } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { return _request(method, url, data, Collections.emptyMap(), clazz, type, options); } static Map<String, String> getHeaders(RequestOptions options) { Map<String, String> headers = new HashMap<String, String>(); headers.put("Authorization", String.format("Basic %s", Base64.encodeBase64String((options.getApiKey() + ":").getBytes())));
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Map<String, Object> query, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { return _request(method, url, data, query, clazz, type, options); } @Override public <T> LobResponse<T> request( APIResource.RequestMethod method, String url, Map<String, Object> data, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, RateLimitException, InvalidRequestException, IOException { return _request(method, url, data, Collections.emptyMap(), clazz, type, options); } static Map<String, String> getHeaders(RequestOptions options) { Map<String, String> headers = new HashMap<String, String>(); headers.put("Authorization", String.format("Basic %s", Base64.encodeBase64String((options.getApiKey() + ":").getBytes())));
headers.put("User-Agent", String.format("LobJava/%s JDK/%s", Lob.VERSION, System.getProperty("java.version")));
lob/lob-java
src/main/java/com/lob/net/ResponseGetter.java
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8";
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST;
return headers; } private static java.net.HttpURLConnection createDefaultConnection(String url, RequestOptions options) throws IOException { URL lobURL = new URL(url); HttpURLConnection conn = (HttpURLConnection) (options.getProxy() == null ? lobURL.openConnection() : lobURL.openConnection(options.getProxy())); conn.setUseCaches(false); for (Map.Entry<String, String> header : getHeaders(options).entrySet()) { conn.setRequestProperty(header.getKey(), header.getValue()); } return conn; } private static java.net.HttpURLConnection createGetConnection(String url, String query, RequestOptions options) throws IOException { String getURL = query.isEmpty() ? url : String.format("%s?%s", url, query); java.net.HttpURLConnection conn = createDefaultConnection(getURL, options); conn.setRequestMethod("GET"); return conn; } private static java.net.HttpURLConnection createPostConnection(String url, String data, String query, RequestOptions options) throws IOException { String getURL = query.isEmpty() ? url : String.format("%s?%s", url, query); java.net.HttpURLConnection conn = createDefaultConnection(getURL, options); conn.setDoOutput(true); conn.setRequestMethod("POST");
// Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/exception/APIException.java // public class APIException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public APIException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/AuthenticationException.java // public class AuthenticationException extends LobException { // // private static final long serialVersionUID = 1L; // // public AuthenticationException(String message, Integer statusCode) { // super(message, statusCode); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/exception/RateLimitException.java // public class RateLimitException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public RateLimitException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/APIResource.java // public static final String CHARSET = "UTF-8"; // Path: src/main/java/com/lob/net/ResponseGetter.java import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.lob.Lob; import com.lob.exception.APIException; import com.lob.exception.AuthenticationException; import com.lob.exception.InvalidRequestException; import com.lob.exception.RateLimitException; import org.apache.commons.codec.binary.Base64; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.time.ZonedDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import static com.lob.net.APIResource.CHARSET; import static com.lob.net.APIResource.RequestMethod.DELETE; import static com.lob.net.APIResource.RequestMethod.POST; return headers; } private static java.net.HttpURLConnection createDefaultConnection(String url, RequestOptions options) throws IOException { URL lobURL = new URL(url); HttpURLConnection conn = (HttpURLConnection) (options.getProxy() == null ? lobURL.openConnection() : lobURL.openConnection(options.getProxy())); conn.setUseCaches(false); for (Map.Entry<String, String> header : getHeaders(options).entrySet()) { conn.setRequestProperty(header.getKey(), header.getValue()); } return conn; } private static java.net.HttpURLConnection createGetConnection(String url, String query, RequestOptions options) throws IOException { String getURL = query.isEmpty() ? url : String.format("%s?%s", url, query); java.net.HttpURLConnection conn = createDefaultConnection(getURL, options); conn.setRequestMethod("GET"); return conn; } private static java.net.HttpURLConnection createPostConnection(String url, String data, String query, RequestOptions options) throws IOException { String getURL = query.isEmpty() ? url : String.format("%s?%s", url, query); java.net.HttpURLConnection conn = createDefaultConnection(getURL, options); conn.setDoOutput(true); conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", String.format("application/x-www-form-urlencoded;charset=%s", APIResource.CHARSET));
lob/lob-java
src/test/java/com/lob/model/SelfMailerTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class SelfMailerTest extends BaseTest { @Test public void testListSelfMailers() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/SelfMailerTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class SelfMailerTest extends BaseTest { @Test public void testListSelfMailers() throws Exception {
LobResponse<SelfMailerCollection> response = SelfMailer.list();
lob/lob-java
src/test/java/com/lob/model/IntlVerificationTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.junit.Assert.assertEquals;
package com.lob.model; public class IntlVerificationTest extends BaseTest { @Test public void testInternationalVerification() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/IntlVerificationTest.java import com.lob.BaseTest; import com.lob.net.LobResponse; import org.junit.Test; import static org.junit.Assert.assertEquals; package com.lob.model; public class IntlVerificationTest extends BaseTest { @Test public void testInternationalVerification() throws Exception {
LobResponse<IntlVerification> response = new IntlVerification.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/TemplateTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class TemplateTest extends BaseTest { @Test public void testCreateTemplate() throws Exception {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/exception/InvalidRequestException.java // public class InvalidRequestException extends LobException { // // private static final long serialVersionUID = 1L; // // @JsonCreator // public InvalidRequestException(@JsonProperty("error") final Map<String, Object> error) { // super((String)error.get("message"), (Integer)error.get("status_code")); // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/TemplateTest.java import com.lob.BaseTest; import com.lob.exception.InvalidRequestException; import com.lob.net.LobResponse; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class TemplateTest extends BaseTest { @Test public void testCreateTemplate() throws Exception {
LobResponse<Template> response = new Template.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/PostcardTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class PostcardTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/PostcardTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class PostcardTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() {
Lob.init(System.getenv("LOB_API_KEY"));
lob/lob-java
src/test/java/com/lob/model/PostcardTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class PostcardTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/PostcardTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class PostcardTest extends BaseTest { private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try {
LobResponse<Template> templateResponse = new Template.RequestBuilder()
lob/lob-java
src/test/java/com/lob/model/CheckTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class CheckTest extends BaseTest { private static String VERIFIED_BANK_ACCOUNT; private static String templateId; @BeforeClass public static void beforeClass() {
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/CheckTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class CheckTest extends BaseTest { private static String VERIFIED_BANK_ACCOUNT; private static String templateId; @BeforeClass public static void beforeClass() {
Lob.init(System.getenv("LOB_API_KEY"));
lob/lob-java
src/test/java/com/lob/model/CheckTest.java
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // }
import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*;
package com.lob.model; public class CheckTest extends BaseTest { private static String VERIFIED_BANK_ACCOUNT; private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try { BankAccount newBankAccount = new BankAccount.RequestBuilder() .setRoutingNumber("322271627") .setAccountNumber("123456789") .setAccountType("company") .setSignatory("Donald") .create() .getResponseBody(); ArrayList<Integer> verificationAmounts = new ArrayList<Integer>(); verificationAmounts.add(25); verificationAmounts.add(63); VERIFIED_BANK_ACCOUNT = BankAccount.verify(newBankAccount.getId(), verificationAmounts).getResponseBody().getId();
// Path: src/test/java/com/lob/BaseTest.java // public class BaseTest { // // @BeforeClass // public static void beforeClass() { // Lob.init(System.getenv("LOB_API_KEY")); // } // // } // // Path: src/main/java/com/lob/Lob.java // public class Lob { // // public static final String API_BASE_URL = "https://api.lob.com/v1/"; // public static final String VERSION = "7.0.0"; // // public static String apiKey; // public static String apiVersion; // // public static void init(final String apiKey) { // Lob.apiKey = apiKey; // Lob.apiVersion = null; // } // // public static void init(final String apiKey, final String apiVersion) { // Lob.apiKey = apiKey; // Lob.apiVersion = apiVersion; // } // // } // // Path: src/main/java/com/lob/net/LobResponse.java // public class LobResponse<T> { // // int responseCode; // T responseBody; // Map<String, List<String>> responseHeaders; // // public LobResponse(int responseCode, T responseBody) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = null; // } // // public LobResponse(int responseCode, T responseBody, Map<String, List<String>> responseHeaders) { // this.responseCode = responseCode; // this.responseBody = responseBody; // this.responseHeaders = responseHeaders; // } // // public int getResponseCode() { // return responseCode; // } // // public T getResponseBody() { // return responseBody; // } // // public Map<String, List<String>> getResponseHeaders() { // return responseHeaders; // } // } // Path: src/test/java/com/lob/model/CheckTest.java import com.lob.BaseTest; import com.lob.Lob; import com.lob.net.LobResponse; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.*; package com.lob.model; public class CheckTest extends BaseTest { private static String VERIFIED_BANK_ACCOUNT; private static String templateId; @BeforeClass public static void beforeClass() { Lob.init(System.getenv("LOB_API_KEY")); try { BankAccount newBankAccount = new BankAccount.RequestBuilder() .setRoutingNumber("322271627") .setAccountNumber("123456789") .setAccountType("company") .setSignatory("Donald") .create() .getResponseBody(); ArrayList<Integer> verificationAmounts = new ArrayList<Integer>(); verificationAmounts.add(25); verificationAmounts.add(63); VERIFIED_BANK_ACCOUNT = BankAccount.verify(newBankAccount.getId(), verificationAmounts).getResponseBody().getId();
LobResponse<Template> templateResponse = new Template.RequestBuilder()
sbrannen/junit5-demo
src/test/java/working/SpringJupiterTests.java
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // } // // Path: src/test/java/spring/TestConfig.java // @Configuration // public class TestConfig { // // @Primary // @Bean // Cat catbert() { // return new Cat("Catbert"); // } // // @Bean // Cat garfield() { // return new Cat("Garfield"); // } // // }
import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import demo.Cat; import spring.DisabledOnMac; import spring.EnabledOnMac; import spring.TestConfig;
package working; @SpringJUnitConfig(TestConfig.class) class SpringJupiterTests {
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // } // // Path: src/test/java/spring/TestConfig.java // @Configuration // public class TestConfig { // // @Primary // @Bean // Cat catbert() { // return new Cat("Catbert"); // } // // @Bean // Cat garfield() { // return new Cat("Garfield"); // } // // } // Path: src/test/java/working/SpringJupiterTests.java import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import demo.Cat; import spring.DisabledOnMac; import spring.EnabledOnMac; import spring.TestConfig; package working; @SpringJUnitConfig(TestConfig.class) class SpringJupiterTests {
private final Cat primaryCat;
sbrannen/junit5-demo
src/test/java/boot/SpringBootJupiterTests.java
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // }
import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.condition.OS.MAC; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import demo.Cat; import spring.EnabledOnMac;
package boot; @SpringBootTest class SpringBootJupiterTests {
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // } // Path: src/test/java/boot/SpringBootJupiterTests.java import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.condition.OS.MAC; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import demo.Cat; import spring.EnabledOnMac; package boot; @SpringBootTest class SpringBootJupiterTests {
private final Cat primaryCat;
sbrannen/junit5-demo
src/test/java/playground/JUnit4PersonTests.java
// Path: src/main/java/demo/Person.java // public class Person { // // private final String firstName; // private final String lastName; // // public Person(String firstName, String lastName) { // this.firstName = firstName; // this.lastName = lastName; // } // // public String getFirstName() { // return this.firstName; // } // // public String getLastName() { // return this.lastName; // } // // public String getFullName() { // return this.firstName + "" + this.lastName; // } // // }
import static org.junit.Assert.assertEquals; import org.junit.Test; import demo.Person;
package playground; public class JUnit4PersonTests { @Test public void getterMethods() {
// Path: src/main/java/demo/Person.java // public class Person { // // private final String firstName; // private final String lastName; // // public Person(String firstName, String lastName) { // this.firstName = firstName; // this.lastName = lastName; // } // // public String getFirstName() { // return this.firstName; // } // // public String getLastName() { // return this.lastName; // } // // public String getFullName() { // return this.firstName + "" + this.lastName; // } // // } // Path: src/test/java/playground/JUnit4PersonTests.java import static org.junit.Assert.assertEquals; import org.junit.Test; import demo.Person; package playground; public class JUnit4PersonTests { @Test public void getterMethods() {
Person bart = new Person("Bart", "Simpson");
sbrannen/junit5-demo
src/main/java/boot/Application.java
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // }
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import demo.Cat;
package boot; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean @Primary
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // } // Path: src/main/java/boot/Application.java import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import demo.Cat; package boot; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean @Primary
Cat catbert() {
sbrannen/junit5-demo
src/test/java/working/CalculatorTests.java
// Path: src/main/java/demo/Calculator.java // public class Calculator { // // public int add(int a, int b) { // return a + b; // } // // public int subtract(int a, int b) { // return a - b; // } // // public int multiply(int a, int b) { // return a * b; // } // // public int divide(int a, int b) { // return a / b; // } // // public int fibonacci(int n) { // if (n == 0) { // return 0; // } // else if (n == 1) { // return 1; // } // return fibonacci(n - 1) + fibonacci(n - 2); // } // // }
import static java.time.Duration.ofMillis; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import demo.Calculator;
package working; @DisplayName("Calculator Unit Tests") class CalculatorTests {
// Path: src/main/java/demo/Calculator.java // public class Calculator { // // public int add(int a, int b) { // return a + b; // } // // public int subtract(int a, int b) { // return a - b; // } // // public int multiply(int a, int b) { // return a * b; // } // // public int divide(int a, int b) { // return a / b; // } // // public int fibonacci(int n) { // if (n == 0) { // return 0; // } // else if (n == 1) { // return 1; // } // return fibonacci(n - 1) + fibonacci(n - 2); // } // // } // Path: src/test/java/working/CalculatorTests.java import static java.time.Duration.ofMillis; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import demo.Calculator; package working; @DisplayName("Calculator Unit Tests") class CalculatorTests {
private final Calculator calculator = new Calculator();
sbrannen/junit5-demo
src/test/java/working/ParameterizedFibonacciTests.java
// Path: src/main/java/demo/Calculator.java // public class Calculator { // // public int add(int a, int b) { // return a + b; // } // // public int subtract(int a, int b) { // return a - b; // } // // public int multiply(int a, int b) { // return a * b; // } // // public int divide(int a, int b) { // return a / b; // } // // public int fibonacci(int n) { // if (n == 0) { // return 0; // } // else if (n == 1) { // return 1; // } // return fibonacci(n - 1) + fibonacci(n - 2); // } // // }
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import demo.Calculator;
package working; @Execution(CONCURRENT) @ExtendWith(LoggingExtension.class) class ParameterizedFibonacciTests {
// Path: src/main/java/demo/Calculator.java // public class Calculator { // // public int add(int a, int b) { // return a + b; // } // // public int subtract(int a, int b) { // return a - b; // } // // public int multiply(int a, int b) { // return a * b; // } // // public int divide(int a, int b) { // return a / b; // } // // public int fibonacci(int n) { // if (n == 0) { // return 0; // } // else if (n == 1) { // return 1; // } // return fibonacci(n - 1) + fibonacci(n - 2); // } // // } // Path: src/test/java/working/ParameterizedFibonacciTests.java import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import demo.Calculator; package working; @Execution(CONCURRENT) @ExtendWith(LoggingExtension.class) class ParameterizedFibonacciTests {
private final Calculator calculator = new Calculator();
sbrannen/junit5-demo
src/test/java/spring/TestConfig.java
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // }
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import demo.Cat;
package spring; @Configuration public class TestConfig { @Primary @Bean
// Path: src/main/java/demo/Cat.java // public class Cat { // // private final String name; // // public Cat(String name) { // this.name = name; // } // // public String getName() { // return this.name; // } // // } // Path: src/test/java/spring/TestConfig.java import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import demo.Cat; package spring; @Configuration public class TestConfig { @Primary @Bean
Cat catbert() {
sbrannen/junit5-demo
src/test/java/working/JUnitJupiterPersonTests.java
// Path: src/main/java/demo/Person.java // public class Person { // // private final String firstName; // private final String lastName; // // public Person(String firstName, String lastName) { // this.firstName = firstName; // this.lastName = lastName; // } // // public String getFirstName() { // return this.firstName; // } // // public String getLastName() { // return this.lastName; // } // // public String getFullName() { // return this.firstName + "" + this.lastName; // } // // }
import demo.Person; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test;
package working; class JUnitJupiterPersonTests { @Test void getterMethods() {
// Path: src/main/java/demo/Person.java // public class Person { // // private final String firstName; // private final String lastName; // // public Person(String firstName, String lastName) { // this.firstName = firstName; // this.lastName = lastName; // } // // public String getFirstName() { // return this.firstName; // } // // public String getLastName() { // return this.lastName; // } // // public String getFullName() { // return this.firstName + "" + this.lastName; // } // // } // Path: src/test/java/working/JUnitJupiterPersonTests.java import demo.Person; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; package working; class JUnitJupiterPersonTests { @Test void getterMethods() {
Person bart = new Person("Bart", "Simpson");
sbrannen/junit5-demo
src/test/java/working/ParameterizedTests.java
// Path: src/main/java/demo/StringUtils.java // public static boolean isPalindrome(String candidate) { // int length = candidate.length(); // for (int i = 0; i < length / 2; i++) { // if (candidate.charAt(i) != candidate.charAt(length - (i + 1))) { // return false; // } // } // return true; // }
import static demo.StringUtils.isPalindrome; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.Stream; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource;
package working; @TestInstance(Lifecycle.PER_CLASS) class ParameterizedTests { @ParameterizedTest // @ValueSource(strings = { // // "mom", // // "dad", // // "radar", // // "racecar", // // "able was I ere I saw elba"// // }) @MethodSource // ("palindromes") void palindromes(String candidate) {
// Path: src/main/java/demo/StringUtils.java // public static boolean isPalindrome(String candidate) { // int length = candidate.length(); // for (int i = 0; i < length / 2; i++) { // if (candidate.charAt(i) != candidate.charAt(length - (i + 1))) { // return false; // } // } // return true; // } // Path: src/test/java/working/ParameterizedTests.java import static demo.StringUtils.isPalindrome; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.Stream; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; package working; @TestInstance(Lifecycle.PER_CLASS) class ParameterizedTests { @ParameterizedTest // @ValueSource(strings = { // // "mom", // // "dad", // // "radar", // // "racecar", // // "able was I ere I saw elba"// // }) @MethodSource // ("palindromes") void palindromes(String candidate) {
assertTrue(isPalindrome(candidate));
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/HorizontalAssembler.java
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 用於上蓋的包圍部件。蓋住上方,左右二邊只包含上方一小部份,像是「冖」、「宀」和「『學』上半部」等等。 * * @author Ihc */ public class HorizontalAssembler extends ObjMoveableTypeSurronder { /** * 建立水平拼合工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public HorizontalAssembler(MergePieceAdjuster 調整工具) { super(調整工具); } @Override
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/HorizontalAssembler.java import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 用於上蓋的包圍部件。蓋住上方,左右二邊只包含上方一小部份,像是「冖」、「宀」和「『學』上半部」等等。 * * @author Ihc */ public class HorizontalAssembler extends ObjMoveableTypeSurronder { /** * 建立水平拼合工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public HorizontalAssembler(MergePieceAdjuster 調整工具) { super(調整工具); } @Override
public void 組合(PieceMovableTypeTzu 物件活字)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/HorizontalAssembler.java
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 用於上蓋的包圍部件。蓋住上方,左右二邊只包含上方一小部份,像是「冖」、「宀」和「『學』上半部」等等。 * * @author Ihc */ public class HorizontalAssembler extends ObjMoveableTypeSurronder { /** * 建立水平拼合工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public HorizontalAssembler(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public void 組合(PieceMovableTypeTzu 物件活字) { /** 左爿佮右爿佮做伙時的調整模組 */ HorizontalAsmmod 模組 = new HorizontalAsmmod(調整工具); /** 將上下兩部件拼合的工具 */ BisearchPasteAssembler 貼合工具 = new BisearchPasteAssembler(); 貼合工具.執行(模組, 物件活字.取得活字物件());
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/HorizontalAssembler.java import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 用於上蓋的包圍部件。蓋住上方,左右二邊只包含上方一小部份,像是「冖」、「宀」和「『學』上半部」等等。 * * @author Ihc */ public class HorizontalAssembler extends ObjMoveableTypeSurronder { /** * 建立水平拼合工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public HorizontalAssembler(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public void 組合(PieceMovableTypeTzu 物件活字) { /** 左爿佮右爿佮做伙時的調整模組 */ HorizontalAsmmod 模組 = new HorizontalAsmmod(調整工具); /** 將上下兩部件拼合的工具 */ BisearchPasteAssembler 貼合工具 = new BisearchPasteAssembler(); 貼合工具.執行(模組, 物件活字.取得活字物件());
SeprateMovabletype[] 調整結果 = 模組.取得調整後活字物件();
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/idsrend/charcomponent/FinalCharComponent.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype;
* 初使化一个新的字部件。 * * @param 面頂彼个字部件 * 樹狀結構面頂彼个字部件 * @param 控制碼 * 這个字部件的組合符號統一碼控制碼 */ /** * 建立一个字部件。 * * @param parent * 上一層的部件結構。若上層是樹狀的樹根,傳入null * @param codePoint * 組合符號的Unicode編碼 */ public FinalCharComponent(int codePoint) { if (!CompositionMethods.isCombinationType(codePoint)) throw new IllegalArgumentException("這不是部件組合符號!!"); type = CompositionMethods.toCombinationType(codePoint); children = new CharComponent[type.getNumberOfChildren()]; } public FinalCharComponent(String 組字式) { this(組字式.codePointAt(0)); } @Override public ChineseCharCompositeMoveabletype typeset(
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // } // Path: src/main/java/idsrend/charcomponent/FinalCharComponent.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype; * 初使化一个新的字部件。 * * @param 面頂彼个字部件 * 樹狀結構面頂彼个字部件 * @param 控制碼 * 這个字部件的組合符號統一碼控制碼 */ /** * 建立一个字部件。 * * @param parent * 上一層的部件結構。若上層是樹狀的樹根,傳入null * @param codePoint * 組合符號的Unicode編碼 */ public FinalCharComponent(int codePoint) { if (!CompositionMethods.isCombinationType(codePoint)) throw new IllegalArgumentException("這不是部件組合符號!!"); type = CompositionMethods.toCombinationType(codePoint); children = new CharComponent[type.getNumberOfChildren()]; } public FinalCharComponent(String 組字式) { this(組字式.codePointAt(0)); } @Override public ChineseCharCompositeMoveabletype typeset(
ChineseCharacterTypeSetter chineseCharacterTypeSetter,
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/idsrend/charcomponent/FinalCharComponent.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype;
* * @param 面頂彼个字部件 * 樹狀結構面頂彼个字部件 * @param 控制碼 * 這个字部件的組合符號統一碼控制碼 */ /** * 建立一个字部件。 * * @param parent * 上一層的部件結構。若上層是樹狀的樹根,傳入null * @param codePoint * 組合符號的Unicode編碼 */ public FinalCharComponent(int codePoint) { if (!CompositionMethods.isCombinationType(codePoint)) throw new IllegalArgumentException("這不是部件組合符號!!"); type = CompositionMethods.toCombinationType(codePoint); children = new CharComponent[type.getNumberOfChildren()]; } public FinalCharComponent(String 組字式) { this(組字式.codePointAt(0)); } @Override public ChineseCharCompositeMoveabletype typeset( ChineseCharacterTypeSetter chineseCharacterTypeSetter,
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // } // Path: src/main/java/idsrend/charcomponent/FinalCharComponent.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype; * * @param 面頂彼个字部件 * 樹狀結構面頂彼个字部件 * @param 控制碼 * 這个字部件的組合符號統一碼控制碼 */ /** * 建立一个字部件。 * * @param parent * 上一層的部件結構。若上層是樹狀的樹根,傳入null * @param codePoint * 組合符號的Unicode編碼 */ public FinalCharComponent(int codePoint) { if (!CompositionMethods.isCombinationType(codePoint)) throw new IllegalArgumentException("這不是部件組合符號!!"); type = CompositionMethods.toCombinationType(codePoint); children = new CharComponent[type.getNumberOfChildren()]; } public FinalCharComponent(String 組字式) { this(組字式.codePointAt(0)); } @Override public ChineseCharCompositeMoveabletype typeset( ChineseCharacterTypeSetter chineseCharacterTypeSetter,
ChineseCharacterMovableTypeTzu parent)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/ZoomAsmmod.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 適用於靠縮放合併的模組,若是兩活字是靠縮放比例來當參數調整,就可適用此型態。 * * @author Ihc */ public abstract class ZoomAsmmod extends BisearchPasteAsmMod { /** 外部的活字物件 */
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/ZoomAsmmod.java import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 適用於靠縮放合併的模組,若是兩活字是靠縮放比例來當參數調整,就可適用此型態。 * * @author Ihc */ public abstract class ZoomAsmmod extends BisearchPasteAsmMod { /** 外部的活字物件 */
protected SeprateMovabletype outsidePiece;
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // }
import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry;
package cc.stroketool; public class MkeSeparateMovableType_Bolder { /** 物件活字加寬工具 */
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // } // Path: src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry; package cc.stroketool; public class MkeSeparateMovableType_Bolder { /** 物件活字加寬工具 */
private final ChineseCharacterTypeBolder chineseCharacterTypeBolder;
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // }
import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry;
package cc.stroketool; public class MkeSeparateMovableType_Bolder { /** 物件活字加寬工具 */ private final ChineseCharacterTypeBolder chineseCharacterTypeBolder; /** 合併、調整的精細度 */ private final double precision; public MkeSeparateMovableType_Bolder(ChineseCharacterTypeBolder chineseCharacterTypeBolder, double precision) { this.chineseCharacterTypeBolder = chineseCharacterTypeBolder; this.precision = precision; } /** * 計算物件活字粗細半徑 * * @param rectangularArea * 物件活字 * @return 粗細半徑 */
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // } // Path: src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry; package cc.stroketool; public class MkeSeparateMovableType_Bolder { /** 物件活字加寬工具 */ private final ChineseCharacterTypeBolder chineseCharacterTypeBolder; /** 合併、調整的精細度 */ private final double precision; public MkeSeparateMovableType_Bolder(ChineseCharacterTypeBolder chineseCharacterTypeBolder, double precision) { this.chineseCharacterTypeBolder = chineseCharacterTypeBolder; this.precision = precision; } /** * 計算物件活字粗細半徑 * * @param rectangularArea * 物件活字 * @return 粗細半徑 */
protected double computePieceRadius(PlaneGeometry rectangularArea)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // }
import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry;
{ return new MovableTypeWidthInfo(computeBoldCoefficient(活字物件)); } // /** // * 依照寬度資訊,來調整活字物件 // * // * @param 活字物件 // * 要被調整的活字物偉 // * @param 寬度資訊 // * 依據的寬度資訊 // */ // PlaneGeometry 依寬度資訊產生外殼(PlaneGeometry 活字物件, MovableTypeWidthInfo 寬度資訊) // { // // TODO // double strokeWidth = getStorkeWidthByCoefficient(活字物件, 寬度資訊.取得活字粗細係數()); // PlaneGeometry boldSurface = getBoldSurface(活字物件, strokeWidth); // return boldSurface; // } /** * 取得合併、調整的精細度 * * @return 合併、調整的精細度 */ public double getPrecision() { return precision; }
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // // Path: src/main/java/cc/stroke/ChineseCharacterTypeBolder.java // public interface ChineseCharacterTypeBolder // { // /** // * 取得筆劃加寬物件 // * // * @param width // * 加寬的寬度 // * @return 筆劃加寬物件 // */ // public Stroke getStroke(double width); // } // // Path: src/main/java/cc/movabletype/PlaneGeometry.java // public class PlaneGeometry extends Area // implements 活字單元 // { // /** // * 活字預計位置及大小 // */ // private Rectangle2D.Double 目標; // // /** // * 建立一個空的活字。 // */ // public PlaneGeometry() // { // 目標 = new Rectangle2D.Double(); // } // // /** // * 建立一個空的活字,並用<code>Rectangle2D</code>指定活字預計位置及大小 // * // * @param 目標 // * 預計位置及大小 // */ // @Deprecated // public PlaneGeometry(Rectangle2D 目標) // { // super(); // 設目標範圍(目標); // } // Path: src/main/java/cc/stroketool/MkeSeparateMovableType_Bolder.java import java.awt.Stroke; import java.util.Vector; import cc.movabletype.SeprateMovabletype; import cc.stroke.ChineseCharacterTypeBolder; import cc.movabletype.PlaneGeometry; { return new MovableTypeWidthInfo(computeBoldCoefficient(活字物件)); } // /** // * 依照寬度資訊,來調整活字物件 // * // * @param 活字物件 // * 要被調整的活字物偉 // * @param 寬度資訊 // * 依據的寬度資訊 // */ // PlaneGeometry 依寬度資訊產生外殼(PlaneGeometry 活字物件, MovableTypeWidthInfo 寬度資訊) // { // // TODO // double strokeWidth = getStorkeWidthByCoefficient(活字物件, 寬度資訊.取得活字粗細係數()); // PlaneGeometry boldSurface = getBoldSurface(活字物件, strokeWidth); // return boldSurface; // } /** * 取得合併、調整的精細度 * * @return 合併、調整的精細度 */ public double getPrecision() { return precision; }
public void 加粗(SeprateMovabletype 活字)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/PasteLeftwardSticking.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 讓第二個活字往左延伸的模組,碰到第一個活字或是邊界即停止。 * * @author Ihc */ public class PasteLeftwardSticking extends PasteFlatpushSticking { /** * 建立左推黏合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public PasteLeftwardSticking(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public double 下限初始值() { return insidePiece.這馬字範圍().getWidth(); } @Override public double 上限初始值() { return outsidePiece.這馬字範圍().getWidth(); } @Override public boolean 活字是否太接近() { return super.活字是否太接近() || outsidePiece.這馬字範圍().getMinX() > temporaryPiece .這馬字範圍().getMinX(); } @Override public void 變形處理(double middleValue) {
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/PasteLeftwardSticking.java import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 讓第二個活字往左延伸的模組,碰到第一個活字或是邊界即停止。 * * @author Ihc */ public class PasteLeftwardSticking extends PasteFlatpushSticking { /** * 建立左推黏合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public PasteLeftwardSticking(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public double 下限初始值() { return insidePiece.這馬字範圍().getWidth(); } @Override public double 上限初始值() { return outsidePiece.這馬字範圍().getWidth(); } @Override public boolean 活字是否太接近() { return super.活字是否太接近() || outsidePiece.這馬字範圍().getMinX() > temporaryPiece .這馬字範圍().getMinX(); } @Override public void 變形處理(double middleValue) {
temporaryPiece = new SeprateMovabletype(insidePiece);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/UpHatAsmmod.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 適用於「⿴」包圍拼合部件,如「⿴冖几」為「冗」,只要是此類拼合,皆用此型態。先將兩活字寬度調整相同,再調依情況縮小下部寬度,進行合併。 * * @author Ihc */ public class UpHatAsmmod extends VerticalAsmmod { /** 下面物件活字要縮小的比例 */ protected double insideShrinkRate; /** * 建立上蓋拼合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public UpHatAsmmod(MergePieceAdjuster 調整工具) { super(調整工具); } @Override
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/UpHatAsmmod.java import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 適用於「⿴」包圍拼合部件,如「⿴冖几」為「冗」,只要是此類拼合,皆用此型態。先將兩活字寬度調整相同,再調依情況縮小下部寬度,進行合併。 * * @author Ihc */ public class UpHatAsmmod extends VerticalAsmmod { /** 下面物件活字要縮小的比例 */ protected double insideShrinkRate; /** * 建立上蓋拼合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public UpHatAsmmod(MergePieceAdjuster 調整工具) { super(調整工具); } @Override
public void 初始化(SeprateMovabletype[] rectangularAreas)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/HorizontalAsmmod.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 適用於「⿱」垂直拼合部件,如「⿱將水」為「漿」,只要是垂直拼合,皆用此型態。先將兩活字高度調整相同,再進行合併。 * * @author Ihc */ public class HorizontalAsmmod extends FlatSurAsmmod { /** 左邊的物件活字 */
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/HorizontalAsmmod.java import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 適用於「⿱」垂直拼合部件,如「⿱將水」為「漿」,只要是垂直拼合,皆用此型態。先將兩活字高度調整相同,再進行合併。 * * @author Ihc */ public class HorizontalAsmmod extends FlatSurAsmmod { /** 左邊的物件活字 */
protected SeprateMovabletype leftPiece;
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/PasteDownwardSticking.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 讓第二個活字往下延伸的模組,碰到第一個活字或是邊界即停止。 * * @author Ihc */ public class PasteDownwardSticking extends PasteFlatpushSticking { /** * 建立下推黏合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public PasteDownwardSticking(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public double 下限初始值() { return insidePiece.這馬字範圍().getHeight(); } @Override public double 上限初始值() { return outsidePiece.這馬字範圍().getHeight(); } @Override public boolean 活字是否太接近() { return super.活字是否太接近() || outsidePiece.這馬字範圍().getMaxY() < temporaryPiece .這馬字範圍().getMaxY(); } @Override public void 變形處理(double middleValue) {
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/PasteDownwardSticking.java import java.awt.geom.AffineTransform; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 讓第二個活字往下延伸的模組,碰到第一個活字或是邊界即停止。 * * @author Ihc */ public class PasteDownwardSticking extends PasteFlatpushSticking { /** * 建立下推黏合模組 * * @param 調整工具 * 使用此模組的調整工具,並使用其自身合併相關函式 */ public PasteDownwardSticking(MergePieceAdjuster 調整工具) { super(調整工具); } @Override public double 下限初始值() { return insidePiece.這馬字範圍().getHeight(); } @Override public double 上限初始值() { return outsidePiece.這馬字範圍().getHeight(); } @Override public boolean 活字是否太接近() { return super.活字是否太接近() || outsidePiece.這馬字範圍().getMaxY() < temporaryPiece .這馬字範圍().getMaxY(); } @Override public void 變形處理(double middleValue) {
temporaryPiece = new SeprateMovabletype(insidePiece);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/idsrend/charcomponent/CharComponent.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype;
package idsrend.charcomponent; /** * 儲存漢字部件樹狀結構。「獨體為文,合體為字」,樹狀結構中的葉子為文,其他上層節點為字。 <code>ChineseCharacter</code>為 * <code>ChineseCharacterWen</code>及<code>ChineseCharacterTzu</code> * 的共用介面,方便以後活字的產生。 * * @author Ihc */ public abstract class CharComponent { public abstract boolean 是文部件(); public abstract boolean 是字部件(); /** * 取得部件的字串形態 * * @return 部件字串形態 */ public String 部件組字式() { return new String(Character.toChars(Unicode編號())); } /** * 取得部件Unicode編碼 * * @return 部件Unicode編碼 */ public abstract int Unicode編號(); /** * 提到這个部件下跤的組字式。 * * @return 這个物件下跤的組字式 */ public abstract String 樹狀結構組字式(); /** * 以此部件結構產生活字結構。用<code>ChineseCharacterTypeSetter</code> * (活字設定工具)來轉換成ChineseCharacterMovableType(活字)。 * * @param chineseCharacterTypeSetter * 欲採用的活字設定工具 * @param parent * 此活字結構的上層活字 * @return 產生出來的活字結構 */ public abstract ChineseCharCompositeMoveabletype typeset(
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // } // Path: src/main/java/idsrend/charcomponent/CharComponent.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype; package idsrend.charcomponent; /** * 儲存漢字部件樹狀結構。「獨體為文,合體為字」,樹狀結構中的葉子為文,其他上層節點為字。 <code>ChineseCharacter</code>為 * <code>ChineseCharacterWen</code>及<code>ChineseCharacterTzu</code> * 的共用介面,方便以後活字的產生。 * * @author Ihc */ public abstract class CharComponent { public abstract boolean 是文部件(); public abstract boolean 是字部件(); /** * 取得部件的字串形態 * * @return 部件字串形態 */ public String 部件組字式() { return new String(Character.toChars(Unicode編號())); } /** * 取得部件Unicode編碼 * * @return 部件Unicode編碼 */ public abstract int Unicode編號(); /** * 提到這个部件下跤的組字式。 * * @return 這个物件下跤的組字式 */ public abstract String 樹狀結構組字式(); /** * 以此部件結構產生活字結構。用<code>ChineseCharacterTypeSetter</code> * (活字設定工具)來轉換成ChineseCharacterMovableType(活字)。 * * @param chineseCharacterTypeSetter * 欲採用的活字設定工具 * @param parent * 此活字結構的上層活字 * @return 產生出來的活字結構 */ public abstract ChineseCharCompositeMoveabletype typeset(
ChineseCharacterTypeSetter chineseCharacterTypeSetter,
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/idsrend/charcomponent/CharComponent.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype;
package idsrend.charcomponent; /** * 儲存漢字部件樹狀結構。「獨體為文,合體為字」,樹狀結構中的葉子為文,其他上層節點為字。 <code>ChineseCharacter</code>為 * <code>ChineseCharacterWen</code>及<code>ChineseCharacterTzu</code> * 的共用介面,方便以後活字的產生。 * * @author Ihc */ public abstract class CharComponent { public abstract boolean 是文部件(); public abstract boolean 是字部件(); /** * 取得部件的字串形態 * * @return 部件字串形態 */ public String 部件組字式() { return new String(Character.toChars(Unicode編號())); } /** * 取得部件Unicode編碼 * * @return 部件Unicode編碼 */ public abstract int Unicode編號(); /** * 提到這个部件下跤的組字式。 * * @return 這个物件下跤的組字式 */ public abstract String 樹狀結構組字式(); /** * 以此部件結構產生活字結構。用<code>ChineseCharacterTypeSetter</code> * (活字設定工具)來轉換成ChineseCharacterMovableType(活字)。 * * @param chineseCharacterTypeSetter * 欲採用的活字設定工具 * @param parent * 此活字結構的上層活字 * @return 產生出來的活字結構 */ public abstract ChineseCharCompositeMoveabletype typeset( ChineseCharacterTypeSetter chineseCharacterTypeSetter,
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/char_indexingtool/ChineseCharacterTypeSetter.java // public interface ChineseCharacterTypeSetter // { // /** // * 產生並初使化獨體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterWen // * 要轉化的文(獨體)CharComponent // * @return 獨體活字 // */ // public ChineseCharCompositeMoveabletype setWen(ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen); // // /** // * 產生並初使化合體活字 // * // * @param parent // * 此活字結構的上層活字 // * @param chineseCharacterTzu // * 要轉化的字(合體)CharComponent // * @return 合體活字 // */ // public ChineseCharCompositeMoveabletype setTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu); // } // Path: src/main/java/idsrend/charcomponent/CharComponent.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.char_indexingtool.ChineseCharacterTypeSetter; import cc.movabletype.ChineseCharCompositeMoveabletype; package idsrend.charcomponent; /** * 儲存漢字部件樹狀結構。「獨體為文,合體為字」,樹狀結構中的葉子為文,其他上層節點為字。 <code>ChineseCharacter</code>為 * <code>ChineseCharacterWen</code>及<code>ChineseCharacterTzu</code> * 的共用介面,方便以後活字的產生。 * * @author Ihc */ public abstract class CharComponent { public abstract boolean 是文部件(); public abstract boolean 是字部件(); /** * 取得部件的字串形態 * * @return 部件字串形態 */ public String 部件組字式() { return new String(Character.toChars(Unicode編號())); } /** * 取得部件Unicode編碼 * * @return 部件Unicode編碼 */ public abstract int Unicode編號(); /** * 提到這个部件下跤的組字式。 * * @return 這个物件下跤的組字式 */ public abstract String 樹狀結構組字式(); /** * 以此部件結構產生活字結構。用<code>ChineseCharacterTypeSetter</code> * (活字設定工具)來轉換成ChineseCharacterMovableType(活字)。 * * @param chineseCharacterTypeSetter * 欲採用的活字設定工具 * @param parent * 此活字結構的上層活字 * @return 產生出來的活字結構 */ public abstract ChineseCharCompositeMoveabletype typeset( ChineseCharacterTypeSetter chineseCharacterTypeSetter,
ChineseCharacterMovableTypeTzu parent);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/ZhuyinSpacingMod.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 組合注音模組。一直佮注音活字擲入來,會排做一排。注音之間會一格一格照位排,但是中央的隔較開咧。 * * @author Ihc */ class ZhuyinSpacingMod extends ZhuyinTidyArrangemod { /** 注音符號之間隔偌遠 */ protected double 間隔寬度; /** * 建立一个模組。 * * @param 間隔寬度 * 注音符號之間隔偌遠 */ public ZhuyinSpacingMod(double 間隔寬度) { if (間隔寬度 >= 0.0) this.間隔寬度 = 1.0 + 間隔寬度; else this.間隔寬度 = 1.0; } @Override
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/ZhuyinSpacingMod.java import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 組合注音模組。一直佮注音活字擲入來,會排做一排。注音之間會一格一格照位排,但是中央的隔較開咧。 * * @author Ihc */ class ZhuyinSpacingMod extends ZhuyinTidyArrangemod { /** 注音符號之間隔偌遠 */ protected double 間隔寬度; /** * 建立一个模組。 * * @param 間隔寬度 * 注音符號之間隔偌遠 */ public ZhuyinSpacingMod(double 間隔寬度) { if (間隔寬度 >= 0.0) this.間隔寬度 = 1.0 + 間隔寬度; else this.間隔寬度 = 1.0; } @Override
void 加新的活字(SeprateMovabletype 新活字)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/example/awt/AwtStrokeProblemExample.java
// Path: src/main/java/cc/stroke/NullStroke.java // public class NullStroke implements Stroke // { // @Override // public Shape createStrokedShape(Shape p) // { // return new Area(p); // } // // }
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.font.GlyphVector; import java.awt.geom.Area; import javax.swing.JFrame; import javax.swing.JPanel; import cc.stroke.NullStroke;
package cc.example.awt; /** * 邊角問題重現。 * * @author Ihc */ public class AwtStrokeProblemExample extends JPanel { /** 序列化編號 */ private static final long serialVersionUID = 1L; /** 視窗寬度 */ static final int WIDTH = 1620; /** 視窗高度 */ static final int HEIGHT = 1050; @Override public void paint(Graphics g1) { Graphics2D graphics2D = (Graphics2D) g1; Font f = new Font("全字庫正宋體", Font.BOLD, 700); GlyphVector gv = f.createGlyphVector(graphics2D.getFontRenderContext(), "永森應言木變"); System.out.println(gv.getNumGlyphs()); Area area = new Area(gv.getOutline()); graphics2D.setColor(Color.black); graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.translate(20, 700); for (int i = 10; i >= 0; i -= 2) { Color color=new Color((10-i)*0x151515); graphics2D.setColor(color); graphics2D.setStroke(new BasicStroke(i*10)); graphics2D.draw(area);
// Path: src/main/java/cc/stroke/NullStroke.java // public class NullStroke implements Stroke // { // @Override // public Shape createStrokedShape(Shape p) // { // return new Area(p); // } // // } // Path: src/main/java/cc/example/awt/AwtStrokeProblemExample.java import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.font.GlyphVector; import java.awt.geom.Area; import javax.swing.JFrame; import javax.swing.JPanel; import cc.stroke.NullStroke; package cc.example.awt; /** * 邊角問題重現。 * * @author Ihc */ public class AwtStrokeProblemExample extends JPanel { /** 序列化編號 */ private static final long serialVersionUID = 1L; /** 視窗寬度 */ static final int WIDTH = 1620; /** 視窗高度 */ static final int HEIGHT = 1050; @Override public void paint(Graphics g1) { Graphics2D graphics2D = (Graphics2D) g1; Font f = new Font("全字庫正宋體", Font.BOLD, 700); GlyphVector gv = f.createGlyphVector(graphics2D.getFontRenderContext(), "永森應言木變"); System.out.println(gv.getNumGlyphs()); Area area = new Area(gv.getOutline()); graphics2D.setColor(Color.black); graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.translate(20, 700); for (int i = 10; i >= 0; i -= 2) { Color color=new Color((10-i)*0x151515); graphics2D.setColor(color); graphics2D.setStroke(new BasicStroke(i*10)); graphics2D.draw(area);
graphics2D.setStroke(new NullStroke());
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/ccomponent_adjuster/ExpSequenceLookup_byDB.java
// Path: src/main/java/cc/tool/database/PgsqlConnection.java // public class PgsqlConnection // { // /** 預設資料庫位置 */ // static public final String url = "jdbc:postgresql://localhost/漢字組建?useUnicode=true&characterEncoding=utf-8"; // /** 連線物件 */ // private Connection connection; // /** 連線狀態 */ // private Statement statement; // // /** // * 自動連線到資料庫,資料庫設定唯讀,這个帳號就無修改的權限。 // * // * <pre> // * ALTER DATABASE "漢字組建" set default_transaction_read_only=on; // * </pre> // */ // public PgsqlConnection() // { // this(url, "漢字組建", "ChineseCharacter"); // } // // /** // * 連線到資料庫。 // * // * @param urls // * 資料庫位置 // * @param account // * 資料庫帳號 // * @param passwd // * 資料庫密碼 // */ // public PgsqlConnection(String urls, String account, String passwd) // { // try // { // Class.forName("org.postgresql.Driver"); // } // catch (java.lang.ClassNotFoundException e) // { // System.err.print("ClassNotFoundException: "); // System.err.println(e.getMessage()); // } // try // { // connection = DriverManager.getConnection(urls, account, passwd); // } // catch (SQLException ex) // { // System.err.print("SQLException: "); // System.err.println(ex.getMessage()); // } // return; // } // // /** 關閉連線。 */ // public void close() // { // try // { // connection.close(); // } // catch (SQLException ex) // { // System.err.print("SQLException: "); // System.err.println(ex.getMessage()); // } // return; // } // // /** // * 查詢資料。 // * // * @param query // * 向資料庫提出的要求 // * @return 查詢結果 // * @throws SQLException // * 資料庫錯誤 // */ // public ResultSet executeQuery(String query) throws SQLException // { // statement = connection.createStatement(); // ResultSet rs = statement.executeQuery(query); // // stmt.close(); // return rs; // } // // /** // * 更改資料庫。 // * // * @param query // * 向資料庫提出的更改 // * @throws SQLException // * 資料庫錯誤 // */ // public void executeUpdate(String query) throws SQLException // { // statement = connection.createStatement(); // statement.executeUpdate(query); // statement.close(); // return; // } // }
import java.sql.ResultSet; import java.sql.SQLException; import cc.tool.database.PgsqlConnection;
package cc.ccomponent_adjuster; /** * 連上漢字組建的檢字表,用統一碼控制碼去搜尋展開式。 * * @author Ihc */ public class ExpSequenceLookup_byDB extends ExpSequenceLookup { /** 佮資料庫的連線 */
// Path: src/main/java/cc/tool/database/PgsqlConnection.java // public class PgsqlConnection // { // /** 預設資料庫位置 */ // static public final String url = "jdbc:postgresql://localhost/漢字組建?useUnicode=true&characterEncoding=utf-8"; // /** 連線物件 */ // private Connection connection; // /** 連線狀態 */ // private Statement statement; // // /** // * 自動連線到資料庫,資料庫設定唯讀,這个帳號就無修改的權限。 // * // * <pre> // * ALTER DATABASE "漢字組建" set default_transaction_read_only=on; // * </pre> // */ // public PgsqlConnection() // { // this(url, "漢字組建", "ChineseCharacter"); // } // // /** // * 連線到資料庫。 // * // * @param urls // * 資料庫位置 // * @param account // * 資料庫帳號 // * @param passwd // * 資料庫密碼 // */ // public PgsqlConnection(String urls, String account, String passwd) // { // try // { // Class.forName("org.postgresql.Driver"); // } // catch (java.lang.ClassNotFoundException e) // { // System.err.print("ClassNotFoundException: "); // System.err.println(e.getMessage()); // } // try // { // connection = DriverManager.getConnection(urls, account, passwd); // } // catch (SQLException ex) // { // System.err.print("SQLException: "); // System.err.println(ex.getMessage()); // } // return; // } // // /** 關閉連線。 */ // public void close() // { // try // { // connection.close(); // } // catch (SQLException ex) // { // System.err.print("SQLException: "); // System.err.println(ex.getMessage()); // } // return; // } // // /** // * 查詢資料。 // * // * @param query // * 向資料庫提出的要求 // * @return 查詢結果 // * @throws SQLException // * 資料庫錯誤 // */ // public ResultSet executeQuery(String query) throws SQLException // { // statement = connection.createStatement(); // ResultSet rs = statement.executeQuery(query); // // stmt.close(); // return rs; // } // // /** // * 更改資料庫。 // * // * @param query // * 向資料庫提出的更改 // * @throws SQLException // * 資料庫錯誤 // */ // public void executeUpdate(String query) throws SQLException // { // statement = connection.createStatement(); // statement.executeUpdate(query); // statement.close(); // return; // } // } // Path: src/main/java/cc/ccomponent_adjuster/ExpSequenceLookup_byDB.java import java.sql.ResultSet; import java.sql.SQLException; import cc.tool.database.PgsqlConnection; package cc.ccomponent_adjuster; /** * 連上漢字組建的檢字表,用統一碼控制碼去搜尋展開式。 * * @author Ihc */ public class ExpSequenceLookup_byDB extends ExpSequenceLookup { /** 佮資料庫的連線 */
protected PgsqlConnection 連線;
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/LeftTopSurrounder.java
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 用於左上的包圍部件。從左上方包住,像是「厂」、「广」、「尸」和「『左』的左上方」等等。 * * @author Ihc */ public class LeftTopSurrounder extends ObjMoveableTypeSurronder { /** * 建立左上包圍工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public LeftTopSurrounder(MergePieceAdjuster 調整工具) { super(調整工具); 支援包圍部件.add("厂"); 支援包圍部件.add("广"); 支援包圍部件.add("疒"); 支援包圍部件.add("");//「疒」中研院造字 支援包圍部件.add("尸"); 支援包圍部件.add("戶"); 支援包圍部件.add("户"); 支援包圍部件.add("虍"); 支援包圍部件.add("耂"); 支援包圍部件.add("⺶"); 支援包圍部件.add("厃"); 支援包圍部件.add("屵"); 支援包圍部件.add("龵"); // TODO /*歷廈病居房灰老名虐遞…*/ } @Override
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // // Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/LeftTopSurrounder.java import cc.movabletype.PieceMovableTypeTzu; import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 用於左上的包圍部件。從左上方包住,像是「厂」、「广」、「尸」和「『左』的左上方」等等。 * * @author Ihc */ public class LeftTopSurrounder extends ObjMoveableTypeSurronder { /** * 建立左上包圍工具 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public LeftTopSurrounder(MergePieceAdjuster 調整工具) { super(調整工具); 支援包圍部件.add("厂"); 支援包圍部件.add("广"); 支援包圍部件.add("疒"); 支援包圍部件.add("");//「疒」中研院造字 支援包圍部件.add("尸"); 支援包圍部件.add("戶"); 支援包圍部件.add("户"); 支援包圍部件.add("虍"); 支援包圍部件.add("耂"); 支援包圍部件.add("⺶"); 支援包圍部件.add("厃"); 支援包圍部件.add("屵"); 支援包圍部件.add("龵"); // TODO /*歷廈病居房灰老名虐遞…*/ } @Override
public void 組合(PieceMovableTypeTzu 物件活字)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/tool/database/FontStatusObserver.java
// Path: src/main/java/cc/stroke/NullStroke.java // public class NullStroke implements Stroke // { // @Override // public Shape createStrokedShape(Shape p) // { // return new Area(p); // } // // }
import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.io.File; import java.io.IOException; import javax.swing.JFrame; import cc.example.awt.AwtTestExample; import cc.stroke.NullStroke;
package cc.tool.database; /** * 用來檢視字型裡有哪些字 * * @author Ihc */ public class FontStatusObserver extends AwtTestExample { /** 序列化編號 */ private static final long serialVersionUID = 1L; /** 字型大小 */ static final int TYPE_SIZE = 400; /** 檔案位置 */ String 檔案 = "/home/ihc/utf8/13.ttf"; @Override public void paint(Graphics g1) { try { // System.out.println(Integer.toHexString(Character.codePointAt("",0))); // System.out.println(Character.codePointAt("", 0)); // System.out.println(Integer.toHexString(Character.codePointAt("", 0))); // System.out.println(Character.toChars(0x8503)); Graphics2D graphics2D = (Graphics2D) g1; Font fontㄉ = new Font("Sans", 0, 200); GlyphVector glyphv = fontㄉ.createGlyphVector(new FontRenderContext( new AffineTransform(), java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT, java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT), "HI"); System.out.println("gl=" + glyphv.getNumGlyphs()); graphics2D.translate(getWidth() - TYPE_SIZE * 1.1, TYPE_SIZE); // graphics2D.translate(300, 300);
// Path: src/main/java/cc/stroke/NullStroke.java // public class NullStroke implements Stroke // { // @Override // public Shape createStrokedShape(Shape p) // { // return new Area(p); // } // // } // Path: src/main/java/cc/tool/database/FontStatusObserver.java import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.io.File; import java.io.IOException; import javax.swing.JFrame; import cc.example.awt.AwtTestExample; import cc.stroke.NullStroke; package cc.tool.database; /** * 用來檢視字型裡有哪些字 * * @author Ihc */ public class FontStatusObserver extends AwtTestExample { /** 序列化編號 */ private static final long serialVersionUID = 1L; /** 字型大小 */ static final int TYPE_SIZE = 400; /** 檔案位置 */ String 檔案 = "/home/ihc/utf8/13.ttf"; @Override public void paint(Graphics g1) { try { // System.out.println(Integer.toHexString(Character.codePointAt("",0))); // System.out.println(Character.codePointAt("", 0)); // System.out.println(Integer.toHexString(Character.codePointAt("", 0))); // System.out.println(Character.toChars(0x8503)); Graphics2D graphics2D = (Graphics2D) g1; Font fontㄉ = new Font("Sans", 0, 200); GlyphVector glyphv = fontㄉ.createGlyphVector(new FontRenderContext( new AffineTransform(), java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT, java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT), "HI"); System.out.println("gl=" + glyphv.getNumGlyphs()); graphics2D.translate(getWidth() - TYPE_SIZE * 1.1, TYPE_SIZE); // graphics2D.translate(300, 300);
graphics2D.setStroke(new NullStroke());
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/stroke/UnsharpenStroke.java
// Path: src/main/java/cc/stroketool/PathTravel.java // public class PathTravel // { // /** 循訪路徑動作 */ // private PathAction pathAction; // // /** // * 建立路徑循訪物件。 // * // * @param pathAction // * 反應動作物件 // */ // public PathTravel(PathAction pathAction) // { // this.pathAction = pathAction; // } // // /** // * 循訪路徑。 // * // * @param generalPath // * 欲循訪的路徑 // */ // public void travelOn(GeneralPath generalPath) // { // double[] controlPoint = new double[6]; // for (PathIterator pathIterator = generalPath.getPathIterator(null); !pathIterator // .isDone(); pathIterator.next()) // { // int type = pathIterator.currentSegment(controlPoint); // // switch (type) // { // case PathIterator.SEG_MOVETO: // pathAction.doActionOnMoveTo(controlPoint); // break; // case PathIterator.SEG_LINETO: // pathAction.doActionOnLineTo(controlPoint); // break; // case PathIterator.SEG_QUADTO: // pathAction.doActionOnQuadTo(controlPoint); // break; // case PathIterator.SEG_CUBICTO: // pathAction.doActionOnCubicTo(controlPoint); // break; // case PathIterator.SEG_CLOSE: // pathAction.doActionOnCloseTo(controlPoint); // break; // } // } // } // }
import java.awt.Shape; import java.awt.Stroke; import java.awt.geom.GeneralPath; import cc.stroketool.PathTravel;
package cc.stroke; /** * 圓滑筆劃工具。把銳角或是較尖的角變成二維曲線,減少基本筆劃工具(<code>BasicStroke</code> * )的問題。測試結果仍有不明問題。看二條相鄰筆劃的角度,決定是否改成曲線。 * * @author Ihc */ public class UnsharpenStroke implements Stroke { @Override public Shape createStrokedShape(Shape shape) { return createStrokedShape(new GeneralPath(shape)); } /** * 圓滑該路徑的頂點。 * * @param generalPath * 路徑物件 * @return 圓滑後的結果 */ public Shape createStrokedShape(GeneralPath generalPath) { UnsharpenAction unsharpenAction = new UnsharpenAction( generalPath.getWindingRule());
// Path: src/main/java/cc/stroketool/PathTravel.java // public class PathTravel // { // /** 循訪路徑動作 */ // private PathAction pathAction; // // /** // * 建立路徑循訪物件。 // * // * @param pathAction // * 反應動作物件 // */ // public PathTravel(PathAction pathAction) // { // this.pathAction = pathAction; // } // // /** // * 循訪路徑。 // * // * @param generalPath // * 欲循訪的路徑 // */ // public void travelOn(GeneralPath generalPath) // { // double[] controlPoint = new double[6]; // for (PathIterator pathIterator = generalPath.getPathIterator(null); !pathIterator // .isDone(); pathIterator.next()) // { // int type = pathIterator.currentSegment(controlPoint); // // switch (type) // { // case PathIterator.SEG_MOVETO: // pathAction.doActionOnMoveTo(controlPoint); // break; // case PathIterator.SEG_LINETO: // pathAction.doActionOnLineTo(controlPoint); // break; // case PathIterator.SEG_QUADTO: // pathAction.doActionOnQuadTo(controlPoint); // break; // case PathIterator.SEG_CUBICTO: // pathAction.doActionOnCubicTo(controlPoint); // break; // case PathIterator.SEG_CLOSE: // pathAction.doActionOnCloseTo(controlPoint); // break; // } // } // } // } // Path: src/main/java/cc/stroke/UnsharpenStroke.java import java.awt.Shape; import java.awt.Stroke; import java.awt.geom.GeneralPath; import cc.stroketool.PathTravel; package cc.stroke; /** * 圓滑筆劃工具。把銳角或是較尖的角變成二維曲線,減少基本筆劃工具(<code>BasicStroke</code> * )的問題。測試結果仍有不明問題。看二條相鄰筆劃的角度,決定是否改成曲線。 * * @author Ihc */ public class UnsharpenStroke implements Stroke { @Override public Shape createStrokedShape(Shape shape) { return createStrokedShape(new GeneralPath(shape)); } /** * 圓滑該路徑的頂點。 * * @param generalPath * 路徑物件 * @return 圓滑後的結果 */ public Shape createStrokedShape(GeneralPath generalPath) { UnsharpenAction unsharpenAction = new UnsharpenAction( generalPath.getWindingRule());
PathTravel pathTravel = new PathTravel(unsharpenAction);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/ChineseCharacterTypeAdjuster.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen;
package cc.layouttools; /** * 活字調整工具。依活字結構(<code>ChineseCharacterMovableType</code>)本身的組合調整大小位置粗細…等等資訊。 * <p> * * @author Ihc */ public interface ChineseCharacterTypeAdjuster { /** * 調整獨體活字 * * @param chineseCharacterMovableTypeWen * 欲調整之獨體活字 */ public void adjustWen(
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // } // Path: src/main/java/cc/layouttools/ChineseCharacterTypeAdjuster.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen; package cc.layouttools; /** * 活字調整工具。依活字結構(<code>ChineseCharacterMovableType</code>)本身的組合調整大小位置粗細…等等資訊。 * <p> * * @author Ihc */ public interface ChineseCharacterTypeAdjuster { /** * 調整獨體活字 * * @param chineseCharacterMovableTypeWen * 欲調整之獨體活字 */ public void adjustWen(
ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/ChineseCharacterTypeAdjuster.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen;
package cc.layouttools; /** * 活字調整工具。依活字結構(<code>ChineseCharacterMovableType</code>)本身的組合調整大小位置粗細…等等資訊。 * <p> * * @author Ihc */ public interface ChineseCharacterTypeAdjuster { /** * 調整獨體活字 * * @param chineseCharacterMovableTypeWen * 欲調整之獨體活字 */ public void adjustWen( ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen); /** * 調整合體活字 * * @param chineseCharacterMovableTypeTzu * 欲調整之合體活字 */ public void adjustTzu(
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // } // Path: src/main/java/cc/layouttools/ChineseCharacterTypeAdjuster.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen; package cc.layouttools; /** * 活字調整工具。依活字結構(<code>ChineseCharacterMovableType</code>)本身的組合調整大小位置粗細…等等資訊。 * <p> * * @author Ihc */ public interface ChineseCharacterTypeAdjuster { /** * 調整獨體活字 * * @param chineseCharacterMovableTypeWen * 欲調整之獨體活字 */ public void adjustWen( ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen); /** * 調整合體活字 * * @param chineseCharacterMovableTypeTzu * 欲調整之合體活字 */ public void adjustTzu(
ChineseCharacterMovableTypeTzu chineseCharacterMovableTypeTzu);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/BisearchPasteSpacingTool.java
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // }
import cc.movabletype.SeprateMovabletype;
package cc.layouttools; /** * 利用二元搜尋來組合兩個活字,最後拉開兩個活字兩個寬度,以利事後調整。 * * @author Ihc */ public class BisearchPasteSpacingTool extends BisearchPasteAssembler { /** 內部活字和外部活字最後的間距 */ protected double 間隔距離; /** * 建立二元搜尋間隔工具 * * @param 間隔距離 * 內部活字和外部活字最後的間距 */ public BisearchPasteSpacingTool(double 間隔距離) { this.間隔距離 = 間隔距離; } @Override
// Path: src/main/java/cc/movabletype/SeprateMovabletype.java // public class SeprateMovabletype // { // /** 目前字體大細,所在 */ // private Vector<PlaneGeometry> 字; // /** 為著保留字體闊,若維護矩陣顛倒愛去顧平移 */ // private Vector<PlaneGeometry> 原本字體; // /** 加粗莫合併的外殼 */ // private Vector<PlaneGeometry> 字外殼; // /** 這馬的範圍,是為著閃避「一字問題」 */ // private Rectangle2D.Double 這馬; // /** 目標範圍,上尾印的時陣愛看印偌大 */ // private Rectangle2D.Double 目標; // // public SeprateMovabletype() // { // 字 = new Vector<PlaneGeometry>(); // 原本字體 = new Vector<PlaneGeometry>(); // 字外殼 = null; // 這馬 = new Rectangle.Double(); // 目標 = new Rectangle.Double(); // } // // public SeprateMovabletype(PlaneGeometry 幾何) // { // this(); // 字.add(幾何); // 原本字體.add(幾何); // 這馬字範圍(); // } // Path: src/main/java/cc/layouttools/BisearchPasteSpacingTool.java import cc.movabletype.SeprateMovabletype; package cc.layouttools; /** * 利用二元搜尋來組合兩個活字,最後拉開兩個活字兩個寬度,以利事後調整。 * * @author Ihc */ public class BisearchPasteSpacingTool extends BisearchPasteAssembler { /** 內部活字和外部活字最後的間距 */ protected double 間隔距離; /** * 建立二元搜尋間隔工具 * * @param 間隔距離 * 內部活字和外部活字最後的間距 */ public BisearchPasteSpacingTool(double 間隔距離) { this.間隔距離 = 間隔距離; } @Override
public void 執行(BisearchPasteAsmMod 模組, SeprateMovabletype[] 活字物件)
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/layouttools/ObjMoveableTypeSurronder.java
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // }
import java.util.Vector; import cc.movabletype.PieceMovableTypeTzu;
package cc.layouttools; /** * 包圍工具基本架構,提供包圍部件相對應的調整工具。 * * @author Ihc */ public abstract class ObjMoveableTypeSurronder { /** 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ protected MergePieceAdjuster 調整工具; /** 支援包圍部件列表 */ protected Vector<String> 支援包圍部件; /** * 建立包圍工具。 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public ObjMoveableTypeSurronder(MergePieceAdjuster 調整工具) { this.調整工具 = 調整工具; this.支援包圍部件 = new Vector<String>(); } /** * 取得此包圍工具支援哪些部件進行組合 * * @return 支援部件的Unicode編碼 */ public int[] 取得支援包圍部件控制碼清單() { int[] 支援包圍部件控制碼清單 = new int[支援包圍部件.size()]; for (int i = 0; i < 支援包圍部件.size(); ++i) { switch (支援包圍部件.elementAt(i).length()) { case 1: case 2: 支援包圍部件控制碼清單[i] = 支援包圍部件.elementAt(i).codePointAt(0); break; default: 支援包圍部件控制碼清單[i] = 0; break; } } return 支援包圍部件控制碼清單; } /** * 用此工具組合合體活字。 * * @param 物件活字 * 合體活字 */
// Path: src/main/java/cc/movabletype/PieceMovableTypeTzu.java // public class PieceMovableTypeTzu extends ChineseCharacterMovableTypeTzu // implements PieceMovableType // { // /** // * 物件活字 // */ // private final SeprateMovabletype rectangularArea; // // /** // * 建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // * @param rectangularArea // * 物件活字 // */ // public PieceMovableTypeTzu(ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu, // SeprateMovabletype rectangularArea) // { // super(parent, chineseCharacterTzu); // this.rectangularArea = rectangularArea; // } // // @Override // public SeprateMovabletype getPiece() // { // return rectangularArea; // } // // /** // * 取得合體活字下各個元件的活字物件 // * // * @return 各個元件的活字物件 // */ // public SeprateMovabletype[] 取得活字物件() // { // SeprateMovabletype[] 活字物件 = new SeprateMovabletype[getChildren().length]; // for (int i = 0; i < getChildren().length; ++i) // 活字物件[i] = new SeprateMovabletype((SeprateMovabletype) // ((PieceMovableType) getChildren()[i]).getPiece()); // return 活字物件; // } // } // Path: src/main/java/cc/layouttools/ObjMoveableTypeSurronder.java import java.util.Vector; import cc.movabletype.PieceMovableTypeTzu; package cc.layouttools; /** * 包圍工具基本架構,提供包圍部件相對應的調整工具。 * * @author Ihc */ public abstract class ObjMoveableTypeSurronder { /** 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ protected MergePieceAdjuster 調整工具; /** 支援包圍部件列表 */ protected Vector<String> 支援包圍部件; /** * 建立包圍工具。 * * @param 調整工具 * 使用此包圍工具的調整工具,並使用其自身合併相關函式 */ public ObjMoveableTypeSurronder(MergePieceAdjuster 調整工具) { this.調整工具 = 調整工具; this.支援包圍部件 = new Vector<String>(); } /** * 取得此包圍工具支援哪些部件進行組合 * * @return 支援部件的Unicode編碼 */ public int[] 取得支援包圍部件控制碼清單() { int[] 支援包圍部件控制碼清單 = new int[支援包圍部件.size()]; for (int i = 0; i < 支援包圍部件.size(); ++i) { switch (支援包圍部件.elementAt(i).length()) { case 1: case 2: 支援包圍部件控制碼清單[i] = 支援包圍部件.elementAt(i).codePointAt(0); break; default: 支援包圍部件控制碼清單[i] = 0; break; } } return 支援包圍部件控制碼清單; } /** * 用此工具組合合體活字。 * * @param 物件活字 * 合體活字 */
public abstract void 組合(PieceMovableTypeTzu 物件活字);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/printtools/ChineseCharacterTypePrinter.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen;
package cc.printtools; /** * 活字列印工具。接收活字結構(<code>ChineseCharacterMovableType</code>),並列印出來。 * * @author Ihc */ public interface ChineseCharacterTypePrinter { /** * 列印獨體活字 * * @param chineseCharacterMovableTypeWen * 獨體活字 */
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // } // Path: src/main/java/cc/printtools/ChineseCharacterTypePrinter.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen; package cc.printtools; /** * 活字列印工具。接收活字結構(<code>ChineseCharacterMovableType</code>),並列印出來。 * * @author Ihc */ public interface ChineseCharacterTypePrinter { /** * 列印獨體活字 * * @param chineseCharacterMovableTypeWen * 獨體活字 */
void printWen(ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen);
sih4sing5hong5/han3_ji7_tsoo1_kian3
src/main/java/cc/printtools/ChineseCharacterTypePrinter.java
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // }
import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen;
package cc.printtools; /** * 活字列印工具。接收活字結構(<code>ChineseCharacterMovableType</code>),並列印出來。 * * @author Ihc */ public interface ChineseCharacterTypePrinter { /** * 列印獨體活字 * * @param chineseCharacterMovableTypeWen * 獨體活字 */ void printWen(ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen); /** * 列印合體活字 * * @param chineseCharacterMovableTypeTzu * 合體活字 */
// Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeTzu.java // public class ChineseCharacterMovableTypeTzu extends ChineseCharacterMovableType // { // // /** // * 底下的各個活字 // */ // protected ChineseCharCompositeMoveabletype[] children; // // /** // * 以<code>ChineseCharacter</code>部件結構建立字活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterTzu // * 字部件結構 // */ // public ChineseCharacterMovableTypeTzu( // ChineseCharacterMovableTypeTzu parent, // FinalCharComponent chineseCharacterTzu) // { // super(parent, chineseCharacterTzu); // int childrenSize = chineseCharacterTzu.CompositionMethods().getNumberOfChildren(); // this.children = new ChineseCharacterMovableType[childrenSize]; // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustTzu(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printTzu(this); // return; // } // // /** // * 取得底下的各個部件 // * // * @return 底下的各個部件 // */ // public ChineseCharCompositeMoveabletype[] getChildren() // { // return children; // } // } // // Path: src/main/java/cc/movabletype/ChineseCharacterMovableTypeWen.java // public class ChineseCharacterMovableTypeWen extends ChineseCharacterMovableType // { // /** // * 以<code>ChineseCharacter</code>部件結構建立文活字結構 // * // * @param parent // * 上一層的活字結構。若上層為樹狀的樹根,傳入null // * @param chineseCharacterWen // * 文部件結構 // */ // public ChineseCharacterMovableTypeWen( // ChineseCharacterMovableTypeTzu parent, // NonFinalCharComponent chineseCharacterWen) // { // super(parent, chineseCharacterWen); // } // // @Override // public void adjust(ChineseCharacterTypeAdjuster adjuster) // { // adjuster.adjustWen(this); // return; // } // // @Override // public void print(ChineseCharacterTypePrinter printer) // { // printer.printWen(this); // return; // } // } // Path: src/main/java/cc/printtools/ChineseCharacterTypePrinter.java import cc.movabletype.ChineseCharacterMovableTypeTzu; import cc.movabletype.ChineseCharacterMovableTypeWen; package cc.printtools; /** * 活字列印工具。接收活字結構(<code>ChineseCharacterMovableType</code>),並列印出來。 * * @author Ihc */ public interface ChineseCharacterTypePrinter { /** * 列印獨體活字 * * @param chineseCharacterMovableTypeWen * 獨體活字 */ void printWen(ChineseCharacterMovableTypeWen chineseCharacterMovableTypeWen); /** * 列印合體活字 * * @param chineseCharacterMovableTypeTzu * 合體活字 */
void printTzu(ChineseCharacterMovableTypeTzu chineseCharacterMovableTypeTzu);