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
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/ZipContentParser.java
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import javax.persistence.EntityManager; import org.apache.commons.collections4.iterators.EnumerationIterator; import org.apache.commons.collections4.iterators.IteratorIterable; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import org.apache.commons.io.IOUtils;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class ZipContentParser extends Files { private final File file; public ZipContentParser(String modConfigName, File file) { super(modConfigName); this.file = file; } protected void handleSingleZipEntry(ZipFile zip, ZipArchiveEntry entry, EntityManager manager) throws IOException { if (entry.isDirectory() || !(entry.getName().contains("/") || entry.getName().contains("\\"))) { return; }
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/ZipContentParser.java import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import javax.persistence.EntityManager; import org.apache.commons.collections4.iterators.EnumerationIterator; import org.apache.commons.collections4.iterators.IteratorIterable; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import org.apache.commons.io.IOUtils; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class ZipContentParser extends Files { private final File file; public ZipContentParser(String modConfigName, File file) { super(modConfigName); this.file = file; } protected void handleSingleZipEntry(ZipFile zip, ZipArchiveEntry entry, EntityManager manager) throws IOException { if (entry.isDirectory() || !(entry.getName().contains("/") || entry.getName().contains("\\"))) { return; }
if (FileExtensions.isPatchable(entry.getName())) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/ZipContentParser.java
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import javax.persistence.EntityManager; import org.apache.commons.collections4.iterators.EnumerationIterator; import org.apache.commons.collections4.iterators.IteratorIterable; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import org.apache.commons.io.IOUtils;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class ZipContentParser extends Files { private final File file; public ZipContentParser(String modConfigName, File file) { super(modConfigName); this.file = file; } protected void handleSingleZipEntry(ZipFile zip, ZipArchiveEntry entry, EntityManager manager) throws IOException { if (entry.isDirectory() || !(entry.getName().contains("/") || entry.getName().contains("\\"))) { return; } if (FileExtensions.isPatchable(entry.getName())) { addToFiles(entry.getName(), IOUtils.toString(zip.getInputStream(entry), "utf-8"), manager); return; } if (FileExtensions.isReplaceable(entry.getName())) { addToFiles(entry.getName(), "", manager); } } @Override
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/ZipContentParser.java import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import javax.persistence.EntityManager; import org.apache.commons.collections4.iterators.EnumerationIterator; import org.apache.commons.collections4.iterators.IteratorIterable; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import org.apache.commons.io.IOUtils; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class ZipContentParser extends Files { private final File file; public ZipContentParser(String modConfigName, File file) { super(modConfigName); this.file = file; } protected void handleSingleZipEntry(ZipFile zip, ZipArchiveEntry entry, EntityManager manager) throws IOException { if (entry.isDirectory() || !(entry.getName().contains("/") || entry.getName().contains("\\"))) { return; } if (FileExtensions.isPatchable(entry.getName())) { addToFiles(entry.getName(), IOUtils.toString(zip.getInputStream(entry), "utf-8"), manager); return; } if (FileExtensions.isReplaceable(entry.getName())) { addToFiles(entry.getName(), "", manager); } } @Override
public List<ProcessTask> handle(EntityManager manager) throws Exception {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process5modcreation/Process5Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; public class Process5Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try {
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process5modcreation/Process5Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; public class Process5Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try {
tasks.add(new CreateMod(new ModLocation()));
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process5modcreation/Process5Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; public class Process5Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try { tasks.add(new CreateMod(new ModLocation()));
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process5modcreation/Process5Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; public class Process5Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try { tasks.add(new CreateMod(new ModLocation()));
} catch (DirectoryNotFoundException ex) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFile.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; class ApplyPatchFile implements ProcessTask { private final long patchId; private final long target; private final LinkedList<Long> next; public ApplyPatchFile(LinkedList<Long> patches, long target) { if(patches.isEmpty()) { throw new IllegalArgumentException("patch list must not be empty"); } this.patchId = patches.poll(); this.target = target; this.next = patches; }
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFile.java import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; class ApplyPatchFile implements ProcessTask { private final long patchId; private final long target; private final LinkedList<Long> next; public ApplyPatchFile(LinkedList<Long> patches, long target) { if(patches.isEmpty()) { throw new IllegalArgumentException("patch list must not be empty"); } this.patchId = patches.poll(); this.target = target; this.next = patches; }
protected void patch(PatchedFile pf, Patch patch) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFile.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; class ApplyPatchFile implements ProcessTask { private final long patchId; private final long target; private final LinkedList<Long> next; public ApplyPatchFile(LinkedList<Long> patches, long target) { if(patches.isEmpty()) { throw new IllegalArgumentException("patch list must not be empty"); } this.patchId = patches.poll(); this.target = target; this.next = patches; }
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFile.java import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; class ApplyPatchFile implements ProcessTask { private final long patchId; private final long target; private final LinkedList<Long> next; public ApplyPatchFile(LinkedList<Long> patches, long target) { if(patches.isEmpty()) { throw new IllegalArgumentException("patch list must not be empty"); } this.patchId = patches.poll(); this.target = target; this.next = patches; }
protected void patch(PatchedFile pf, Patch patch) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/gui/CollisionTableView.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // }
import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.gui; public class CollisionTableView extends ClickableTableView<FileDataRow, FileDataRow> { public CollisionTableView() { super("Name,Patchable,Collisions,Importance".split(",")); } @Override public final void addItems() { super.getItems().clear();
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // Path: src/main/java/de/idrinth/stellaris/modtools/gui/CollisionTableView.java import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.gui; public class CollisionTableView extends ClickableTableView<FileDataRow, FileDataRow> { public CollisionTableView() { super("Name,Patchable,Collisions,Importance".split(",")); } @Override public final void addItems() { super.getItems().clear();
manager.createNamedQuery("patched", PatchedFile.class).getResultList().forEach((mod) -> {
Idrinths-Stellaris-Mods/Mod-Tools
src/test/java/de/idrinth/stellaris/modtools/process/TaskTest.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // }
import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import junit.framework.Assert; import org.junit.Test;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process; public class TaskTest { /** * Test of run method, of class Task. */ @Test public void testRun() { System.out.println("run"); CounterQueue queue = new CounterQueue();
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // } // Path: src/test/java/de/idrinth/stellaris/modtools/process/TaskTest.java import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import junit.framework.Assert; import org.junit.Test; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process; public class TaskTest { /** * Test of run method, of class Task. */ @Test public void testRun() { System.out.println("run"); CounterQueue queue = new CounterQueue();
Task instance = new Task(queue, new CounterProcessTask(0), new PersistenceProvider());
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/FileSystemParser.java
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; import org.apache.commons.io.FileUtils;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class FileSystemParser extends Files { private final File folder; public FileSystemParser(String modConfigName, File folder) { super(modConfigName); this.folder = folder; } @Override protected void addToFiles(String fPath, String content, EntityManager manager) { if (!(fPath.contains("/") || fPath.contains("\\"))) { return; } super.addToFiles(fPath, content, manager); } @Override
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/FileSystemParser.java import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; import org.apache.commons.io.FileUtils; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class FileSystemParser extends Files { private final File folder; public FileSystemParser(String modConfigName, File folder) { super(modConfigName); this.folder = folder; } @Override protected void addToFiles(String fPath, String content, EntityManager manager) { if (!(fPath.contains("/") || fPath.contains("\\"))) { return; } super.addToFiles(fPath, content, manager); } @Override
public List<ProcessTask> handle(EntityManager manager) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/FileSystemParser.java
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; import org.apache.commons.io.FileUtils;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class FileSystemParser extends Files { private final File folder; public FileSystemParser(String modConfigName, File folder) { super(modConfigName); this.folder = folder; } @Override protected void addToFiles(String fPath, String content, EntityManager manager) { if (!(fPath.contains("/") || fPath.contains("\\"))) { return; } super.addToFiles(fPath, content, manager); } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } int pathLength = folder.getAbsolutePath().length();
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/FileSystemParser.java import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.io.File; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; import org.apache.commons.io.FileUtils; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; class FileSystemParser extends Files { private final File folder; public FileSystemParser(String modConfigName, File folder) { super(modConfigName); this.folder = folder; } @Override protected void addToFiles(String fPath, String content, EntityManager manager) { if (!(fPath.contains("/") || fPath.contains("\\"))) { return; } super.addToFiles(fPath, content, manager); } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } int pathLength = folder.getAbsolutePath().length();
FileUtils.listFiles(folder, FileExtensions.getPatchable(), true).forEach((file) -> {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try {
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try {
SteamLocation sloc = new SteamLocation();
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try { SteamLocation sloc = new SteamLocation();
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try { SteamLocation sloc = new SteamLocation();
persistence.get().createNamedQuery("patch.any", Patch.class).getResultList().forEach((o) -> {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try { SteamLocation sloc = new SteamLocation(); persistence.get().createNamedQuery("patch.any", Patch.class).getResultList().forEach((o) -> { tasks.add(new OriginalFileFiller(o.getAid(),sloc)); });
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java // public class SteamLocation implements FileSystemLocation { // private final File directory; // // public SteamLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getSteamDir(); // } catch (RegistryException | IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.filesystem.SteamLocation; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.process.DataInitializer; import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer { private final PersistenceProvider persistence; public Process3Initializer(PersistenceProvider persistence) { this.persistence = persistence; } @Override protected void init() { try { SteamLocation sloc = new SteamLocation(); persistence.get().createNamedQuery("patch.any", Patch.class).getResultList().forEach((o) -> { tasks.add(new OriginalFileFiller(o.getAid(),sloc)); });
} catch (DirectoryNotFoundException ex) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process/Task.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // }
import de.idrinth.stellaris.modtools.persistence.PersistenceProvider;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process; class Task implements Runnable { protected final ProcessHandlingQueue queue; private final ProcessTask task;
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java // public class PersistenceProvider { // // private final EntityManagerFactory entityManager; // // public EntityManager get() { // return entityManager.createEntityManager(); // } // // public PersistenceProvider() { // entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools"); // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process/Task.java import de.idrinth.stellaris.modtools.persistence.PersistenceProvider; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process; class Task implements Runnable { protected final ProcessHandlingQueue queue; private final ProcessTask task;
private final PersistenceProvider persistence;
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/Process1Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; public class Process1Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try {
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/Process1Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; public class Process1Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try {
ModLocation mloc = new ModLocation();
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process1datacollection/Process1Initializer.java
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // }
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; public class Process1Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try { ModLocation mloc = new ModLocation(); for (File mod : mloc.get().listFiles(new FileExtFilter("mod"))) { tasks.add(new ConfigParser(mod, mloc)); }
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java // public class DirectoryNotFoundException extends IOException { // // public DirectoryNotFoundException(String string, Throwable thrwbl) { // super(string, thrwbl); // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java // abstract public class AbstractQueueInitializer implements DataInitializer { // private boolean isInitialized = false; // protected final LinkedList<ProcessTask> tasks = new LinkedList<>(); // // abstract protected void init(); // // private void initOnce() { // if(isInitialized) { // return; // } // isInitialized = true; // init(); // } // // @Override // public final ProcessTask poll() { // initOnce(); // return tasks.poll(); // } // // @Override // public final boolean hasNext() { // initOnce(); // return !tasks.isEmpty(); // } // // @Override // public int getQueueSize() { // return 20; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/ModLocation.java // public class ModLocation implements FileSystemLocation { // private final File directory; // // public ModLocation() throws DirectoryNotFoundException { // try { // this.directory = DirectoryLookup.getModDir(); // } catch (IOException ex) { // throw new DirectoryNotFoundException("Steam Directory not avaible",ex); // } // } // // @Override // public File get() { // return directory; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java // public interface DataInitializer { // ProcessTask poll(); // boolean hasNext(); // int getQueueSize(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/Process1Initializer.java import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException; import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer; import de.idrinth.stellaris.modtools.filesystem.ModLocation; import de.idrinth.stellaris.modtools.process.DataInitializer; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process1datacollection; public class Process1Initializer extends AbstractQueueInitializer implements DataInitializer { @Override protected void init() { try { ModLocation mloc = new ModLocation(); for (File mod : mloc.get().listFiles(new FileExtFilter("mod"))) { tasks.add(new ConfigParser(mod, mloc)); }
} catch (DirectoryNotFoundException ex) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatch.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; class GenerateFilePatch implements ProcessTask { private final long id; public GenerateFilePatch(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); }
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatch.java import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; class GenerateFilePatch implements ProcessTask { private final long id; public GenerateFilePatch(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); }
Patch patch = (Patch) manager.find(Patch.class, id);
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatch.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // }
import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; class GenerateFilePatch implements ProcessTask { private final long id; public GenerateFilePatch(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } Patch patch = (Patch) manager.find(Patch.class, id);
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java // @NamedQueries({ // @NamedQuery( // name = "patch.any", // query = "select f from Patch f" // ) // }) // @Entity // public class Patch extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @ManyToOne(fetch = FetchType.LAZY) // protected Modification mod; // @ManyToOne(fetch = FetchType.LAZY) // protected Original file; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText diff; // // public Patch() { // } // // public Patch(Modification mod, Original file) { // setMod(mod); // setFile(file); // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Modification getMod() { // return mod; // } // // public final void setMod(Modification mod) { // mod.getPatches().add(this); // this.mod = mod; // } // // public Original getFile() { // return file; // } // // public final void setFile(Original file) { // file.getPatches().add(this); // this.file = file; // } // // public String getDiff() { // return diff.getText(); // } // // public void setDiff(String diff) { // if(null == this.diff) { // this.diff = new LazyText(); // } // this.diff.setText(diff); // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileExtensions.java // public class FileExtensions { // // private static final String[] PATCH = "txt,yml,asset,csv,gfx,shader,fxh,gui".split(","); // private static final String[] REPLACE = "wav,ogg,ods,dds,bmp,png,psd,jpg,ani,cur,ttf,fnt,tga,otf,anim,mesh".split(","); // // private FileExtensions() { // //this is a static class only // } // // public static boolean isPatchable(String filename) { // return isInList(PATCH, filename); // } // // public static boolean isReplaceable(String filename) { // return isInList(REPLACE, filename); // } // // public static String[] getPatchable() { // return PATCH; // } // // public static String[] getReplaceable() { // return REPLACE; // } // // private static boolean isInList(String[] list, String filename) { // for (String ext : list) { // if (filename.endsWith("."+ext)) { // return true; // } // } // return false; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatch.java import com.sksamuel.diffpatch.DiffMatchPatch; import de.idrinth.stellaris.modtools.persistence.entity.Patch; import de.idrinth.stellaris.modtools.process.ProcessTask; import de.idrinth.stellaris.modtools.filesystem.FileExtensions; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; class GenerateFilePatch implements ProcessTask { private final long id; public GenerateFilePatch(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } Patch patch = (Patch) manager.find(Patch.class, id);
if (FileExtensions.isPatchable(patch.getFile().getRelativePath())) {
Idrinths-Stellaris-Mods/Mod-Tools
src/test/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFileTest.java
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.LinkedList;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; public class ApplyPatchFileTest extends TestAnyTask { @Override
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/test/java/de/idrinth/stellaris/modtools/process4applypatch/ApplyPatchFileTest.java import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.LinkedList; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; public class ApplyPatchFileTest extends TestAnyTask { @Override
protected ProcessTask get() {
Idrinths-Stellaris-Mods/Mod-Tools
src/test/java/de/idrinth/stellaris/modtools/process4applypatch/PatchFileTest.java
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; public class PatchFileTest extends TestAnyTask{ @Override
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/test/java/de/idrinth/stellaris/modtools/process4applypatch/PatchFileTest.java import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process4applypatch; public class PatchFileTest extends TestAnyTask{ @Override
protected ProcessTask get() {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/gui/ModTableView.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Modification.java // @NamedQueries({ // @NamedQuery( // name = "modifications", // query = "select m from Modification m" // ) // , // @NamedQuery( // name = "modifications.id", // query = "select m from Modification m where m.id=:id" // ) // , // @NamedQuery( // name = "modifications.config", // query = "select m from Modification m where m.configPath=:configPath" // ) // }) // @Entity // public class Modification extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // //basics // protected String configPath; // protected int id; // protected String name; // protected String version; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText description; // //connection // @OneToMany(fetch = FetchType.LAZY, mappedBy="mod") // protected Set<Patch> patches = new HashSet<>(); // @ManyToMany(fetch = FetchType.LAZY) // protected Set<Modification> overwrite = new HashSet<>(); // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.ALL}) // protected Colliding collides = new Colliding(); // // public Modification() { // } // // public Modification(String configPath, int id) { // this.configPath = configPath; // this.id = id; // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Set<Patch> getFiles() { // return patches; // } // // public void setFiles(Set<Patch> files) { // this.patches = files; // } // // public Colliding getCollides() { // return collides; // } // // public void setCollides(Colliding collides) { // this.collides = collides; // } // // public String getName() { // return name; // } // // public String getConfigPath() { // return configPath; // } // // public void setConfigPath(String configPath) { // this.configPath = configPath; // } // // public void setName(String name) { // this.name = name; // } // // public String getVersion() { // return version; // } // // public void setVersion(String version) { // this.version = version; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public Set<Modification> getOverwrite() { // return overwrite; // } // // public void setOverwrite(Set<Modification> overwrite) { // this.overwrite = overwrite; // } // // public String getDescription() { // if(null == description) { // description = new LazyText(); // } // return description.getText(); // } // // public void setDescription(String description) { // if(null == this.description) { // this.description = new LazyText(); // } // this.description.setText(description); // } // // public Set<Patch> getPatches() { // return patches; // } // // public void setPatches(Set<Patch> files) { // this.patches = files; // } // }
import de.idrinth.stellaris.modtools.persistence.entity.Modification;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.gui; public class ModTableView extends ClickableTableView<ModDataRow, ModDataRow> { public ModTableView() { super("Id,Name,Version,Missing,Collisions".split(",")); } @Override public final void addItems() { super.getItems().clear();
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Modification.java // @NamedQueries({ // @NamedQuery( // name = "modifications", // query = "select m from Modification m" // ) // , // @NamedQuery( // name = "modifications.id", // query = "select m from Modification m where m.id=:id" // ) // , // @NamedQuery( // name = "modifications.config", // query = "select m from Modification m where m.configPath=:configPath" // ) // }) // @Entity // public class Modification extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // //basics // protected String configPath; // protected int id; // protected String name; // protected String version; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText description; // //connection // @OneToMany(fetch = FetchType.LAZY, mappedBy="mod") // protected Set<Patch> patches = new HashSet<>(); // @ManyToMany(fetch = FetchType.LAZY) // protected Set<Modification> overwrite = new HashSet<>(); // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.ALL}) // protected Colliding collides = new Colliding(); // // public Modification() { // } // // public Modification(String configPath, int id) { // this.configPath = configPath; // this.id = id; // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public Set<Patch> getFiles() { // return patches; // } // // public void setFiles(Set<Patch> files) { // this.patches = files; // } // // public Colliding getCollides() { // return collides; // } // // public void setCollides(Colliding collides) { // this.collides = collides; // } // // public String getName() { // return name; // } // // public String getConfigPath() { // return configPath; // } // // public void setConfigPath(String configPath) { // this.configPath = configPath; // } // // public void setName(String name) { // this.name = name; // } // // public String getVersion() { // return version; // } // // public void setVersion(String version) { // this.version = version; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public Set<Modification> getOverwrite() { // return overwrite; // } // // public void setOverwrite(Set<Modification> overwrite) { // this.overwrite = overwrite; // } // // public String getDescription() { // if(null == description) { // description = new LazyText(); // } // return description.getText(); // } // // public void setDescription(String description) { // if(null == this.description) { // this.description = new LazyText(); // } // this.description.setText(description); // } // // public Set<Patch> getPatches() { // return patches; // } // // public void setPatches(Set<Patch> files) { // this.patches = files; // } // } // Path: src/main/java/de/idrinth/stellaris/modtools/gui/ModTableView.java import de.idrinth.stellaris.modtools.persistence.entity.Modification; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.gui; public class ModTableView extends ClickableTableView<ModDataRow, ModDataRow> { public ModTableView() { super("Id,Name,Version,Missing,Collisions".split(",")); } @Override public final void addItems() { super.getItems().clear();
manager.createNamedQuery("modifications", Modification.class).getResultList().forEach((mod) -> {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process2prepatchcleaning/RemoveSingleUseFiles.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Original.java // @NamedQueries({ // @NamedQuery( // name = "originals", // query = "select f from Original f" // ) // , // @NamedQuery( // name = "original.path", // query = "select f from Original f where f.relativePath=:path" // ) // }) // @Entity // public class Original extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // //original // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // protected String relativePath; // //connection // @OneToMany(fetch = FetchType.LAZY, mappedBy="file") // @Cascade({CascadeType.DELETE}) // protected Set<Patch> patches = new HashSet<>(); // // public Original() { // } // // public Original(String relativePath) { // this.relativePath = relativePath; // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public String getRelativePath() { // return relativePath; // } // // public void setRelativePath(String relativePath) { // this.relativePath = relativePath; // } // // public Set<Patch> getPatches() { // return patches; // } // // public void setPatches(Set<Patch> patches) { // this.patches = patches; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import de.idrinth.stellaris.modtools.persistence.entity.Original; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process2prepatchcleaning; public class RemoveSingleUseFiles implements ProcessTask { private final long id; public RemoveSingleUseFiles(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } ArrayList<ProcessTask> ll = new ArrayList<>();
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Original.java // @NamedQueries({ // @NamedQuery( // name = "originals", // query = "select f from Original f" // ) // , // @NamedQuery( // name = "original.path", // query = "select f from Original f where f.relativePath=:path" // ) // }) // @Entity // public class Original extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // //original // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // protected String relativePath; // //connection // @OneToMany(fetch = FetchType.LAZY, mappedBy="file") // @Cascade({CascadeType.DELETE}) // protected Set<Patch> patches = new HashSet<>(); // // public Original() { // } // // public Original(String relativePath) { // this.relativePath = relativePath; // } // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public String getRelativePath() { // return relativePath; // } // // public void setRelativePath(String relativePath) { // this.relativePath = relativePath; // } // // public Set<Patch> getPatches() { // return patches; // } // // public void setPatches(Set<Patch> patches) { // this.patches = patches; // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process2prepatchcleaning/RemoveSingleUseFiles.java import de.idrinth.stellaris.modtools.persistence.entity.Original; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process2prepatchcleaning; public class RemoveSingleUseFiles implements ProcessTask { private final long id; public RemoveSingleUseFiles(long id) { this.id = id; } @Override public List<ProcessTask> handle(EntityManager manager) { if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); } ArrayList<ProcessTask> ll = new ArrayList<>();
Original original = (Original) manager.find(Original.class, id);
Idrinths-Stellaris-Mods/Mod-Tools
src/test/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatchTest.java
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class GenerateFilePatchTest extends TestAnyTask { @Override
// Path: src/test/java/de/idrinth/stellaris/modtools/abstract_cases/TestAnyTask.java // abstract public class TestAnyTask extends TestATask { // // // /** // * Test of handle method, of class Task. // * @deprecated has to be implemented on a case by case basis // */ // @Test // public void testHandle() { // System.out.println("fake handle test"); // Assert.assertTrue(true);//@todo implement the requirements for all tasks // } // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/test/java/de/idrinth/stellaris/modtools/process3filepatch/GenerateFilePatchTest.java import de.idrinth.stellaris.modtools.abstract_cases.TestAnyTask; import de.idrinth.stellaris.modtools.process.ProcessTask; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process3filepatch; public class GenerateFilePatchTest extends TestAnyTask { @Override
protected ProcessTask get() {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process5modcreation/CreateMod.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java // public interface FileSystemLocation { // public File get(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.FileUtils; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; class CreateMod implements ProcessTask { private final Mod mod; private final String id;
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java // public interface FileSystemLocation { // public File get(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process5modcreation/CreateMod.java import org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.FileUtils; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; class CreateMod implements ProcessTask { private final Mod mod; private final String id;
public CreateMod(FileSystemLocation modDir) {
Idrinths-Stellaris-Mods/Mod-Tools
src/main/java/de/idrinth/stellaris/modtools/process5modcreation/CreateMod.java
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java // public interface FileSystemLocation { // public File get(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // }
import org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.FileUtils; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager;
/* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; class CreateMod implements ProcessTask { private final Mod mod; private final String id; public CreateMod(FileSystemLocation modDir) { id = convertBase10To62(LocalDateTime.now().format(DateTimeFormatter.ofPattern("YYYYMMddHHmmss"))); mod = new Mod("idrinths-auto-patch_" + id, "!!!Automatic Patch " + id, modDir); } private String convertBase10To62(String input) { Long b10 = Long.parseLong(input, 10); StringBuilder ret = new StringBuilder(); String characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; while (b10 > 0) { ret.append(characters.charAt((int) (b10 % 62))); b10 /= 62; } return ret.reverse().toString(); } private ZipArchiveEntry makeEntry(String lpath) { ZipArchiveEntry entry = new ZipArchiveEntry(lpath); entry.setMethod(ZipArchiveEntry.STORED); return entry; } protected void fill(EntityManager manager) throws IOException { ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator(); if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); }
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/PatchedFile.java // @NamedQueries({ // @NamedQuery( // name = "patched", // query = "select f from PatchedFile f" // ) // , // @NamedQuery( // name = "patched.able", // query = "select f from PatchedFile f where f.patchable=true" // ) // }) // @Entity // public class PatchedFile extends EntityCompareAndHash { // // @Id // @GeneratedValue // private long aid; // @OneToOne(fetch = FetchType.LAZY) // private Original original; // @OneToOne(fetch = FetchType.LAZY) // @Cascade({CascadeType.DELETE,CascadeType.PERSIST}) // private LazyText content; // private int importance; // @ManyToMany(fetch = FetchType.LAZY) // private Set<Modification> modifications = new HashSet<>(); // private boolean patchable; // private boolean patchableExt; // // @Override // public long getAid() { // return aid; // } // // @Override // public void setAid(long aid) { // this.aid = aid; // } // // public boolean isPatchable() { // return patchable; // } // // public void setPatchable(boolean patchable) { // this.patchable = patchable; // } // // public boolean isPatchableExt() { // return patchableExt; // } // // public void setPatchableExt(boolean patchableExt) { // this.patchableExt = patchableExt; // } // // public PatchedFile() { // } // // public PatchedFile(Original original) { // this.original = original; // } // // public Original getOriginal() { // return original; // } // // public void setOriginal(Original original) { // this.original = original; // } // // public String getContent() { // if(null == content) { // content = new LazyText(); // } // return content.getText(); // } // // public void setContent(String content) { // if(null == this.content) { // this.content = new LazyText(); // } // this.content.setText(content); // } // // public Set<Modification> getModifications() { // return modifications; // } // // public void setModifications(Set<Modification> modifications) { // this.modifications = modifications; // } // // public int getImportance() { // return importance; // } // // public void setImportance(int importance) { // this.importance = importance; // } // // } // // Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java // public interface FileSystemLocation { // public File get(); // } // // Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java // public interface ProcessTask { // // List<ProcessTask> handle(EntityManager manager) throws Exception; // String getIdentifier(); // } // Path: src/main/java/de/idrinth/stellaris/modtools/process5modcreation/CreateMod.java import org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.FileUtils; import de.idrinth.stellaris.modtools.persistence.entity.PatchedFile; import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation; import de.idrinth.stellaris.modtools.process.ProcessTask; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManager; /* * Copyright (C) 2017 Björn Büttner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.idrinth.stellaris.modtools.process5modcreation; class CreateMod implements ProcessTask { private final Mod mod; private final String id; public CreateMod(FileSystemLocation modDir) { id = convertBase10To62(LocalDateTime.now().format(DateTimeFormatter.ofPattern("YYYYMMddHHmmss"))); mod = new Mod("idrinths-auto-patch_" + id, "!!!Automatic Patch " + id, modDir); } private String convertBase10To62(String input) { Long b10 = Long.parseLong(input, 10); StringBuilder ret = new StringBuilder(); String characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; while (b10 > 0) { ret.append(characters.charAt((int) (b10 % 62))); b10 /= 62; } return ret.reverse().toString(); } private ZipArchiveEntry makeEntry(String lpath) { ZipArchiveEntry entry = new ZipArchiveEntry(lpath); entry.setMethod(ZipArchiveEntry.STORED); return entry; } protected void fill(EntityManager manager) throws IOException { ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator(); if (!manager.getTransaction().isActive()) { manager.getTransaction().begin(); }
List<PatchedFile> patches = manager
kinow/tap-plugin
src/main/java/org/tap4j/plugin/TapPublisher.java
// Path: src/main/java/org/tap4j/plugin/model/TestSetMap.java // public class TestSetMap implements Serializable { // // private static final long serialVersionUID = 7300386936718557088L; // // private final String fileName; // private final TestSet testSet; // // public TestSetMap( String fileName, TestSet testSet ) // { // this.fileName = fileName; // this.testSet = testSet; // } // // public String getFileName() // { // return this.fileName; // } // // public TestSet getTestSet() // { // return this.testSet; // } // // } // // Path: src/main/java/org/tap4j/plugin/util/Constants.java // public final class Constants { // // public static final String TAP_DIR_NAME = "tap-master-files"; // // }
import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import org.apache.commons.lang.BooleanUtils; import org.kohsuke.stapler.DataBoundConstructor; import org.tap4j.model.Plan; import org.tap4j.model.TestSet; import org.tap4j.plugin.model.TestSetMap; import org.tap4j.plugin.util.Constants; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.Util; import hudson.matrix.MatrixAggregatable; import hudson.matrix.MatrixAggregator; import hudson.matrix.MatrixBuild; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.BuildListener; import hudson.model.Result; import hudson.model.Run; import hudson.model.TaskListener; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepMonitor; import hudson.tasks.Publisher; import hudson.tasks.Recorder; import hudson.tasks.test.TestResultAggregator; import jenkins.tasks.SimpleBuildStep;
public Boolean getPlanRequired() { return planRequired; } public Boolean getVerbose() { return verbose; } public Boolean getFlattenTapResult() { return flattenTapResult; } public Boolean getRemoveYamlIfCorrupted() { return removeYamlIfCorrupted; } public Boolean getSkipIfBuildNotOk() { return skipIfBuildNotOk; } /** * Gets the directory where the plug-in saves its TAP streams before processing them and * displaying in the UI. * <p> * Adapted from JUnit Attachments Plug-in. * * @param build Jenkins build * @return virtual directory (FilePath) */ public static FilePath getReportsDirectory(Run build) {
// Path: src/main/java/org/tap4j/plugin/model/TestSetMap.java // public class TestSetMap implements Serializable { // // private static final long serialVersionUID = 7300386936718557088L; // // private final String fileName; // private final TestSet testSet; // // public TestSetMap( String fileName, TestSet testSet ) // { // this.fileName = fileName; // this.testSet = testSet; // } // // public String getFileName() // { // return this.fileName; // } // // public TestSet getTestSet() // { // return this.testSet; // } // // } // // Path: src/main/java/org/tap4j/plugin/util/Constants.java // public final class Constants { // // public static final String TAP_DIR_NAME = "tap-master-files"; // // } // Path: src/main/java/org/tap4j/plugin/TapPublisher.java import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import org.apache.commons.lang.BooleanUtils; import org.kohsuke.stapler.DataBoundConstructor; import org.tap4j.model.Plan; import org.tap4j.model.TestSet; import org.tap4j.plugin.model.TestSetMap; import org.tap4j.plugin.util.Constants; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.Util; import hudson.matrix.MatrixAggregatable; import hudson.matrix.MatrixAggregator; import hudson.matrix.MatrixBuild; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.BuildListener; import hudson.model.Result; import hudson.model.Run; import hudson.model.TaskListener; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepMonitor; import hudson.tasks.Publisher; import hudson.tasks.Recorder; import hudson.tasks.test.TestResultAggregator; import jenkins.tasks.SimpleBuildStep; public Boolean getPlanRequired() { return planRequired; } public Boolean getVerbose() { return verbose; } public Boolean getFlattenTapResult() { return flattenTapResult; } public Boolean getRemoveYamlIfCorrupted() { return removeYamlIfCorrupted; } public Boolean getSkipIfBuildNotOk() { return skipIfBuildNotOk; } /** * Gets the directory where the plug-in saves its TAP streams before processing them and * displaying in the UI. * <p> * Adapted from JUnit Attachments Plug-in. * * @param build Jenkins build * @return virtual directory (FilePath) */ public static FilePath getReportsDirectory(Run build) {
return new FilePath(new File(build.getRootDir().getAbsolutePath())).child(Constants.TAP_DIR_NAME);
kinow/tap-plugin
src/main/java/org/tap4j/plugin/TapPublisher.java
// Path: src/main/java/org/tap4j/plugin/model/TestSetMap.java // public class TestSetMap implements Serializable { // // private static final long serialVersionUID = 7300386936718557088L; // // private final String fileName; // private final TestSet testSet; // // public TestSetMap( String fileName, TestSet testSet ) // { // this.fileName = fileName; // this.testSet = testSet; // } // // public String getFileName() // { // return this.fileName; // } // // public TestSet getTestSet() // { // return this.testSet; // } // // } // // Path: src/main/java/org/tap4j/plugin/util/Constants.java // public final class Constants { // // public static final String TAP_DIR_NAME = "tap-master-files"; // // }
import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import org.apache.commons.lang.BooleanUtils; import org.kohsuke.stapler.DataBoundConstructor; import org.tap4j.model.Plan; import org.tap4j.model.TestSet; import org.tap4j.plugin.model.TestSetMap; import org.tap4j.plugin.util.Constants; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.Util; import hudson.matrix.MatrixAggregatable; import hudson.matrix.MatrixAggregator; import hudson.matrix.MatrixBuild; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.BuildListener; import hudson.model.Result; import hudson.model.Run; import hudson.model.TaskListener; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepMonitor; import hudson.tasks.Publisher; import hudson.tasks.Recorder; import hudson.tasks.test.TestResultAggregator; import jenkins.tasks.SimpleBuildStep;
return Boolean.TRUE; } /** * Return {@code true} if the build is ongoing, if the user did not ask to fail when * failed, or otherwise if the build result is not better or equal to unstable. * @param build Run * @return whether to perform the publisher or not, based on user provided configuration */ private boolean isPerformPublisher(Run<?, ?> build) { Result result = build.getResult(); // may be null if build is ongoing if (result == null) { return true; } if (!getSkipIfBuildNotOk()) { return true; } return result.isBetterOrEqualTo(Result.UNSTABLE); } /** * Iterates through the list of test sets and validates its plans and * test results. * * @param testSets * @return <true> if there are any test case that doesn't follow the plan */
// Path: src/main/java/org/tap4j/plugin/model/TestSetMap.java // public class TestSetMap implements Serializable { // // private static final long serialVersionUID = 7300386936718557088L; // // private final String fileName; // private final TestSet testSet; // // public TestSetMap( String fileName, TestSet testSet ) // { // this.fileName = fileName; // this.testSet = testSet; // } // // public String getFileName() // { // return this.fileName; // } // // public TestSet getTestSet() // { // return this.testSet; // } // // } // // Path: src/main/java/org/tap4j/plugin/util/Constants.java // public final class Constants { // // public static final String TAP_DIR_NAME = "tap-master-files"; // // } // Path: src/main/java/org/tap4j/plugin/TapPublisher.java import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import org.apache.commons.lang.BooleanUtils; import org.kohsuke.stapler.DataBoundConstructor; import org.tap4j.model.Plan; import org.tap4j.model.TestSet; import org.tap4j.plugin.model.TestSetMap; import org.tap4j.plugin.util.Constants; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.Util; import hudson.matrix.MatrixAggregatable; import hudson.matrix.MatrixAggregator; import hudson.matrix.MatrixBuild; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.BuildListener; import hudson.model.Result; import hudson.model.Run; import hudson.model.TaskListener; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepMonitor; import hudson.tasks.Publisher; import hudson.tasks.Recorder; import hudson.tasks.test.TestResultAggregator; import jenkins.tasks.SimpleBuildStep; return Boolean.TRUE; } /** * Return {@code true} if the build is ongoing, if the user did not ask to fail when * failed, or otherwise if the build result is not better or equal to unstable. * @param build Run * @return whether to perform the publisher or not, based on user provided configuration */ private boolean isPerformPublisher(Run<?, ?> build) { Result result = build.getResult(); // may be null if build is ongoing if (result == null) { return true; } if (!getSkipIfBuildNotOk()) { return true; } return result.isBetterOrEqualTo(Result.UNSTABLE); } /** * Iterates through the list of test sets and validates its plans and * test results. * * @param testSets * @return <true> if there are any test case that doesn't follow the plan */
private boolean validateNumberOfTests(List<TestSetMap> testSets) {
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/DataSet.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // }
import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.Set; import com.oculusinfo.ml.feature.Feature; import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap;
// create n folds for (int i=0; i < n; i++) { DataSet fold = new DataSet(); folds.add(fold); int start = i*sliceSize; int end = start + sliceSize; for (int j=start; j < end; j++) { fold.add(instances[j]); } } // evenly distribute any extra instances for (int i=0; i < extra; i++) { int offset = instances.length - extra + i; folds.get(i).add(instances[offset]); } return folds; } /*** * Normalize the specified Feature for all Instances in this DataSet. * * Currently only NumericVectorFeature types are supported. * * @param featureName the name of the feature to normalize */ public void normalizeInstanceFeature(String featureName) {
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/DataSet.java import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.Set; import com.oculusinfo.ml.feature.Feature; import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; // create n folds for (int i=0; i < n; i++) { DataSet fold = new DataSet(); folds.add(fold); int start = i*sliceSize; int end = start + sliceSize; for (int j=start; j < end; j++) { fold.add(instances[j]); } } // evenly distribute any extra instances for (int i=0; i < extra; i++) { int offset = instances.length - extra + i; folds.get(i).add(instances[offset]); } return folds; } /*** * Normalize the specified Feature for all Instances in this DataSet. * * Currently only NumericVectorFeature types are supported. * * @param featureName the name of the feature to normalize */ public void normalizeInstanceFeature(String featureName) {
List<Feature> allFeatures = new ArrayList<Feature>();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/DataSet.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // }
import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.Set; import com.oculusinfo.ml.feature.Feature; import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap;
for (int i=0; i < extra; i++) { int offset = instances.length - extra + i; folds.get(i).add(instances[offset]); } return folds; } /*** * Normalize the specified Feature for all Instances in this DataSet. * * Currently only NumericVectorFeature types are supported. * * @param featureName the name of the feature to normalize */ public void normalizeInstanceFeature(String featureName) { List<Feature> allFeatures = new ArrayList<Feature>(); // gather up all matching features for (Instance inst : this) { if (inst.containsFeature(featureName)) { allFeatures.add( inst.getFeature(featureName) ); } } if (allFeatures.isEmpty()) return; double N = allFeatures.size(); // currently only support normalizing numeric vector features
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/DataSet.java import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.Set; import com.oculusinfo.ml.feature.Feature; import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; for (int i=0; i < extra; i++) { int offset = instances.length - extra + i; folds.get(i).add(instances[offset]); } return folds; } /*** * Normalize the specified Feature for all Instances in this DataSet. * * Currently only NumericVectorFeature types are supported. * * @param featureName the name of the feature to normalize */ public void normalizeInstanceFeature(String featureName) { List<Feature> allFeatures = new ArrayList<Feature>(); // gather up all matching features for (Instance inst : this) { if (inst.containsFeature(featureName)) { allFeatures.add( inst.getFeature(featureName) ); } } if (allFeatures.isEmpty()) return; double N = allFeatures.size(); // currently only support normalizing numeric vector features
if ( (allFeatures.get(0) instanceof NumericVectorFeature) == false ) return;
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestTemporalDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/temporal/TemporalFeature.java // public class TemporalFeature extends Feature { // private static final long serialVersionUID = 679871263379162267L; // private Date start; // private Date end; // // @Override // public String toString() { // return (this.getName() + ":[" + start + "; " + end + "]"); // } // // public TemporalFeature() { // super(); // } // // public TemporalFeature(String name) { // super(name); // } // // public void setValue(Date start, Date end) { // this.start = start; // this.end = end; // } // // public Date getStart() { // return start; // } // // public void setStart(Date start) { // this.start = start; // } // // public Date getEnd() { // return end; // } // // public void setEnd(Date end) { // this.end = end; // } // }
import java.util.List; import org.junit.Test; import com.oculusinfo.ml.feature.temporal.TemporalFeature; import com.oculusinfo.ml.feature.temporal.distance.TemporalDistance; import static org.junit.Assert.assertTrue; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.LinkedList;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestTemporalDistance { long MS_PER_DAY = 86400000; long MS_PER_WEEK = MS_PER_DAY * 7; long MS_PER_MONTH = MS_PER_DAY * 30; long MS_PER_YEAR = MS_PER_DAY * 365; double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { Date date = (new GregorianCalendar(2010, 01, 01)).getTime();
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/temporal/TemporalFeature.java // public class TemporalFeature extends Feature { // private static final long serialVersionUID = 679871263379162267L; // private Date start; // private Date end; // // @Override // public String toString() { // return (this.getName() + ":[" + start + "; " + end + "]"); // } // // public TemporalFeature() { // super(); // } // // public TemporalFeature(String name) { // super(name); // } // // public void setValue(Date start, Date end) { // this.start = start; // this.end = end; // } // // public Date getStart() { // return start; // } // // public void setStart(Date start) { // this.start = start; // } // // public Date getEnd() { // return end; // } // // public void setEnd(Date end) { // this.end = end; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestTemporalDistance.java import java.util.List; import org.junit.Test; import com.oculusinfo.ml.feature.temporal.TemporalFeature; import com.oculusinfo.ml.feature.temporal.distance.TemporalDistance; import static org.junit.Assert.assertTrue; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.LinkedList; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestTemporalDistance { long MS_PER_DAY = 86400000; long MS_PER_WEEK = MS_PER_DAY * 7; long MS_PER_MONTH = MS_PER_DAY * 30; long MS_PER_YEAR = MS_PER_DAY * 365; double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { Date date = (new GregorianCalendar(2010, 01, 01)).getTime();
TemporalFeature t1 = new TemporalFeature();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/stats/FeatureFrequency.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // }
import java.io.Serializable; import com.oculusinfo.ml.feature.Feature;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.stats; public class FeatureFrequency implements Serializable { private static final long serialVersionUID = -3008472634828604901L; public int frequency = 0;
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/stats/FeatureFrequency.java import java.io.Serializable; import com.oculusinfo.ml.feature.Feature; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.stats; public class FeatureFrequency implements Serializable { private static final long serialVersionUID = -3008472634828604901L; public int frequency = 0;
public Feature feature;
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/validation/unsupervised/internal/Separation.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/unsupervised/cluster/ClusterResult.java // public interface ClusterResult extends Iterable<Cluster>, Serializable { // // public boolean isEmpty(); // // public int size(); // }
import com.oculusinfo.ml.unsupervised.cluster.Cluster; import com.oculusinfo.ml.unsupervised.cluster.ClusterResult; import com.oculusinfo.ml.unsupervised.cluster.Clusterer;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.validation.unsupervised.internal; /*** * An internal clustering validation implementation of cluster separation * @author slangevin * */ public class Separation { public static double separation(Clusterer clusterer, Cluster c1, Cluster c2) { return clusterer.distance(c1, c2); }
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/unsupervised/cluster/ClusterResult.java // public interface ClusterResult extends Iterable<Cluster>, Serializable { // // public boolean isEmpty(); // // public int size(); // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/validation/unsupervised/internal/Separation.java import com.oculusinfo.ml.unsupervised.cluster.Cluster; import com.oculusinfo.ml.unsupervised.cluster.ClusterResult; import com.oculusinfo.ml.unsupervised.cluster.Clusterer; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.validation.unsupervised.internal; /*** * An internal clustering validation implementation of cluster separation * @author slangevin * */ public class Separation { public static double separation(Clusterer clusterer, Cluster c1, Cluster c2) { return clusterer.distance(c1, c2); }
public static double validate(Clusterer clusterer, ClusterResult clusters) {
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEuclideanDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/EuclideanDistance.java // public class EuclideanDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -123522038033912391L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // private final static double normConst = 1 / Math.sqrt(Math.pow(360, 2) + Math.pow(180, 2)); // 1 / 12742.0; // // public EuclideanDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = x.getLatitude(); // double lat2 = y.getLatitude(); // double lon1 = x.getLongitude(); // double lon2 = y.getLongitude(); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(lat2 - lat1, 2) + Math.pow(lon2 - lon1, 2)) * normConst; // } // // public double distanceInCartesianPlane(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // double x1 = EARTH_RADIUS * Math.cos(lat1) * Math.cos(lon1); // double x2 = EARTH_RADIUS * Math.cos(lat2) * Math.cos(lon2); // double y1 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double y2 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double z1 = EARTH_RADIUS * Math.sin(lat1); // double z2 = EARTH_RADIUS * Math.sin(lat2); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2)) * normConst; // } // }
import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import com.oculusinfo.ml.feature.spatial.distance.EuclideanDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEuclideanDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/EuclideanDistance.java // public class EuclideanDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -123522038033912391L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // private final static double normConst = 1 / Math.sqrt(Math.pow(360, 2) + Math.pow(180, 2)); // 1 / 12742.0; // // public EuclideanDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = x.getLatitude(); // double lat2 = y.getLatitude(); // double lon1 = x.getLongitude(); // double lon2 = y.getLongitude(); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(lat2 - lat1, 2) + Math.pow(lon2 - lon1, 2)) * normConst; // } // // public double distanceInCartesianPlane(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // double x1 = EARTH_RADIUS * Math.cos(lat1) * Math.cos(lon1); // double x2 = EARTH_RADIUS * Math.cos(lat2) * Math.cos(lon2); // double y1 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double y2 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double z1 = EARTH_RADIUS * Math.sin(lat1); // double z2 = EARTH_RADIUS * Math.sin(lat2); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2)) * normConst; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEuclideanDistance.java import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import com.oculusinfo.ml.feature.spatial.distance.EuclideanDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEuclideanDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
GeoSpatialFeature t1 = new GeoSpatialFeature();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEuclideanDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/EuclideanDistance.java // public class EuclideanDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -123522038033912391L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // private final static double normConst = 1 / Math.sqrt(Math.pow(360, 2) + Math.pow(180, 2)); // 1 / 12742.0; // // public EuclideanDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = x.getLatitude(); // double lat2 = y.getLatitude(); // double lon1 = x.getLongitude(); // double lon2 = y.getLongitude(); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(lat2 - lat1, 2) + Math.pow(lon2 - lon1, 2)) * normConst; // } // // public double distanceInCartesianPlane(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // double x1 = EARTH_RADIUS * Math.cos(lat1) * Math.cos(lon1); // double x2 = EARTH_RADIUS * Math.cos(lat2) * Math.cos(lon2); // double y1 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double y2 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double z1 = EARTH_RADIUS * Math.sin(lat1); // double z2 = EARTH_RADIUS * Math.sin(lat2); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2)) * normConst; // } // }
import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import com.oculusinfo.ml.feature.spatial.distance.EuclideanDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEuclideanDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { GeoSpatialFeature t1 = new GeoSpatialFeature(); double lat = 43.650514, lon = -79.363672; t1.setValue(lat, lon); GeoSpatialFeature t2 = new GeoSpatialFeature(); t2.setValue(lat, lon);
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/EuclideanDistance.java // public class EuclideanDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -123522038033912391L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // private final static double normConst = 1 / Math.sqrt(Math.pow(360, 2) + Math.pow(180, 2)); // 1 / 12742.0; // // public EuclideanDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = x.getLatitude(); // double lat2 = y.getLatitude(); // double lon1 = x.getLongitude(); // double lon2 = y.getLongitude(); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(lat2 - lat1, 2) + Math.pow(lon2 - lon1, 2)) * normConst; // } // // public double distanceInCartesianPlane(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // double x1 = EARTH_RADIUS * Math.cos(lat1) * Math.cos(lon1); // double x2 = EARTH_RADIUS * Math.cos(lat2) * Math.cos(lon2); // double y1 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double y2 = EARTH_RADIUS * Math.cos(lat1) * Math.sin(lon2); // double z1 = EARTH_RADIUS * Math.sin(lat1); // double z2 = EARTH_RADIUS * Math.sin(lat2); // // // return normalized euclidean distance [0,1] // return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2)) * normConst; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEuclideanDistance.java import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import com.oculusinfo.ml.feature.spatial.distance.EuclideanDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEuclideanDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { GeoSpatialFeature t1 = new GeoSpatialFeature(); double lat = 43.650514, lon = -79.363672; t1.setValue(lat, lon); GeoSpatialFeature t2 = new GeoSpatialFeature(); t2.setValue(lat, lon);
EuclideanDistance d = new EuclideanDistance(1);
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestSphericalCosineDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/SphericalCosineDistance.java // public class SphericalCosineDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -4202417997475962513L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // // public SphericalCosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // // double d = Math.acos(Math.sin(lat1)*Math.sin(lat2) + // Math.cos(lat1)*Math.cos(lat2) * // Math.cos(lon2-lon1)); // double normDist = d / Math.PI; // return normDist; // } // // public double distanceInKM(GeoSpatialFeature x, GeoSpatialFeature y) { // return distance(x, y) * EARTH_RADIUS; // } // }
import com.oculusinfo.ml.feature.spatial.distance.SphericalCosineDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestSphericalCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/SphericalCosineDistance.java // public class SphericalCosineDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -4202417997475962513L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // // public SphericalCosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // // double d = Math.acos(Math.sin(lat1)*Math.sin(lat2) + // Math.cos(lat1)*Math.cos(lat2) * // Math.cos(lon2-lon1)); // double normDist = d / Math.PI; // return normDist; // } // // public double distanceInKM(GeoSpatialFeature x, GeoSpatialFeature y) { // return distance(x, y) * EARTH_RADIUS; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestSphericalCosineDistance.java import com.oculusinfo.ml.feature.spatial.distance.SphericalCosineDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestSphericalCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
GeoSpatialFeature t1 = new GeoSpatialFeature();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestSphericalCosineDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/SphericalCosineDistance.java // public class SphericalCosineDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -4202417997475962513L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // // public SphericalCosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // // double d = Math.acos(Math.sin(lat1)*Math.sin(lat2) + // Math.cos(lat1)*Math.cos(lat2) * // Math.cos(lon2-lon1)); // double normDist = d / Math.PI; // return normDist; // } // // public double distanceInKM(GeoSpatialFeature x, GeoSpatialFeature y) { // return distance(x, y) * EARTH_RADIUS; // } // }
import com.oculusinfo.ml.feature.spatial.distance.SphericalCosineDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestSphericalCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { GeoSpatialFeature t1 = new GeoSpatialFeature(); double lat = 43.650514, lon = -79.363672; t1.setValue(lat, lon); GeoSpatialFeature t2 = new GeoSpatialFeature(); t2.setValue(lat, lon);
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/distance/SphericalCosineDistance.java // public class SphericalCosineDistance extends DistanceFunction<GeoSpatialFeature> { // private static final long serialVersionUID = -4202417997475962513L; // private final static double EARTH_RADIUS = 6371.00; // Radius in Kilometers default // // public SphericalCosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(GeoSpatialFeature x, GeoSpatialFeature y) { // double lat1 = Math.toRadians(x.getLatitude()); // double lat2 = Math.toRadians(y.getLatitude()); // double lon1 = Math.toRadians(x.getLongitude()); // double lon2 = Math.toRadians(y.getLongitude()); // // double d = Math.acos(Math.sin(lat1)*Math.sin(lat2) + // Math.cos(lat1)*Math.cos(lat2) * // Math.cos(lon2-lon1)); // double normDist = d / Math.PI; // return normDist; // } // // public double distanceInKM(GeoSpatialFeature x, GeoSpatialFeature y) { // return distance(x, y) * EARTH_RADIUS; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestSphericalCosineDistance.java import com.oculusinfo.ml.feature.spatial.distance.SphericalCosineDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestSphericalCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() { GeoSpatialFeature t1 = new GeoSpatialFeature(); double lat = 43.650514, lon = -79.363672; t1.setValue(lat, lon); GeoSpatialFeature t2 = new GeoSpatialFeature(); t2.setValue(lat, lon);
SphericalCosineDistance d = new SphericalCosineDistance(1);
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestCosineDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/bagofwords/distance/CosineDistance.java // public class CosineDistance extends DistanceFunction<BagOfWordsFeature> { // private static final long serialVersionUID = -635994591459075095L; // // public CosineDistance() { // this(1); // } // // public CosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(BagOfWordsFeature x, BagOfWordsFeature y) { // double dotprod = 0, xlength = 0, ylength = 0; // // for (FeatureFrequency xf : x.getValues()) { // xlength += xf.frequency * xf.frequency; // FeatureFrequency yf = y.getCount(xf.feature.getName()); // if (yf != null) dotprod += xf.frequency * yf.frequency; // } // for (FeatureFrequency yf : y.getValues()) { // ylength += yf.frequency * yf.frequency; // } // // if both are empty then distance is max // if (xlength == 0 || ylength == 0) return 1.0; // // return 1.0 - (dotprod / ( Math.sqrt(xlength) * Math.sqrt(ylength) )); // } // // }
import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature; import com.oculusinfo.ml.feature.bagofwords.distance.CosineDistance; import java.util.Collections; import junit.framework.Assert; import org.junit.Test;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } // @Test // public void testTiming() { // NominalFeature t1 = new NominalFeature(); // t1.incrementValue("dog"); // t1.incrementValue("food"); // t1.incrementValue("house"); // t1.incrementValue("walk"); // t1.incrementValue("yard"); // // NominalFeature t2 = new NominalFeature(); // t2.incrementValue("cat"); // t2.incrementValue("food"); // t2.incrementValue("house"); // t2.incrementValue("sand"); // t2.incrementValue("box"); // // CosineDistance d = new CosineDistance(); //// EuclideanDistance d = new EuclideanDistance(1); // // long start = System.currentTimeMillis(); // double distance = 0; // // for (int i=0; i < 300000*50 ; i++) { //// distance = d.distance(t1, t2); // distance = d.aveMinDistance(Collections.singletonList(t1), Collections.singletonList(t2)); //// Concept cx = taxonomy.findConcept(t1.getConcept()); //// Concept cy = taxonomy.findConcept(t2.getConcept()); //// Concept lca = cx.findCommonAncestor(cy); // } // double distanceTime = System.currentTimeMillis() - start; // System.out.println("Time: " + distanceTime/1000); // } @Test public void testIdentical() { BagOfWordsFeature t1 = new BagOfWordsFeature(); t1.incrementValue("dog"); t1.incrementValue("food"); t1.incrementValue("house"); t1.incrementValue("walk"); t1.incrementValue("yard"); BagOfWordsFeature t2 = new BagOfWordsFeature(); t2.incrementValue("dog"); t2.incrementValue("food"); t2.incrementValue("house"); t2.incrementValue("walk"); t2.incrementValue("yard");
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/bagofwords/distance/CosineDistance.java // public class CosineDistance extends DistanceFunction<BagOfWordsFeature> { // private static final long serialVersionUID = -635994591459075095L; // // public CosineDistance() { // this(1); // } // // public CosineDistance(double weight) { // super(weight); // } // // @Override // public double distance(BagOfWordsFeature x, BagOfWordsFeature y) { // double dotprod = 0, xlength = 0, ylength = 0; // // for (FeatureFrequency xf : x.getValues()) { // xlength += xf.frequency * xf.frequency; // FeatureFrequency yf = y.getCount(xf.feature.getName()); // if (yf != null) dotprod += xf.frequency * yf.frequency; // } // for (FeatureFrequency yf : y.getValues()) { // ylength += yf.frequency * yf.frequency; // } // // if both are empty then distance is max // if (xlength == 0 || ylength == 0) return 1.0; // // return 1.0 - (dotprod / ( Math.sqrt(xlength) * Math.sqrt(ylength) )); // } // // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestCosineDistance.java import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature; import com.oculusinfo.ml.feature.bagofwords.distance.CosineDistance; import java.util.Collections; import junit.framework.Assert; import org.junit.Test; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestCosineDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } // @Test // public void testTiming() { // NominalFeature t1 = new NominalFeature(); // t1.incrementValue("dog"); // t1.incrementValue("food"); // t1.incrementValue("house"); // t1.incrementValue("walk"); // t1.incrementValue("yard"); // // NominalFeature t2 = new NominalFeature(); // t2.incrementValue("cat"); // t2.incrementValue("food"); // t2.incrementValue("house"); // t2.incrementValue("sand"); // t2.incrementValue("box"); // // CosineDistance d = new CosineDistance(); //// EuclideanDistance d = new EuclideanDistance(1); // // long start = System.currentTimeMillis(); // double distance = 0; // // for (int i=0; i < 300000*50 ; i++) { //// distance = d.distance(t1, t2); // distance = d.aveMinDistance(Collections.singletonList(t1), Collections.singletonList(t2)); //// Concept cx = taxonomy.findConcept(t1.getConcept()); //// Concept cy = taxonomy.findConcept(t2.getConcept()); //// Concept lca = cx.findCommonAncestor(cy); // } // double distanceTime = System.currentTimeMillis() - start; // System.out.println("Time: " + distanceTime/1000); // } @Test public void testIdentical() { BagOfWordsFeature t1 = new BagOfWordsFeature(); t1.incrementValue("dog"); t1.incrementValue("food"); t1.incrementValue("house"); t1.incrementValue("walk"); t1.incrementValue("yard"); BagOfWordsFeature t2 = new BagOfWordsFeature(); t2.incrementValue("dog"); t2.incrementValue("food"); t2.incrementValue("house"); t2.incrementValue("walk"); t2.incrementValue("yard");
CosineDistance d = new CosineDistance();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/Instance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // }
import org.codehaus.jackson.annotate.JsonIgnore; import com.oculusinfo.ml.feature.Feature; import java.io.Serializable; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import java.util.UUID;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml; /*** * Instance represents one "row" or "group" of data describing one entity in a data set. * The instances are associated with a collection of typed features that represent the data values * of the entity. Each instance can be provided a distinguishing "label" that can be used for classification. * * Each instance is assumed to be provided a unique identifier. If none is provided, then one will be generated. * * @author slangevin * */ public class Instance implements Serializable { private static final long serialVersionUID = -8781788906032267606L; protected String id; protected String classLabel;
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/Instance.java import org.codehaus.jackson.annotate.JsonIgnore; import com.oculusinfo.ml.feature.Feature; import java.io.Serializable; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import java.util.UUID; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml; /*** * Instance represents one "row" or "group" of data describing one entity in a data set. * The instances are associated with a collection of typed features that represent the data values * of the entity. Each instance can be provided a distinguishing "label" that can be used for classification. * * Each instance is assumed to be provided a unique identifier. If none is provided, then one will be generated. * * @author slangevin * */ public class Instance implements Serializable { private static final long serialVersionUID = -8781788906032267606L; protected String id; protected String classLabel;
protected Map<String, Feature> features = new LinkedHashMap<String, Feature>();
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/geometry/geodesic/Track.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/math/linearalgebra/ListUtilities.java // public class ListUtilities { // private static boolean equal (double a, double b, double epsilon) { // return Math.abs(a-b) < epsilon; // } // // /** // * Join together 2 ordered lists of doubles into a single, ordered list // * // * @param lists // * The lists to be joined // * // * @param A // * The first list // * @param B // * The second list // * @param epsilon // * The difference within which two doubles are considered equal // * @return The conjoined list // */ // public static List<Double> joinLists (List<Double> A, List<Double> B, // double epsilon) { // List<Double> C = new ArrayList<Double>(); // int nA = 0; // int NA = A.size(); // double a = A.get(nA); // // int nB = 0; // int NB = B.size(); // double b = B.get(nB); // // while (nA < NA || nB < NB) { // if (equal(a, b, epsilon)) { // // A bit silly, since they are already shown equal, but just in // // case of large epsilon, it'd be nice to be sure // C.add((a + b) / 2); // while (nA < NA && equal(a, A.get(nA), epsilon)) ++nA; // a = (nA < NA ? A.get(nA) : Double.MAX_VALUE); // while (nB < NB && equal(b, B.get(nB), epsilon)) ++nB; // b = (nB < NB ? B.get(nB) : Double.MAX_VALUE); // } else if (a < b) { // C.add(a); // ++nA; // a = (nA < NA ? A.get(nA) : Double.MAX_VALUE); // } else { // C.add(b); // ++nB; // b = (nB < NB ? B.get(nB) : Double.MAX_VALUE); // } // } // // return C; // } // // /** // * Join together N orderd lists of doubles into a single, ordered list // * // * @param lists // * The lists to be joined // * @param epsilon // * The difference within which two doubles are considered equal // */ // public static List<Double> joinNLists (List<List<Double>> lists, // double epsilon) { // if (null == lists) // return null; // if (0 == lists.size()) // return null; // if (1 == lists.size()) // return lists.get(0); // // while (lists.size() > 1) { // // This looks like it's looping over every member, but each time, // // it's really replacing the current and next list with a single, // // new, joined list. So, in actuallity, it's looping over pairs, // // because replacement happens durring the loop. // for (int i = 0; i < lists.size() - 1; ++i) { // List<Double> A = lists.remove(i); // List<Double> B = lists.remove(i); // lists.add(i, joinLists(A, B, epsilon)); // } // } // return lists.get(0); // } // }
import com.oculusinfo.math.linearalgebra.ListUtilities; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map;
Position ourStart = _points.get(0); Position ourEnd = _points.get(_points.size()-1); List<Position> theirPoints = them.getPoints(); Position theirStart = theirPoints.get(0); Position theirEnd = theirPoints.get(theirPoints.size()-1); double dss = getSegmentDistance(ourStart, theirStart); double dse = getSegmentDistance(ourStart, theirEnd); double des = getSegmentDistance(ourEnd, theirStart); double dee = getSegmentDistance(ourEnd, theirEnd); double requiredConfidence = 0.5; return (dse/dee < requiredConfidence && des / dss < requiredConfidence); } public double getDistance (Track them) { if (_parameters.ignoreDirection()) { if (closerToReverse(them)) return getDistanceWithDirection(them.reverse()); else return getDistanceWithDirection(them); } else { return getDistanceWithDirection(them); } } private double getDistanceWithDirection (Track them) { List<Double> ourParameterization = getParameterization(); List<Double> theirParameterization = them.getParameterization();
// Path: ensemble-clustering/src/main/java/com/oculusinfo/math/linearalgebra/ListUtilities.java // public class ListUtilities { // private static boolean equal (double a, double b, double epsilon) { // return Math.abs(a-b) < epsilon; // } // // /** // * Join together 2 ordered lists of doubles into a single, ordered list // * // * @param lists // * The lists to be joined // * // * @param A // * The first list // * @param B // * The second list // * @param epsilon // * The difference within which two doubles are considered equal // * @return The conjoined list // */ // public static List<Double> joinLists (List<Double> A, List<Double> B, // double epsilon) { // List<Double> C = new ArrayList<Double>(); // int nA = 0; // int NA = A.size(); // double a = A.get(nA); // // int nB = 0; // int NB = B.size(); // double b = B.get(nB); // // while (nA < NA || nB < NB) { // if (equal(a, b, epsilon)) { // // A bit silly, since they are already shown equal, but just in // // case of large epsilon, it'd be nice to be sure // C.add((a + b) / 2); // while (nA < NA && equal(a, A.get(nA), epsilon)) ++nA; // a = (nA < NA ? A.get(nA) : Double.MAX_VALUE); // while (nB < NB && equal(b, B.get(nB), epsilon)) ++nB; // b = (nB < NB ? B.get(nB) : Double.MAX_VALUE); // } else if (a < b) { // C.add(a); // ++nA; // a = (nA < NA ? A.get(nA) : Double.MAX_VALUE); // } else { // C.add(b); // ++nB; // b = (nB < NB ? B.get(nB) : Double.MAX_VALUE); // } // } // // return C; // } // // /** // * Join together N orderd lists of doubles into a single, ordered list // * // * @param lists // * The lists to be joined // * @param epsilon // * The difference within which two doubles are considered equal // */ // public static List<Double> joinNLists (List<List<Double>> lists, // double epsilon) { // if (null == lists) // return null; // if (0 == lists.size()) // return null; // if (1 == lists.size()) // return lists.get(0); // // while (lists.size() > 1) { // // This looks like it's looping over every member, but each time, // // it's really replacing the current and next list with a single, // // new, joined list. So, in actuallity, it's looping over pairs, // // because replacement happens durring the loop. // for (int i = 0; i < lists.size() - 1; ++i) { // List<Double> A = lists.remove(i); // List<Double> B = lists.remove(i); // lists.add(i, joinLists(A, B, epsilon)); // } // } // return lists.get(0); // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/geometry/geodesic/Track.java import com.oculusinfo.math.linearalgebra.ListUtilities; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; Position ourStart = _points.get(0); Position ourEnd = _points.get(_points.size()-1); List<Position> theirPoints = them.getPoints(); Position theirStart = theirPoints.get(0); Position theirEnd = theirPoints.get(theirPoints.size()-1); double dss = getSegmentDistance(ourStart, theirStart); double dse = getSegmentDistance(ourStart, theirEnd); double des = getSegmentDistance(ourEnd, theirStart); double dee = getSegmentDistance(ourEnd, theirEnd); double requiredConfidence = 0.5; return (dse/dee < requiredConfidence && des / dss < requiredConfidence); } public double getDistance (Track them) { if (_parameters.ignoreDirection()) { if (closerToReverse(them)) return getDistanceWithDirection(them.reverse()); else return getDistanceWithDirection(them); } else { return getDistanceWithDirection(them); } } private double getDistanceWithDirection (Track them) { List<Double> ourParameterization = getParameterization(); List<Double> theirParameterization = them.getParameterization();
List<Double> joinedParameterization = ListUtilities.joinLists(ourParameterization,
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/main/java/com/oculusinfo/ml/stats/FeatureFrequencyTable.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // }
import org.codehaus.jackson.annotate.JsonIgnore; import com.oculusinfo.ml.feature.Feature; import java.io.Serializable; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.PriorityQueue;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.stats; public class FeatureFrequencyTable implements Serializable { private static final long serialVersionUID = 2702669296496944069L; private Map<String, FeatureFrequency> table = new HashMap<String, FeatureFrequency>(); public FeatureFrequencyTable() { }
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/Feature.java // public abstract class Feature implements Serializable { // private static final long serialVersionUID = 192274668774344842L; // // // the unique name of the feature // protected String name; // // // The weight of this feature // private double weight; // // public Feature() { // // empty constructor // this.weight = 1.0; // } // // public Feature(String name) { // this.name = name; // this.weight = 1.0; // } // // public double getWeight () { // return weight; // } // // public void setWeight (double weight) { // this.weight = weight; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @JsonIgnore // public String getId() { // return name; // } // // @Override // public int hashCode() { // return name.hashCode(); // } // } // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/stats/FeatureFrequencyTable.java import org.codehaus.jackson.annotate.JsonIgnore; import com.oculusinfo.ml.feature.Feature; import java.io.Serializable; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.PriorityQueue; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.stats; public class FeatureFrequencyTable implements Serializable { private static final long serialVersionUID = 2702669296496944069L; private Map<String, FeatureFrequency> table = new HashMap<String, FeatureFrequency>(); public FeatureFrequencyTable() { }
public boolean containsFeature(Feature feature) {
unchartedsoftware/ensemble-clustering
ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEquitangularDistance.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // }
import com.oculusinfo.ml.feature.spatial.distance.EquitangularDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature;
/** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEquitangularDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // Path: ensemble-clustering/src/test/java/com/oculusinfo/ml/distance/TestEquitangularDistance.java import com.oculusinfo.ml.feature.spatial.distance.EquitangularDistance; import static org.junit.Assert.assertTrue; import java.util.Collections; import org.junit.Test; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; /** * Copyright (c) 2013 Oculus Info Inc. * http://www.oculusinfo.com/ * * Released under the MIT License. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oculusinfo.ml.distance; public class TestEquitangularDistance { double epsilon = 0.00001; private boolean isEqual(double d1, double d2) { return (Math.abs( d1 - d2 ) < epsilon ); } @Test public void testIdenticalPoints() {
GeoSpatialFeature t1 = new GeoSpatialFeature();
unchartedsoftware/ensemble-clustering
ensemble-clustering-spark/src/main/java/com/oculusinfo/ml/spark/SparkInstanceParserHelper.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // }
import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.HashMap; import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature;
} public BagOfWordsFeature fieldToBagOfWordsFeature(String name) { Field field = fields.get(name); if (field == null) return null; BagOfWordsFeature feature = null; try { feature = new BagOfWordsFeature(field.name); String val = field.value.substring(1, field.value.length()-1); // strip off enclosing [ ] if (val.isEmpty()) return null; String[] entries = val.split(";"); for (String entry : entries) { if (entry.isEmpty()) continue; String[] tokens = entry.split("="); feature.setCount(tokens[0], Integer.parseInt(tokens[1])); } } catch (Exception e) { e.printStackTrace(); } return feature; }
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // Path: ensemble-clustering-spark/src/main/java/com/oculusinfo/ml/spark/SparkInstanceParserHelper.java import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.HashMap; import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature; } public BagOfWordsFeature fieldToBagOfWordsFeature(String name) { Field field = fields.get(name); if (field == null) return null; BagOfWordsFeature feature = null; try { feature = new BagOfWordsFeature(field.name); String val = field.value.substring(1, field.value.length()-1); // strip off enclosing [ ] if (val.isEmpty()) return null; String[] entries = val.split(";"); for (String entry : entries) { if (entry.isEmpty()) continue; String[] tokens = entry.split("="); feature.setCount(tokens[0], Integer.parseInt(tokens[1])); } } catch (Exception e) { e.printStackTrace(); } return feature; }
public GeoSpatialFeature fieldToGeoSpatialFeature(String name) {
unchartedsoftware/ensemble-clustering
ensemble-clustering-spark/src/main/java/com/oculusinfo/ml/spark/SparkInstanceParserHelper.java
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // }
import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.HashMap; import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature;
catch (Exception e) { e.printStackTrace(); } return feature; } public GeoSpatialFeature fieldToGeoSpatialFeature(String name) { Field field = fields.get(name); if (field == null) return null; GeoSpatialFeature feature = null; try { feature = new GeoSpatialFeature(field.name); String val = field.value.substring(1, field.value.length()-1); // strip off enclosing [ ] if (val.isEmpty()) return null; String[] tokens = val.split(";"); feature.setValue(Double.parseDouble(tokens[0]), Double.parseDouble(tokens[1])); } catch (Exception e) { e.printStackTrace(); } return feature; }
// Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/numeric/NumericVectorFeature.java // public class NumericVectorFeature extends Feature { // private static final long serialVersionUID = 4845380498652903996L; // private double[] vector; // // private String vectorToString() { // StringBuilder str = new StringBuilder(); // str.append("["); // for (int i=0; i < vector.length; i++) { // str.append(vector[i]); // if (i < vector.length - 1) str.append(";"); // } // str.append("]"); // return str.toString(); // } // // @Override // public String toString() { // return (this.getName() + ":" + vectorToString()); // } // // public NumericVectorFeature() { // super(); // } // // public NumericVectorFeature(String name) { // super(name); // } // // public void setValue(double[] vector) { // this.vector = vector; // } // // public void setValue(List<Double> vector) { // setValue(new ArrayList<Double>(vector)); // } // // public double[] getValue() { // return this.vector; // } // } // // Path: ensemble-clustering/src/main/java/com/oculusinfo/ml/feature/spatial/GeoSpatialFeature.java // public class GeoSpatialFeature extends Feature { // private static final long serialVersionUID = 7917681828048658982L; // private double latitude; // private double longitude; // // @Override // public String toString() { // return (this.getName() + ":[" + latitude + ";" + longitude + "]"); // } // // public GeoSpatialFeature() { // super(); // } // // public GeoSpatialFeature(String name) { // super(name); // } // // public void setValue(double latitude, double longitude) { // this.latitude = latitude; // this.longitude = longitude; // } // // public double getLatitude() { // return latitude; // } // // public void setLatitude(double latitude) { // this.latitude = latitude; // } // // public double getLongitude() { // return longitude; // } // // public void setLongitude(double longitude) { // this.longitude = longitude; // } // } // Path: ensemble-clustering-spark/src/main/java/com/oculusinfo/ml/spark/SparkInstanceParserHelper.java import com.oculusinfo.ml.feature.numeric.NumericVectorFeature; import com.oculusinfo.ml.feature.spatial.GeoSpatialFeature; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.HashMap; import com.oculusinfo.ml.feature.bagofwords.BagOfWordsFeature; catch (Exception e) { e.printStackTrace(); } return feature; } public GeoSpatialFeature fieldToGeoSpatialFeature(String name) { Field field = fields.get(name); if (field == null) return null; GeoSpatialFeature feature = null; try { feature = new GeoSpatialFeature(field.name); String val = field.value.substring(1, field.value.length()-1); // strip off enclosing [ ] if (val.isEmpty()) return null; String[] tokens = val.split(";"); feature.setValue(Double.parseDouble(tokens[0]), Double.parseDouble(tokens[1])); } catch (Exception e) { e.printStackTrace(); } return feature; }
public NumericVectorFeature fieldToNumericVectorFeature(String name) {
Putnami/putnami-gradle-plugin
src/main/java/fr/putnami/gwt/gradle/helper/JavaCommandBuilder.java
// Path: src/main/java/fr/putnami/gwt/gradle/extension/JavaOption.java // public class JavaOption { // // private final List<String> javaArgs = Lists.newArrayList(); // // private String maxHeapSize; // private String minHeapSize; // private String maxPermSize; // private boolean debugJava = false; // private int debugPort = 8000; // private boolean debugSuspend = false; // // public List<String> getJavaArgs() { // return javaArgs; // } // // public void setJavaArgs(String... javaArgs) { // this.javaArgs.addAll(Arrays.asList(javaArgs)); // } // // public String getMaxHeapSize() { // return maxHeapSize; // } // // public void setMaxHeapSize(String maxHeapSize) { // this.maxHeapSize = maxHeapSize; // } // // public String getMinHeapSize() { // return minHeapSize; // } // // public void setMinHeapSize(String minHeapSize) { // this.minHeapSize = minHeapSize; // } // // public String getMaxPermSize() { // return maxPermSize; // } // // public void setMaxPermSize(String maxPermSize) { // this.maxPermSize = maxPermSize; // } // // public boolean isDebugJava() { // return debugJava; // } // // public void setDebugJava(boolean debugJava) { // this.debugJava = debugJava; // } // // public int getDebugPort() { // return debugPort; // } // // public void setDebugPort(int debugPort) { // this.debugPort = debugPort; // } // // public void setDebugPort(String debugPort) { // this.debugPort = Integer.valueOf(debugPort); // } // // public boolean isDebugSuspend() { // return debugSuspend; // } // // public void setDebugSuspend(boolean debugSuspend) { // this.debugSuspend = debugSuspend; // } // // public void setDebugSuspend(String debugSuspend) { // this.debugSuspend = Boolean.valueOf(debugSuspend); // } // }
import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.gradle.internal.jvm.Jvm; import java.io.File; import java.nio.charset.Charset; import java.util.List; import fr.putnami.gwt.gradle.extension.JavaOption;
} } if (classPaths.size() > 0) { sb.append(" -cp "); int i = 0; for (String classPath : classPaths) { if (!Strings.isNullOrEmpty(classPath.trim())) { if (i > 0) { sb.append(System.getProperty("path.separator")); } sb.append(classPath.trim()); i++; } } } sb.append(" "); sb.append(mainClass); for (String arg : args) { if (!Strings.isNullOrEmpty(arg)) { sb.append(" "); sb.append(arg); } } return sb.toString(); }
// Path: src/main/java/fr/putnami/gwt/gradle/extension/JavaOption.java // public class JavaOption { // // private final List<String> javaArgs = Lists.newArrayList(); // // private String maxHeapSize; // private String minHeapSize; // private String maxPermSize; // private boolean debugJava = false; // private int debugPort = 8000; // private boolean debugSuspend = false; // // public List<String> getJavaArgs() { // return javaArgs; // } // // public void setJavaArgs(String... javaArgs) { // this.javaArgs.addAll(Arrays.asList(javaArgs)); // } // // public String getMaxHeapSize() { // return maxHeapSize; // } // // public void setMaxHeapSize(String maxHeapSize) { // this.maxHeapSize = maxHeapSize; // } // // public String getMinHeapSize() { // return minHeapSize; // } // // public void setMinHeapSize(String minHeapSize) { // this.minHeapSize = minHeapSize; // } // // public String getMaxPermSize() { // return maxPermSize; // } // // public void setMaxPermSize(String maxPermSize) { // this.maxPermSize = maxPermSize; // } // // public boolean isDebugJava() { // return debugJava; // } // // public void setDebugJava(boolean debugJava) { // this.debugJava = debugJava; // } // // public int getDebugPort() { // return debugPort; // } // // public void setDebugPort(int debugPort) { // this.debugPort = debugPort; // } // // public void setDebugPort(String debugPort) { // this.debugPort = Integer.valueOf(debugPort); // } // // public boolean isDebugSuspend() { // return debugSuspend; // } // // public void setDebugSuspend(boolean debugSuspend) { // this.debugSuspend = debugSuspend; // } // // public void setDebugSuspend(String debugSuspend) { // this.debugSuspend = Boolean.valueOf(debugSuspend); // } // } // Path: src/main/java/fr/putnami/gwt/gradle/helper/JavaCommandBuilder.java import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.gradle.internal.jvm.Jvm; import java.io.File; import java.nio.charset.Charset; import java.util.List; import fr.putnami.gwt.gradle.extension.JavaOption; } } if (classPaths.size() > 0) { sb.append(" -cp "); int i = 0; for (String classPath : classPaths) { if (!Strings.isNullOrEmpty(classPath.trim())) { if (i > 0) { sb.append(System.getProperty("path.separator")); } sb.append(classPath.trim()); i++; } } } sb.append(" "); sb.append(mainClass); for (String arg : args) { if (!Strings.isNullOrEmpty(arg)) { sb.append(" "); sb.append(arg); } } return sb.toString(); }
public void configureJavaArgs(JavaOption javaOptions) {
Putnami/putnami-gradle-plugin
src/main/java/fr/putnami/gwt/gradle/PwtLibPlugin.java
// Path: src/main/java/fr/putnami/gwt/gradle/extension/PutnamiExtension.java // public class PutnamiExtension { // public static final String PWT_EXTENSION = "putnami"; // // private String gwtVersion = "2.7.0"; // private boolean gwtServletLib = false; // private boolean gwtElementalLib = false; // private boolean googlePluginEclipse = false; // private String jettyVersion = "9.2.7.v20150116"; // /** // * Specifies Java source level. // */ // private String sourceLevel; // // /** // * GWT Module to compile. // */ // private final List<String> module = Lists.newArrayList(); // // private CompilerOption compile = new CompilerOption(); // private DevOption dev = new DevOption(); // private JettyOption jetty = new JettyOption(); // // public String getGwtVersion() { // return gwtVersion; // } // // public void setGwtVersion(String gwtVersion) { // this.gwtVersion = gwtVersion; // } // // public String getJettyVersion() { // return jettyVersion; // } // // public void setJettyVersion(String jettyVersion) { // this.jettyVersion = jettyVersion; // } // // public boolean isGwtServletLib() { // return gwtServletLib; // } // // public void setGwtServletLib(boolean gwtServletLib) { // this.gwtServletLib = gwtServletLib; // } // // public boolean isGwtElementalLib() { // return gwtElementalLib; // } // // public void setGwtElementalLib(boolean gwtElementalLib) { // this.gwtElementalLib = gwtElementalLib; // } // // public boolean isGooglePluginEclipse() { // return googlePluginEclipse; // } // // public void setGooglePluginEclipse(boolean googlePluginEclipse) { // this.googlePluginEclipse = googlePluginEclipse; // } // // public DevOption getDev() { // return dev; // } // // public void setDev(DevOption dev) { // this.dev = dev; // } // // public PutnamiExtension dev(Closure<DevOption> c) { // ConfigureUtil.configure(c, dev); // return this; // } // // public CompilerOption getCompile() { // return compile; // } // // public void setCompile(CompilerOption compile) { // this.compile = compile; // } // // public PutnamiExtension compile(Closure<CompilerOption> c) { // ConfigureUtil.configure(c, compile); // return this; // } // // public JettyOption getJetty() { // return jetty; // } // // public void setJetty(JettyOption jetty) { // this.jetty = jetty; // } // // public PutnamiExtension jetty(Closure<JettyOption> c) { // ConfigureUtil.configure(c, jetty); // return this; // } // // public String getSourceLevel() { // return sourceLevel; // } // // public void setSourceLevel(String sourceLevel) { // this.sourceLevel = sourceLevel; // } // // public List<String> getModule() { // return module; // } // // public void module(String... modules) { // this.module.addAll(Arrays.asList(modules)); // } // }
import org.gradle.api.Action; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.file.FileCollection; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.MavenPlugin; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.bundling.Jar; import org.gradle.api.tasks.testing.Test; import org.gradle.plugins.ide.eclipse.model.EclipseModel; import fr.putnami.gwt.gradle.extension.PutnamiExtension;
/** * This file is part of pwt. * * pwt is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * pwt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with pwt. If not, * see <http://www.gnu.org/licenses/>. */ package fr.putnami.gwt.gradle; public class PwtLibPlugin implements Plugin<Project> { public static final String CONF_GWT_SDM = "gwtSdk"; public static final String CONF_JETTY = "jettyConf"; private static final String ECLIPSE_NATURE = "com.google.gwt.eclipse.core.gwtNature"; private static final String ECLIPSE_BUILDER_PROJECT_VALIDATOR = "com.google.gwt.eclipse.core.gwtProjectValidator"; private static final String ECLIPSE_BUILDER_WEBAPP_VALIDATOR = "com.google.gdt.eclipse.core.webAppProjectValidator"; @Override public void apply(Project project) { project.getPlugins().apply(JavaPlugin.class); project.getPlugins().apply(MavenPlugin.class);
// Path: src/main/java/fr/putnami/gwt/gradle/extension/PutnamiExtension.java // public class PutnamiExtension { // public static final String PWT_EXTENSION = "putnami"; // // private String gwtVersion = "2.7.0"; // private boolean gwtServletLib = false; // private boolean gwtElementalLib = false; // private boolean googlePluginEclipse = false; // private String jettyVersion = "9.2.7.v20150116"; // /** // * Specifies Java source level. // */ // private String sourceLevel; // // /** // * GWT Module to compile. // */ // private final List<String> module = Lists.newArrayList(); // // private CompilerOption compile = new CompilerOption(); // private DevOption dev = new DevOption(); // private JettyOption jetty = new JettyOption(); // // public String getGwtVersion() { // return gwtVersion; // } // // public void setGwtVersion(String gwtVersion) { // this.gwtVersion = gwtVersion; // } // // public String getJettyVersion() { // return jettyVersion; // } // // public void setJettyVersion(String jettyVersion) { // this.jettyVersion = jettyVersion; // } // // public boolean isGwtServletLib() { // return gwtServletLib; // } // // public void setGwtServletLib(boolean gwtServletLib) { // this.gwtServletLib = gwtServletLib; // } // // public boolean isGwtElementalLib() { // return gwtElementalLib; // } // // public void setGwtElementalLib(boolean gwtElementalLib) { // this.gwtElementalLib = gwtElementalLib; // } // // public boolean isGooglePluginEclipse() { // return googlePluginEclipse; // } // // public void setGooglePluginEclipse(boolean googlePluginEclipse) { // this.googlePluginEclipse = googlePluginEclipse; // } // // public DevOption getDev() { // return dev; // } // // public void setDev(DevOption dev) { // this.dev = dev; // } // // public PutnamiExtension dev(Closure<DevOption> c) { // ConfigureUtil.configure(c, dev); // return this; // } // // public CompilerOption getCompile() { // return compile; // } // // public void setCompile(CompilerOption compile) { // this.compile = compile; // } // // public PutnamiExtension compile(Closure<CompilerOption> c) { // ConfigureUtil.configure(c, compile); // return this; // } // // public JettyOption getJetty() { // return jetty; // } // // public void setJetty(JettyOption jetty) { // this.jetty = jetty; // } // // public PutnamiExtension jetty(Closure<JettyOption> c) { // ConfigureUtil.configure(c, jetty); // return this; // } // // public String getSourceLevel() { // return sourceLevel; // } // // public void setSourceLevel(String sourceLevel) { // this.sourceLevel = sourceLevel; // } // // public List<String> getModule() { // return module; // } // // public void module(String... modules) { // this.module.addAll(Arrays.asList(modules)); // } // } // Path: src/main/java/fr/putnami/gwt/gradle/PwtLibPlugin.java import org.gradle.api.Action; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.file.FileCollection; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.MavenPlugin; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.bundling.Jar; import org.gradle.api.tasks.testing.Test; import org.gradle.plugins.ide.eclipse.model.EclipseModel; import fr.putnami.gwt.gradle.extension.PutnamiExtension; /** * This file is part of pwt. * * pwt is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * pwt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with pwt. If not, * see <http://www.gnu.org/licenses/>. */ package fr.putnami.gwt.gradle; public class PwtLibPlugin implements Plugin<Project> { public static final String CONF_GWT_SDM = "gwtSdk"; public static final String CONF_JETTY = "jettyConf"; private static final String ECLIPSE_NATURE = "com.google.gwt.eclipse.core.gwtNature"; private static final String ECLIPSE_BUILDER_PROJECT_VALIDATOR = "com.google.gwt.eclipse.core.gwtProjectValidator"; private static final String ECLIPSE_BUILDER_WEBAPP_VALIDATOR = "com.google.gdt.eclipse.core.webAppProjectValidator"; @Override public void apply(Project project) { project.getPlugins().apply(JavaPlugin.class); project.getPlugins().apply(MavenPlugin.class);
final PutnamiExtension extention = project.getExtensions().create(PutnamiExtension.PWT_EXTENSION,
Putnami/putnami-gradle-plugin
samples/pgp-sample-multimodules/webapp/src/main/java/fr/putnami/gradle/sample/multimodule/app/client/App.java
// Path: samples/pgp-sample-multimodules/domain/src/main/java/fr/putnami/gradle/sample/multimodule/person/client/PersonEditor.java // public class PersonEditor extends Composite implements Editor<Person> { // // interface Binder extends UiBinder<Widget, PersonEditor> { // } // // interface Driver extends SimpleBeanEditorDriver<Person, PersonEditor> { // } // // private final Binder binder = GWT.create(Binder.class); // private final Driver driver = GWT.create(Driver.class); // // @UiField // @Path("name") // TextBox name; // @UiField // @Path("email") // PasswordTextBox email; // // public PersonEditor() { // initWidget(binder.createAndBindUi(this)); // driver.initialize(this); // driver.edit(new Person()); // } // // public void edit(Person person) { // this.driver.edit(person); // } // // public Person flush() { // return driver.flush(); // } // }
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import fr.putnami.gradle.sample.multimodule.person.client.PersonEditor;
package fr.putnami.gradle.sample.multimodule.app.client; public class App extends Composite implements EntryPoint { interface Binder extends UiBinder<Widget, App> { } private final Binder binder = GWT.create(Binder.class); @UiField
// Path: samples/pgp-sample-multimodules/domain/src/main/java/fr/putnami/gradle/sample/multimodule/person/client/PersonEditor.java // public class PersonEditor extends Composite implements Editor<Person> { // // interface Binder extends UiBinder<Widget, PersonEditor> { // } // // interface Driver extends SimpleBeanEditorDriver<Person, PersonEditor> { // } // // private final Binder binder = GWT.create(Binder.class); // private final Driver driver = GWT.create(Driver.class); // // @UiField // @Path("name") // TextBox name; // @UiField // @Path("email") // PasswordTextBox email; // // public PersonEditor() { // initWidget(binder.createAndBindUi(this)); // driver.initialize(this); // driver.edit(new Person()); // } // // public void edit(Person person) { // this.driver.edit(person); // } // // public Person flush() { // return driver.flush(); // } // } // Path: samples/pgp-sample-multimodules/webapp/src/main/java/fr/putnami/gradle/sample/multimodule/app/client/App.java import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import fr.putnami.gradle.sample.multimodule.person.client.PersonEditor; package fr.putnami.gradle.sample.multimodule.app.client; public class App extends Composite implements EntryPoint { interface Binder extends UiBinder<Widget, App> { } private final Binder binder = GWT.create(Binder.class); @UiField
PersonEditor personEditor;
groupon/vertx-utils
src/main/java/com/groupon/vertx/utils/config/Config.java
// Path: src/main/java/com/groupon/vertx/utils/util/Digraph.java // public class Digraph<E> { // private Set<E> nodes; // private final Map<E, Set<E>> adjacent; // // public Digraph() { // this(0); // } // // public Digraph(int initialCapacity) { // nodes = new HashSet<>(initialCapacity); // adjacent = new ConcurrentHashMap<>(initialCapacity); // } // // public void addNode(E v) { // nodes.add(v); // } // // public void addEdge(E v, E w) { // if (!nodes.contains(v) || !nodes.contains(w)) { // throw new IllegalStateException("Both nodes must already exist in the graph prior to adding a connecting edge"); // } // // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.synchronizedSet(new HashSet<E>()); // adjacent.put(v, set); // } // // set.add(w); // } // // public Set<E> getNodes() { // return Collections.unmodifiableSet(nodes); // } // // public Iterable<E> getAdjacent(E v) { // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.emptySet(); // } // // return Collections.unmodifiableSet(set); // } // // @Override // public String toString() { // StringBuilder sb = new StringBuilder("Digraph["); // for (Map.Entry<E, Set<E>> entry : adjacent.entrySet()) { // E v = entry.getKey(); // for (E w : entry.getValue()) { // sb.append("["); // sb.append(v.toString()); // sb.append(" --> "); // sb.append(w.toString()); // sb.append("]"); // } // } // sb.append("]"); // return sb.toString(); // } // } // // Path: src/main/java/com/groupon/vertx/utils/util/TopSorter.java // public class TopSorter<E> { // private final Digraph<E> digraph; // // public TopSorter(Digraph<E> digraph) { // this.digraph = digraph; // } // // public List<E> sort() { // Set<E> nodes = digraph.getNodes(); // // List<E> result = new ArrayList<>(nodes.size()); // Set<E> flagged = new HashSet<>(nodes.size()); // Set<E> visited = new HashSet<>(nodes.size()); // // for (E node : nodes) { // visit(node, result, flagged, visited); // } // // return result; // } // // private void visit(E node, List<E> result, Set<E> flagged, Set<E> visited) { // if (flagged.contains(node)) { // throw new IllegalStateException("Cycle detected; can only sort directed acyclic graphs"); // } // // if (!visited.contains(node)) { // // flagged.add(node); // for (E edgeNode : digraph.getAdjacent(node)) { // visit(edgeNode, result, flagged, visited); // } // // flagged.remove(node); // visited.add(node); // result.add(node); // } // } // }
import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import io.vertx.core.json.JsonObject; import com.groupon.vertx.utils.util.Digraph; import com.groupon.vertx.utils.util.TopSorter;
/** * Copyright 2015 Groupon.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.groupon.vertx.utils.config; /** * Deployment configuration * * @author Tristan Blease (tblease at groupon dot com) * @since 2.0.2 * @version 2.0.2 */ public class Config implements Iterable<VerticleConfig> { private static final String VERTICLES_FIELD = "verticles"; private int total; private Map<String, VerticleConfig> verticles; private List<VerticleConfig> orderedVerticles; public Config(JsonObject config) { final JsonObject verticleJson = config.getJsonObject(VERTICLES_FIELD); if (verticleJson == null) { throw new IllegalStateException("Required config field `" + VERTICLES_FIELD + "` is missing"); } Set<String> verticleNames = verticleJson.fieldNames(); total = verticleNames.size(); verticles = new ConcurrentHashMap<>(total); for (String verticleName : verticleNames) { JsonObject verticleConfig = verticleJson.getJsonObject(verticleName); verticles.put(verticleName, new VerticleConfig(verticleName, verticleConfig)); } determineLoadOrder(); } private void determineLoadOrder() {
// Path: src/main/java/com/groupon/vertx/utils/util/Digraph.java // public class Digraph<E> { // private Set<E> nodes; // private final Map<E, Set<E>> adjacent; // // public Digraph() { // this(0); // } // // public Digraph(int initialCapacity) { // nodes = new HashSet<>(initialCapacity); // adjacent = new ConcurrentHashMap<>(initialCapacity); // } // // public void addNode(E v) { // nodes.add(v); // } // // public void addEdge(E v, E w) { // if (!nodes.contains(v) || !nodes.contains(w)) { // throw new IllegalStateException("Both nodes must already exist in the graph prior to adding a connecting edge"); // } // // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.synchronizedSet(new HashSet<E>()); // adjacent.put(v, set); // } // // set.add(w); // } // // public Set<E> getNodes() { // return Collections.unmodifiableSet(nodes); // } // // public Iterable<E> getAdjacent(E v) { // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.emptySet(); // } // // return Collections.unmodifiableSet(set); // } // // @Override // public String toString() { // StringBuilder sb = new StringBuilder("Digraph["); // for (Map.Entry<E, Set<E>> entry : adjacent.entrySet()) { // E v = entry.getKey(); // for (E w : entry.getValue()) { // sb.append("["); // sb.append(v.toString()); // sb.append(" --> "); // sb.append(w.toString()); // sb.append("]"); // } // } // sb.append("]"); // return sb.toString(); // } // } // // Path: src/main/java/com/groupon/vertx/utils/util/TopSorter.java // public class TopSorter<E> { // private final Digraph<E> digraph; // // public TopSorter(Digraph<E> digraph) { // this.digraph = digraph; // } // // public List<E> sort() { // Set<E> nodes = digraph.getNodes(); // // List<E> result = new ArrayList<>(nodes.size()); // Set<E> flagged = new HashSet<>(nodes.size()); // Set<E> visited = new HashSet<>(nodes.size()); // // for (E node : nodes) { // visit(node, result, flagged, visited); // } // // return result; // } // // private void visit(E node, List<E> result, Set<E> flagged, Set<E> visited) { // if (flagged.contains(node)) { // throw new IllegalStateException("Cycle detected; can only sort directed acyclic graphs"); // } // // if (!visited.contains(node)) { // // flagged.add(node); // for (E edgeNode : digraph.getAdjacent(node)) { // visit(edgeNode, result, flagged, visited); // } // // flagged.remove(node); // visited.add(node); // result.add(node); // } // } // } // Path: src/main/java/com/groupon/vertx/utils/config/Config.java import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import io.vertx.core.json.JsonObject; import com.groupon.vertx.utils.util.Digraph; import com.groupon.vertx.utils.util.TopSorter; /** * Copyright 2015 Groupon.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.groupon.vertx.utils.config; /** * Deployment configuration * * @author Tristan Blease (tblease at groupon dot com) * @since 2.0.2 * @version 2.0.2 */ public class Config implements Iterable<VerticleConfig> { private static final String VERTICLES_FIELD = "verticles"; private int total; private Map<String, VerticleConfig> verticles; private List<VerticleConfig> orderedVerticles; public Config(JsonObject config) { final JsonObject verticleJson = config.getJsonObject(VERTICLES_FIELD); if (verticleJson == null) { throw new IllegalStateException("Required config field `" + VERTICLES_FIELD + "` is missing"); } Set<String> verticleNames = verticleJson.fieldNames(); total = verticleNames.size(); verticles = new ConcurrentHashMap<>(total); for (String verticleName : verticleNames) { JsonObject verticleConfig = verticleJson.getJsonObject(verticleName); verticles.put(verticleName, new VerticleConfig(verticleName, verticleConfig)); } determineLoadOrder(); } private void determineLoadOrder() {
Digraph<VerticleConfig> dependencyGraph = new Digraph<>(verticles.size());
groupon/vertx-utils
src/main/java/com/groupon/vertx/utils/config/Config.java
// Path: src/main/java/com/groupon/vertx/utils/util/Digraph.java // public class Digraph<E> { // private Set<E> nodes; // private final Map<E, Set<E>> adjacent; // // public Digraph() { // this(0); // } // // public Digraph(int initialCapacity) { // nodes = new HashSet<>(initialCapacity); // adjacent = new ConcurrentHashMap<>(initialCapacity); // } // // public void addNode(E v) { // nodes.add(v); // } // // public void addEdge(E v, E w) { // if (!nodes.contains(v) || !nodes.contains(w)) { // throw new IllegalStateException("Both nodes must already exist in the graph prior to adding a connecting edge"); // } // // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.synchronizedSet(new HashSet<E>()); // adjacent.put(v, set); // } // // set.add(w); // } // // public Set<E> getNodes() { // return Collections.unmodifiableSet(nodes); // } // // public Iterable<E> getAdjacent(E v) { // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.emptySet(); // } // // return Collections.unmodifiableSet(set); // } // // @Override // public String toString() { // StringBuilder sb = new StringBuilder("Digraph["); // for (Map.Entry<E, Set<E>> entry : adjacent.entrySet()) { // E v = entry.getKey(); // for (E w : entry.getValue()) { // sb.append("["); // sb.append(v.toString()); // sb.append(" --> "); // sb.append(w.toString()); // sb.append("]"); // } // } // sb.append("]"); // return sb.toString(); // } // } // // Path: src/main/java/com/groupon/vertx/utils/util/TopSorter.java // public class TopSorter<E> { // private final Digraph<E> digraph; // // public TopSorter(Digraph<E> digraph) { // this.digraph = digraph; // } // // public List<E> sort() { // Set<E> nodes = digraph.getNodes(); // // List<E> result = new ArrayList<>(nodes.size()); // Set<E> flagged = new HashSet<>(nodes.size()); // Set<E> visited = new HashSet<>(nodes.size()); // // for (E node : nodes) { // visit(node, result, flagged, visited); // } // // return result; // } // // private void visit(E node, List<E> result, Set<E> flagged, Set<E> visited) { // if (flagged.contains(node)) { // throw new IllegalStateException("Cycle detected; can only sort directed acyclic graphs"); // } // // if (!visited.contains(node)) { // // flagged.add(node); // for (E edgeNode : digraph.getAdjacent(node)) { // visit(edgeNode, result, flagged, visited); // } // // flagged.remove(node); // visited.add(node); // result.add(node); // } // } // }
import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import io.vertx.core.json.JsonObject; import com.groupon.vertx.utils.util.Digraph; import com.groupon.vertx.utils.util.TopSorter;
verticles = new ConcurrentHashMap<>(total); for (String verticleName : verticleNames) { JsonObject verticleConfig = verticleJson.getJsonObject(verticleName); verticles.put(verticleName, new VerticleConfig(verticleName, verticleConfig)); } determineLoadOrder(); } private void determineLoadOrder() { Digraph<VerticleConfig> dependencyGraph = new Digraph<>(verticles.size()); for (VerticleConfig verticle : verticles.values()) { dependencyGraph.addNode(verticle); if (verticle.getDependencies().size() > 0) { for (String dependencyName : verticle.getDependencies()) { VerticleConfig dependency = verticles.get(dependencyName); if (dependency != null) { dependencyGraph.addNode(dependency); dependencyGraph.addEdge(verticle, dependency); } else { throw new IllegalStateException(String.format("Verticle '%s' depends on unknown dependency '%s'", verticle.getName(), dependencyName)); } } } }
// Path: src/main/java/com/groupon/vertx/utils/util/Digraph.java // public class Digraph<E> { // private Set<E> nodes; // private final Map<E, Set<E>> adjacent; // // public Digraph() { // this(0); // } // // public Digraph(int initialCapacity) { // nodes = new HashSet<>(initialCapacity); // adjacent = new ConcurrentHashMap<>(initialCapacity); // } // // public void addNode(E v) { // nodes.add(v); // } // // public void addEdge(E v, E w) { // if (!nodes.contains(v) || !nodes.contains(w)) { // throw new IllegalStateException("Both nodes must already exist in the graph prior to adding a connecting edge"); // } // // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.synchronizedSet(new HashSet<E>()); // adjacent.put(v, set); // } // // set.add(w); // } // // public Set<E> getNodes() { // return Collections.unmodifiableSet(nodes); // } // // public Iterable<E> getAdjacent(E v) { // Set<E> set = adjacent.get(v); // // if (set == null) { // set = Collections.emptySet(); // } // // return Collections.unmodifiableSet(set); // } // // @Override // public String toString() { // StringBuilder sb = new StringBuilder("Digraph["); // for (Map.Entry<E, Set<E>> entry : adjacent.entrySet()) { // E v = entry.getKey(); // for (E w : entry.getValue()) { // sb.append("["); // sb.append(v.toString()); // sb.append(" --> "); // sb.append(w.toString()); // sb.append("]"); // } // } // sb.append("]"); // return sb.toString(); // } // } // // Path: src/main/java/com/groupon/vertx/utils/util/TopSorter.java // public class TopSorter<E> { // private final Digraph<E> digraph; // // public TopSorter(Digraph<E> digraph) { // this.digraph = digraph; // } // // public List<E> sort() { // Set<E> nodes = digraph.getNodes(); // // List<E> result = new ArrayList<>(nodes.size()); // Set<E> flagged = new HashSet<>(nodes.size()); // Set<E> visited = new HashSet<>(nodes.size()); // // for (E node : nodes) { // visit(node, result, flagged, visited); // } // // return result; // } // // private void visit(E node, List<E> result, Set<E> flagged, Set<E> visited) { // if (flagged.contains(node)) { // throw new IllegalStateException("Cycle detected; can only sort directed acyclic graphs"); // } // // if (!visited.contains(node)) { // // flagged.add(node); // for (E edgeNode : digraph.getAdjacent(node)) { // visit(edgeNode, result, flagged, visited); // } // // flagged.remove(node); // visited.add(node); // result.add(node); // } // } // } // Path: src/main/java/com/groupon/vertx/utils/config/Config.java import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import io.vertx.core.json.JsonObject; import com.groupon.vertx.utils.util.Digraph; import com.groupon.vertx.utils.util.TopSorter; verticles = new ConcurrentHashMap<>(total); for (String verticleName : verticleNames) { JsonObject verticleConfig = verticleJson.getJsonObject(verticleName); verticles.put(verticleName, new VerticleConfig(verticleName, verticleConfig)); } determineLoadOrder(); } private void determineLoadOrder() { Digraph<VerticleConfig> dependencyGraph = new Digraph<>(verticles.size()); for (VerticleConfig verticle : verticles.values()) { dependencyGraph.addNode(verticle); if (verticle.getDependencies().size() > 0) { for (String dependencyName : verticle.getDependencies()) { VerticleConfig dependency = verticles.get(dependencyName); if (dependency != null) { dependencyGraph.addNode(dependency); dependencyGraph.addEdge(verticle, dependency); } else { throw new IllegalStateException(String.format("Verticle '%s' depends on unknown dependency '%s'", verticle.getName(), dependencyName)); } } } }
orderedVerticles = new TopSorter<>(dependencyGraph).sort();
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/printer/PrinterModel.java
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // }
import android.bluetooth.BluetoothDevice; import android.text.TextUtils; import com.am.mvp.core.MVPModel; import com.am.printer.PrintExecutor; import com.am.printer.PrintSocketHolder; import com.am.printer.PrinterWriter; import com.am.printer.PrinterWriter58mm; import com.am.printer.PrinterWriter80mm; import am.project.x.ProjectXApplication; import am.project.x.R;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * Model */ class PrinterModel extends MVPModel<PrinterPresenter> implements PrinterViewModel, PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener { private int mType = PrinterWriter80mm.TYPE_80; private boolean mImageEnable = true; private int mWidth = 300; private int mHeight = PrinterWriter.HEIGHT_PARTING_DEFAULT; private String mQRCodeData; private PrintExecutor mExecutor; private PrinterPrintDataMaker mMaker; PrinterModel() {
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // } // Path: app/src/main/java/am/project/x/business/others/printer/PrinterModel.java import android.bluetooth.BluetoothDevice; import android.text.TextUtils; import com.am.mvp.core.MVPModel; import com.am.printer.PrintExecutor; import com.am.printer.PrintSocketHolder; import com.am.printer.PrinterWriter; import com.am.printer.PrinterWriter58mm; import com.am.printer.PrinterWriter80mm; import am.project.x.ProjectXApplication; import am.project.x.R; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * Model */ class PrinterModel extends MVPModel<PrinterPresenter> implements PrinterViewModel, PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener { private int mType = PrinterWriter80mm.TYPE_80; private boolean mImageEnable = true; private int mWidth = 300; private int mHeight = PrinterWriter.HEIGHT_PARTING_DEFAULT; private String mQRCodeData; private PrintExecutor mExecutor; private PrinterPrintDataMaker mMaker; PrinterModel() {
mMaker = new PrinterPrintDataMaker(ProjectXApplication.getInstance(), mQRCodeData,
AlexMofer/ProjectX
app/src/main/java/am/project/x/broadcast/LocalBroadcastHelper.java
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // }
import android.content.Intent; import androidx.annotation.NonNull; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import am.project.x.ProjectXApplication;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.broadcast; /** * 应用内广播辅助器 * Created by Alex on 2018/7/23. */ public class LocalBroadcastHelper { public static final String ACTION_FTP_STARTED = "am.project.x.action.ACTION_FTP_STARTED"; public static final String ACTION_FTP_STOPPED = "am.project.x.action.ACTION_FTP_STOPPED"; private LocalBroadcastHelper() { //no instance } /** * 发送本地广播 * * @param action 要发送的广播动作 */ public static void sendBroadcast(@NonNull String action) { sendBroadcast(new Intent(action)); } /** * 发送本地广播 * * @param intent Intent */ @SuppressWarnings("WeakerAccess") public static void sendBroadcast(@NonNull Intent intent) {
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // } // Path: app/src/main/java/am/project/x/broadcast/LocalBroadcastHelper.java import android.content.Intent; import androidx.annotation.NonNull; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import am.project.x.ProjectXApplication; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.broadcast; /** * 应用内广播辅助器 * Created by Alex on 2018/7/23. */ public class LocalBroadcastHelper { public static final String ACTION_FTP_STARTED = "am.project.x.action.ACTION_FTP_STARTED"; public static final String ACTION_FTP_STOPPED = "am.project.x.action.ACTION_FTP_STOPPED"; private LocalBroadcastHelper() { //no instance } /** * 发送本地广播 * * @param action 要发送的广播动作 */ public static void sendBroadcast(@NonNull String action) { sendBroadcast(new Intent(action)); } /** * 发送本地广播 * * @param intent Intent */ @SuppressWarnings("WeakerAccess") public static void sendBroadcast(@NonNull Intent intent) {
final ProjectXApplication application = ProjectXApplication.getInstance();
AlexMofer/ProjectX
app/src/main/java/am/project/x/ProjectXApplication.java
// Path: app/src/main/java/am/project/x/broadcast/BroadcastApplication.java // @SuppressWarnings("unused") // @SuppressLint("Registered") // public class BroadcastApplication extends MultiDexApplication { // // private final BroadcastReceiver mBroadcastReceiver = new InnerBroadcastReceiver(); // private final BroadcastReceiver mLocalBroadcastReceiver = new InnerLocalBroadcastReceiver(); // private LocalBroadcastManager mLocalBroadcastManager;// 应用内部广播 // // @Override // public void onCreate() { // super.onCreate(); // final IntentFilter intentFilter = new IntentFilter(); // onAddAction(intentFilter); // registerReceiver(mBroadcastReceiver, intentFilter); // final IntentFilter localIntentFilter = new IntentFilter(); // onAddLocalAction(localIntentFilter); // mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // mLocalBroadcastManager.registerReceiver(mLocalBroadcastReceiver, localIntentFilter); // } // // @Override // public void onTerminate() { // unregisterReceiver(mBroadcastReceiver); // mLocalBroadcastManager.unregisterReceiver(mLocalBroadcastReceiver); // super.onTerminate(); // } // // /** // * 添加广播意图筛选器动作 // * // * @param filter 筛选器 // */ // protected void onAddAction(IntentFilter filter) { // } // // /** // * 添加本地广播意图筛选器动作 // * // * @param filter 筛选器 // */ // protected void onAddLocalAction(IntentFilter filter) { // } // // /** // * 接收到广播 // * // * @param context Context // * @param intent 意图 // */ // protected void onReceiveBroadcast(Context context, Intent intent) { // } // // /** // * 接收到本地广播 // * // * @param context Context // * @param intent 意图 // */ // protected void onReceiveLocalBroadcast(Context context, Intent intent) { // } // // /** // * 获取本地广播管理器 // * // * @return 本地广播管理器 // */ // public LocalBroadcastManager getLocalBroadcastManager() { // return mLocalBroadcastManager; // } // // private class InnerBroadcastReceiver extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // onReceiveBroadcast(context, intent); // } // } // // private class InnerLocalBroadcastReceiver extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // onReceiveLocalBroadcast(context, intent); // } // } // } // // Path: app/src/main/java/am/project/x/notification/NotificationChannelHelper.java // public class NotificationChannelHelper { // private static final String CHANEL_ID_LOW = "am.project.ftpgo.notification.CHANEL_LOW";// 不发出提示音 // // /** // * 更新通知渠道 // * // * @param context Context // */ // public static void updateNotificationChannel(Context context) { // updateChannelLow(context); // } // // static String getChannelLow(Context context) { // updateChannelLow(context); // return CHANEL_ID_LOW; // } // // @Nullable // private static NotificationManager getNotificationManager(Context context) { // return (NotificationManager) context.getSystemService( // Context.NOTIFICATION_SERVICE); // } // // private static void updateChannelLow(Context context) { // if (Build.VERSION.SDK_INT < 26) // return; // NotificationManager manager = getNotificationManager(context); // if (manager == null) // return; // NotificationChannel channel = manager.getNotificationChannel(CHANEL_ID_LOW); // final String name = context.getString(R.string.notification_name_low); // if (channel == null) { // channel = new NotificationChannel(CHANEL_ID_LOW, name, // NotificationManager.IMPORTANCE_LOW); // manager.createNotificationChannel(channel); // } // channel.setName(name); // } // // }
import am.project.x.broadcast.BroadcastApplication; import am.project.x.notification.NotificationChannelHelper;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x; /** * 应用Application * 做一些全局变量存储 * Created by Alex on 2018/7/23. */ public class ProjectXApplication extends BroadcastApplication { private static ProjectXApplication mInstance; @Override public void onCreate() { mInstance = this; super.onCreate();
// Path: app/src/main/java/am/project/x/broadcast/BroadcastApplication.java // @SuppressWarnings("unused") // @SuppressLint("Registered") // public class BroadcastApplication extends MultiDexApplication { // // private final BroadcastReceiver mBroadcastReceiver = new InnerBroadcastReceiver(); // private final BroadcastReceiver mLocalBroadcastReceiver = new InnerLocalBroadcastReceiver(); // private LocalBroadcastManager mLocalBroadcastManager;// 应用内部广播 // // @Override // public void onCreate() { // super.onCreate(); // final IntentFilter intentFilter = new IntentFilter(); // onAddAction(intentFilter); // registerReceiver(mBroadcastReceiver, intentFilter); // final IntentFilter localIntentFilter = new IntentFilter(); // onAddLocalAction(localIntentFilter); // mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // mLocalBroadcastManager.registerReceiver(mLocalBroadcastReceiver, localIntentFilter); // } // // @Override // public void onTerminate() { // unregisterReceiver(mBroadcastReceiver); // mLocalBroadcastManager.unregisterReceiver(mLocalBroadcastReceiver); // super.onTerminate(); // } // // /** // * 添加广播意图筛选器动作 // * // * @param filter 筛选器 // */ // protected void onAddAction(IntentFilter filter) { // } // // /** // * 添加本地广播意图筛选器动作 // * // * @param filter 筛选器 // */ // protected void onAddLocalAction(IntentFilter filter) { // } // // /** // * 接收到广播 // * // * @param context Context // * @param intent 意图 // */ // protected void onReceiveBroadcast(Context context, Intent intent) { // } // // /** // * 接收到本地广播 // * // * @param context Context // * @param intent 意图 // */ // protected void onReceiveLocalBroadcast(Context context, Intent intent) { // } // // /** // * 获取本地广播管理器 // * // * @return 本地广播管理器 // */ // public LocalBroadcastManager getLocalBroadcastManager() { // return mLocalBroadcastManager; // } // // private class InnerBroadcastReceiver extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // onReceiveBroadcast(context, intent); // } // } // // private class InnerLocalBroadcastReceiver extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // onReceiveLocalBroadcast(context, intent); // } // } // } // // Path: app/src/main/java/am/project/x/notification/NotificationChannelHelper.java // public class NotificationChannelHelper { // private static final String CHANEL_ID_LOW = "am.project.ftpgo.notification.CHANEL_LOW";// 不发出提示音 // // /** // * 更新通知渠道 // * // * @param context Context // */ // public static void updateNotificationChannel(Context context) { // updateChannelLow(context); // } // // static String getChannelLow(Context context) { // updateChannelLow(context); // return CHANEL_ID_LOW; // } // // @Nullable // private static NotificationManager getNotificationManager(Context context) { // return (NotificationManager) context.getSystemService( // Context.NOTIFICATION_SERVICE); // } // // private static void updateChannelLow(Context context) { // if (Build.VERSION.SDK_INT < 26) // return; // NotificationManager manager = getNotificationManager(context); // if (manager == null) // return; // NotificationChannel channel = manager.getNotificationChannel(CHANEL_ID_LOW); // final String name = context.getString(R.string.notification_name_low); // if (channel == null) { // channel = new NotificationChannel(CHANEL_ID_LOW, name, // NotificationManager.IMPORTANCE_LOW); // manager.createNotificationChannel(channel); // } // channel.setName(name); // } // // } // Path: app/src/main/java/am/project/x/ProjectXApplication.java import am.project.x.broadcast.BroadcastApplication; import am.project.x.notification.NotificationChannelHelper; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x; /** * 应用Application * 做一些全局变量存储 * Created by Alex on 2018/7/23. */ public class ProjectXApplication extends BroadcastApplication { private static ProjectXApplication mInstance; @Override public void onCreate() { mInstance = this; super.onCreate();
NotificationChannelHelper.updateNotificationChannel(this);
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/opentype/OpenTypeModel.java
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // }
import android.content.Context; import androidx.annotation.Nullable; import com.am.font.opentype.OpenType; import com.am.font.opentype.OpenTypeCollection; import com.am.font.opentype.TableRecord; import com.am.font.opentype.tables.BaseTable; import com.am.font.opentype.tables.NamingTable; import com.am.mvp.core.MVPModel; import am.project.x.ProjectXApplication; import am.project.x.R;
if (mFont == null && mFonts == null) return 0; if (mFonts == null) { return mFont.getTablesSize() + 1; } else { if (mFont == null) return 1; return mFont.getTablesSize() + 2; } } @Override public Object getItem(int position) { if (mFont == null && mFonts == null) return null; if (mFonts == null) { return position == 0 ? mFont : mFont.getTableRecordByIndex(position - 1); } else { if (mFont == null) return mFonts; if (position == 0) return mFonts; else if (position == 1) return mFont; return mFont.getTableRecordByIndex(position - 2); } } @Override public String getItemLabel(Object item) {
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // } // Path: app/src/main/java/am/project/x/business/others/opentype/OpenTypeModel.java import android.content.Context; import androidx.annotation.Nullable; import com.am.font.opentype.OpenType; import com.am.font.opentype.OpenTypeCollection; import com.am.font.opentype.TableRecord; import com.am.font.opentype.tables.BaseTable; import com.am.font.opentype.tables.NamingTable; import com.am.mvp.core.MVPModel; import am.project.x.ProjectXApplication; import am.project.x.R; if (mFont == null && mFonts == null) return 0; if (mFonts == null) { return mFont.getTablesSize() + 1; } else { if (mFont == null) return 1; return mFont.getTablesSize() + 2; } } @Override public Object getItem(int position) { if (mFont == null && mFonts == null) return null; if (mFonts == null) { return position == 0 ? mFont : mFont.getTableRecordByIndex(position - 1); } else { if (mFont == null) return mFonts; if (position == 0) return mFonts; else if (position == 1) return mFont; return mFont.getTableRecordByIndex(position - 2); } } @Override public String getItemLabel(Object item) {
final Context context = ProjectXApplication.getInstance();
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/ftp/advanced/AdvancedFragment.java
// Path: app/src/main/java/am/project/x/business/others/ftp/FtpFragmentCallback.java // public interface FtpFragmentCallback { // // /** // * 切换 // * // * @param legacy 是否为传统方式 // */ // void onSwitch(boolean legacy); // }
import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import com.am.appcompat.app.Fragment; import com.am.tool.support.utils.InputMethodUtils; import java.util.Locale; import am.project.x.R; import am.project.x.business.others.ftp.FtpFragmentCallback; import am.project.x.utils.ContextUtils;
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setHasOptionsMenu(true); mVPort = findViewById(R.id.advanced_edt_port); mVAuto = findViewById(R.id.advanced_cb_auto); mVUri = findViewById(R.id.advanced_btn_uri); mConfig = new AdvancedFtpConfig(requireContext()); mVPort.setText(String.format(Locale.getDefault(), "%d", mConfig.getPort())); mVAuto.setChecked(mConfig.isAutoChangePort()); mVUri.setText(mConfig.getUri()); mVPort.addTextChangedListener(this); mVAuto.setOnCheckedChangeListener(this); mVUri.addTextChangedListener(this); findViewById(R.id.advanced_btn_open).setOnClickListener(this); findViewById(R.id.advanced_btn_close).setOnClickListener(this); mVUri.setOnClickListener(this); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_ftp_advanced, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.ftp_legacy) { final Activity activity = getActivity();
// Path: app/src/main/java/am/project/x/business/others/ftp/FtpFragmentCallback.java // public interface FtpFragmentCallback { // // /** // * 切换 // * // * @param legacy 是否为传统方式 // */ // void onSwitch(boolean legacy); // } // Path: app/src/main/java/am/project/x/business/others/ftp/advanced/AdvancedFragment.java import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import com.am.appcompat.app.Fragment; import com.am.tool.support.utils.InputMethodUtils; import java.util.Locale; import am.project.x.R; import am.project.x.business.others.ftp.FtpFragmentCallback; import am.project.x.utils.ContextUtils; public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setHasOptionsMenu(true); mVPort = findViewById(R.id.advanced_edt_port); mVAuto = findViewById(R.id.advanced_cb_auto); mVUri = findViewById(R.id.advanced_btn_uri); mConfig = new AdvancedFtpConfig(requireContext()); mVPort.setText(String.format(Locale.getDefault(), "%d", mConfig.getPort())); mVAuto.setChecked(mConfig.isAutoChangePort()); mVUri.setText(mConfig.getUri()); mVPort.addTextChangedListener(this); mVAuto.setOnCheckedChangeListener(this); mVUri.addTextChangedListener(this); findViewById(R.id.advanced_btn_open).setOnClickListener(this); findViewById(R.id.advanced_btn_close).setOnClickListener(this); mVUri.setOnClickListener(this); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_ftp_advanced, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.ftp_legacy) { final Activity activity = getActivity();
if (activity instanceof FtpFragmentCallback)
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/printer/PrinterStateDialog.java
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // }
import android.content.Context; import android.text.TextUtils; import android.view.View; import android.widget.TextView; import java.util.Locale; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import androidx.core.widget.NestedScrollView;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 打印信息对话框 */ class PrinterStateDialog extends AppCompatDialog implements View.OnLayoutChangeListener, View.OnClickListener { private final OnDialogListener mListener; private NestedScrollView mVContent; private TextView mVState; private View mVNegative; private View mVPositive; PrinterStateDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // } // Path: app/src/main/java/am/project/x/business/others/printer/PrinterStateDialog.java import android.content.Context; import android.text.TextUtils; import android.view.View; import android.widget.TextView; import java.util.Locale; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import androidx.core.widget.NestedScrollView; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 打印信息对话框 */ class PrinterStateDialog extends AppCompatDialog implements View.OnLayoutChangeListener, View.OnClickListener { private final OnDialogListener mListener; private NestedScrollView mVContent; private TextView mVState; private View mVNegative; private View mVPositive; PrinterStateDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
super(context, AlertDialogUtils.getAlertDialogTheme(context));
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/printer/PrinterIPDialog.java
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // } // // Path: app/src/main/java/am/project/x/utils/StringUtils.java // @SuppressWarnings("unused") // public class StringUtils { // // /** // * 字符串匹配 // * // * @param src 源 // * @param des 匹配样式 // * @return 是否匹配 // */ // public static boolean isMatching(@NonNull String src, @NonNull String des) { // String regex = des.replace("*", "\\w*").replace("?", "\\w{1}"); // return Pattern.compile(regex).matcher(src).matches(); // } // // /** // * 判断是否是一个IP // * // * @param IP 字符串 // * @return 是否是一个IP // */ // public static boolean isIp(@NonNull String IP) { // boolean b = false; // IP = IP.trim(); // while (IP.startsWith(" ")) { // IP = IP.substring(1).trim(); // } // while (IP.endsWith(" ")) { // IP = IP.substring(0, IP.length() - 1).trim(); // } // if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) { // String s[] = IP.split("\\."); // if (Integer.parseInt(s[0]) < 255) // if (Integer.parseInt(s[1]) < 255) // if (Integer.parseInt(s[2]) < 255) // if (Integer.parseInt(s[3]) < 255) // b = true; // } // return b; // } // }
import android.content.Context; import android.view.View; import android.widget.EditText; import android.widget.Toast; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import am.project.x.utils.StringUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import com.am.tool.support.utils.InputMethodUtils;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 固定IP填写对话框 */ class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener { private final OnDialogListener mListener; private final EditText mVIp; private final EditText mVPort; PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // } // // Path: app/src/main/java/am/project/x/utils/StringUtils.java // @SuppressWarnings("unused") // public class StringUtils { // // /** // * 字符串匹配 // * // * @param src 源 // * @param des 匹配样式 // * @return 是否匹配 // */ // public static boolean isMatching(@NonNull String src, @NonNull String des) { // String regex = des.replace("*", "\\w*").replace("?", "\\w{1}"); // return Pattern.compile(regex).matcher(src).matches(); // } // // /** // * 判断是否是一个IP // * // * @param IP 字符串 // * @return 是否是一个IP // */ // public static boolean isIp(@NonNull String IP) { // boolean b = false; // IP = IP.trim(); // while (IP.startsWith(" ")) { // IP = IP.substring(1).trim(); // } // while (IP.endsWith(" ")) { // IP = IP.substring(0, IP.length() - 1).trim(); // } // if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) { // String s[] = IP.split("\\."); // if (Integer.parseInt(s[0]) < 255) // if (Integer.parseInt(s[1]) < 255) // if (Integer.parseInt(s[2]) < 255) // if (Integer.parseInt(s[3]) < 255) // b = true; // } // return b; // } // } // Path: app/src/main/java/am/project/x/business/others/printer/PrinterIPDialog.java import android.content.Context; import android.view.View; import android.widget.EditText; import android.widget.Toast; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import am.project.x.utils.StringUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import com.am.tool.support.utils.InputMethodUtils; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 固定IP填写对话框 */ class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener { private final OnDialogListener mListener; private final EditText mVIp; private final EditText mVPort; PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) {
super(context, AlertDialogUtils.getAlertDialogTheme(context));
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/printer/PrinterIPDialog.java
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // } // // Path: app/src/main/java/am/project/x/utils/StringUtils.java // @SuppressWarnings("unused") // public class StringUtils { // // /** // * 字符串匹配 // * // * @param src 源 // * @param des 匹配样式 // * @return 是否匹配 // */ // public static boolean isMatching(@NonNull String src, @NonNull String des) { // String regex = des.replace("*", "\\w*").replace("?", "\\w{1}"); // return Pattern.compile(regex).matcher(src).matches(); // } // // /** // * 判断是否是一个IP // * // * @param IP 字符串 // * @return 是否是一个IP // */ // public static boolean isIp(@NonNull String IP) { // boolean b = false; // IP = IP.trim(); // while (IP.startsWith(" ")) { // IP = IP.substring(1).trim(); // } // while (IP.endsWith(" ")) { // IP = IP.substring(0, IP.length() - 1).trim(); // } // if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) { // String s[] = IP.split("\\."); // if (Integer.parseInt(s[0]) < 255) // if (Integer.parseInt(s[1]) < 255) // if (Integer.parseInt(s[2]) < 255) // if (Integer.parseInt(s[3]) < 255) // b = true; // } // return b; // } // }
import android.content.Context; import android.view.View; import android.widget.EditText; import android.widget.Toast; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import am.project.x.utils.StringUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import com.am.tool.support.utils.InputMethodUtils;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 固定IP填写对话框 */ class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener { private final OnDialogListener mListener; private final EditText mVIp; private final EditText mVPort; PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) { super(context, AlertDialogUtils.getAlertDialogTheme(context)); mListener = listener; setContentView(R.layout.dlg_printer_ip); mVIp = findViewById(R.id.dpi_edt_ip); mVPort = findViewById(R.id.dpi_edt_port); final View positive = findViewById(R.id.dpi_btn_positive); if (positive != null) positive.setOnClickListener(this); } // Listener @Override public void onClick(View v) { final String ip = mVIp.getText().toString().trim(); if (ip.length() <= 0) { Toast.makeText(getContext(), R.string.printer_edit_toast_1, Toast.LENGTH_SHORT).show(); InputMethodUtils.openInputMethod(mVIp); return;
// Path: app/src/main/java/am/project/x/utils/AlertDialogUtils.java // public class AlertDialogUtils { // // private AlertDialogUtils() { // //no instance // } // // /** // * 获取警告对话框主题 // * // * @param context Context // * @return 主题 // */ // public static int getAlertDialogTheme(Context context) { // final TypedValue outValue = new TypedValue(); // context.getTheme().resolveAttribute(androidx.appcompat.R.attr.alertDialogTheme, // outValue, true); // return outValue.resourceId; // } // } // // Path: app/src/main/java/am/project/x/utils/StringUtils.java // @SuppressWarnings("unused") // public class StringUtils { // // /** // * 字符串匹配 // * // * @param src 源 // * @param des 匹配样式 // * @return 是否匹配 // */ // public static boolean isMatching(@NonNull String src, @NonNull String des) { // String regex = des.replace("*", "\\w*").replace("?", "\\w{1}"); // return Pattern.compile(regex).matcher(src).matches(); // } // // /** // * 判断是否是一个IP // * // * @param IP 字符串 // * @return 是否是一个IP // */ // public static boolean isIp(@NonNull String IP) { // boolean b = false; // IP = IP.trim(); // while (IP.startsWith(" ")) { // IP = IP.substring(1).trim(); // } // while (IP.endsWith(" ")) { // IP = IP.substring(0, IP.length() - 1).trim(); // } // if (IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) { // String s[] = IP.split("\\."); // if (Integer.parseInt(s[0]) < 255) // if (Integer.parseInt(s[1]) < 255) // if (Integer.parseInt(s[2]) < 255) // if (Integer.parseInt(s[3]) < 255) // b = true; // } // return b; // } // } // Path: app/src/main/java/am/project/x/business/others/printer/PrinterIPDialog.java import android.content.Context; import android.view.View; import android.widget.EditText; import android.widget.Toast; import am.project.x.R; import am.project.x.utils.AlertDialogUtils; import am.project.x.utils.StringUtils; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatDialog; import com.am.tool.support.utils.InputMethodUtils; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.printer; /** * 固定IP填写对话框 */ class PrinterIPDialog extends AppCompatDialog implements View.OnClickListener { private final OnDialogListener mListener; private final EditText mVIp; private final EditText mVPort; PrinterIPDialog(@NonNull Context context, @NonNull OnDialogListener listener) { super(context, AlertDialogUtils.getAlertDialogTheme(context)); mListener = listener; setContentView(R.layout.dlg_printer_ip); mVIp = findViewById(R.id.dpi_edt_ip); mVPort = findViewById(R.id.dpi_edt_port); final View positive = findViewById(R.id.dpi_btn_positive); if (positive != null) positive.setOnClickListener(this); } // Listener @Override public void onClick(View v) { final String ip = mVIp.getText().toString().trim(); if (ip.length() <= 0) { Toast.makeText(getContext(), R.string.printer_edit_toast_1, Toast.LENGTH_SHORT).show(); InputMethodUtils.openInputMethod(mVIp); return;
} else if (!StringUtils.isIp(ip)) {
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/ftp/FtpServiceHelper.java
// Path: app/src/main/java/am/project/x/business/others/ftp/legacy/LegacyFtpService.java // public class LegacyFtpService extends Service { // private static boolean STARTED = false; // private FtpServer mFTP; // private boolean mAutoClose = false; // private final BroadcastReceiver mBroadcastReceiver = // new BroadcastReceiver() { // @Override // public void onReceive(Context context, Intent intent) { // if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) { // onConnectivityChanged(); // } // } // }; // // public LegacyFtpService() { // } // // public static void start(Context context) { // context.startService(new Intent(context, LegacyFtpService.class)); // } // // public static void stop(Context context) { // context.stopService(new Intent(context, LegacyFtpService.class)); // } // // public static boolean isStarted() { // return STARTED; // } // // @Override // public IBinder onBind(Intent intent) { // return null; // } // // @Override // public int onStartCommand(Intent intent, int flags, int startId) { // if (STARTED) // return super.onStartCommand(intent, flags, startId); // if (!ContextUtils.isWifiConnected(this)) { // Toast.makeText(this, R.string.ftp_toast_no_wifi, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // mAutoClose = true; // final LegacyFtpConfig config = new LegacyFtpConfig(this); // int port = config.getPort(); // if (config.isAutoChangePort()) { // boolean check = false; // while (!Utils.isPortAvailable(port)) { // port++; // if (port > 65535) { // if (check) { // port = 65535; // break; // } else { // port = 1; // check = true; // } // } // } // } // if (!Utils.isPortAvailable(port)) { // Toast.makeText(this, R.string.ftp_toast_port, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // final String path = config.getPath(); // if (TextUtils.isEmpty(path)) { // Toast.makeText(this, R.string.ftp_toast_no_root, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // if (Build.VERSION.SDK_INT >= 23 && // !ContextUtils.hasWritePermission(this, path)) { // Toast.makeText(this, R.string.ftp_toast_no_permission, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // mFTP = FtpServer.createServer(port, path); // try { // mFTP.start(); // } catch (Exception e) { // mFTP = null; // Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); // stopSelf(startId); // } // final String title = getString(R.string.ftp_notification_title); // final String text = getString(R.string.ftp_notification_text, // ContextUtils.getWifiIp(this), port); // startForeground(NotificationMaker.ID_FTP, // NotificationMaker.getFTPRunning(this, title, text, // PendingIntent.getActivity(this, NotificationMaker.ID_FTP, // FtpActivity.getStarter(this), // PendingIntent.FLAG_UPDATE_CURRENT))); // STARTED = true; // LocalBroadcastHelper.sendBroadcast(LocalBroadcastHelper.ACTION_FTP_STARTED); // return super.onStartCommand(intent, flags, startId); // } // // @Override // public void onCreate() { // super.onCreate(); // final IntentFilter intentFilter = new IntentFilter(); // intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); // registerReceiver(mBroadcastReceiver, intentFilter); // } // // @Override // public void onDestroy() { // unregisterReceiver(mBroadcastReceiver); // if (mFTP != null) { // mFTP.stop(); // mFTP = null; // } // STARTED = false; // super.onDestroy(); // LocalBroadcastHelper.sendBroadcast(LocalBroadcastHelper.ACTION_FTP_STOPPED); // } // // protected void onConnectivityChanged() { // if (mAutoClose && !ContextUtils.isWifiConnected(this)) { // stopSelf(); // } // } // }
import android.content.Context; import am.project.x.business.others.ftp.legacy.LegacyFtpService;
/* * Copyright (C) 2019 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.ftp; /** * FTP服务辅助器 * Created by Alex on 2019/10/10. */ final class FtpServiceHelper { private static FtpServiceHelper mInstance; private FtpServiceHelper() { //no instance } public static FtpServiceHelper getInstance() { if (mInstance == null) mInstance = new FtpServiceHelper(); return mInstance; } /** * 判断服务是否开启 * * @return 服务已开启时返回true */ boolean isStarted() {
// Path: app/src/main/java/am/project/x/business/others/ftp/legacy/LegacyFtpService.java // public class LegacyFtpService extends Service { // private static boolean STARTED = false; // private FtpServer mFTP; // private boolean mAutoClose = false; // private final BroadcastReceiver mBroadcastReceiver = // new BroadcastReceiver() { // @Override // public void onReceive(Context context, Intent intent) { // if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) { // onConnectivityChanged(); // } // } // }; // // public LegacyFtpService() { // } // // public static void start(Context context) { // context.startService(new Intent(context, LegacyFtpService.class)); // } // // public static void stop(Context context) { // context.stopService(new Intent(context, LegacyFtpService.class)); // } // // public static boolean isStarted() { // return STARTED; // } // // @Override // public IBinder onBind(Intent intent) { // return null; // } // // @Override // public int onStartCommand(Intent intent, int flags, int startId) { // if (STARTED) // return super.onStartCommand(intent, flags, startId); // if (!ContextUtils.isWifiConnected(this)) { // Toast.makeText(this, R.string.ftp_toast_no_wifi, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // mAutoClose = true; // final LegacyFtpConfig config = new LegacyFtpConfig(this); // int port = config.getPort(); // if (config.isAutoChangePort()) { // boolean check = false; // while (!Utils.isPortAvailable(port)) { // port++; // if (port > 65535) { // if (check) { // port = 65535; // break; // } else { // port = 1; // check = true; // } // } // } // } // if (!Utils.isPortAvailable(port)) { // Toast.makeText(this, R.string.ftp_toast_port, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // final String path = config.getPath(); // if (TextUtils.isEmpty(path)) { // Toast.makeText(this, R.string.ftp_toast_no_root, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // if (Build.VERSION.SDK_INT >= 23 && // !ContextUtils.hasWritePermission(this, path)) { // Toast.makeText(this, R.string.ftp_toast_no_permission, Toast.LENGTH_SHORT).show(); // return super.onStartCommand(intent, flags, startId); // } // mFTP = FtpServer.createServer(port, path); // try { // mFTP.start(); // } catch (Exception e) { // mFTP = null; // Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); // stopSelf(startId); // } // final String title = getString(R.string.ftp_notification_title); // final String text = getString(R.string.ftp_notification_text, // ContextUtils.getWifiIp(this), port); // startForeground(NotificationMaker.ID_FTP, // NotificationMaker.getFTPRunning(this, title, text, // PendingIntent.getActivity(this, NotificationMaker.ID_FTP, // FtpActivity.getStarter(this), // PendingIntent.FLAG_UPDATE_CURRENT))); // STARTED = true; // LocalBroadcastHelper.sendBroadcast(LocalBroadcastHelper.ACTION_FTP_STARTED); // return super.onStartCommand(intent, flags, startId); // } // // @Override // public void onCreate() { // super.onCreate(); // final IntentFilter intentFilter = new IntentFilter(); // intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); // registerReceiver(mBroadcastReceiver, intentFilter); // } // // @Override // public void onDestroy() { // unregisterReceiver(mBroadcastReceiver); // if (mFTP != null) { // mFTP.stop(); // mFTP = null; // } // STARTED = false; // super.onDestroy(); // LocalBroadcastHelper.sendBroadcast(LocalBroadcastHelper.ACTION_FTP_STOPPED); // } // // protected void onConnectivityChanged() { // if (mAutoClose && !ContextUtils.isWifiConnected(this)) { // stopSelf(); // } // } // } // Path: app/src/main/java/am/project/x/business/others/ftp/FtpServiceHelper.java import android.content.Context; import am.project.x.business.others.ftp.legacy.LegacyFtpService; /* * Copyright (C) 2019 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.others.ftp; /** * FTP服务辅助器 * Created by Alex on 2019/10/10. */ final class FtpServiceHelper { private static FtpServiceHelper mInstance; private FtpServiceHelper() { //no instance } public static FtpServiceHelper getInstance() { if (mInstance == null) mInstance = new FtpServiceHelper(); return mInstance; } /** * 判断服务是否开启 * * @return 服务已开启时返回true */ boolean isStarted() {
return LegacyFtpService.isStarted();
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/ftp/legacy/LegacyFragment.java
// Path: app/src/main/java/am/project/x/business/others/ftp/FtpFragmentCallback.java // public interface FtpFragmentCallback { // // /** // * 切换 // * // * @param legacy 是否为传统方式 // */ // void onSwitch(boolean legacy); // }
import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.am.appcompat.app.Fragment; import com.am.tool.support.utils.InputMethodUtils; import java.io.File; import java.util.Locale; import am.project.x.R; import am.project.x.business.others.ftp.FtpFragmentCallback; import am.project.x.utils.ContextUtils;
mConfig = new LegacyFtpConfig(requireContext()); mVPort.setText(String.format(Locale.getDefault(), "%d", mConfig.getPort())); mVAuto.setChecked(mConfig.isAutoChangePort()); if (Build.VERSION.SDK_INT >= 23 && !ContextUtils.hasWriteExternalStoragePermission(requireContext())) mVPath.setText(null); else { if (mConfig.getPath() == null) mConfig.setPath(Environment.getExternalStorageDirectory().getAbsolutePath()); mVPath.setText(mConfig.getPath()); } mVPort.addTextChangedListener(this); mVAuto.setOnCheckedChangeListener(this); mVPath.addTextChangedListener(this); findViewById(R.id.legacy_btn_open).setOnClickListener(this); findViewById(R.id.legacy_btn_close).setOnClickListener(this); mVPath.setOnClickListener(this); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_ftp_legacy, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.ftp_advanced) { final Activity activity = getActivity();
// Path: app/src/main/java/am/project/x/business/others/ftp/FtpFragmentCallback.java // public interface FtpFragmentCallback { // // /** // * 切换 // * // * @param legacy 是否为传统方式 // */ // void onSwitch(boolean legacy); // } // Path: app/src/main/java/am/project/x/business/others/ftp/legacy/LegacyFragment.java import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.am.appcompat.app.Fragment; import com.am.tool.support.utils.InputMethodUtils; import java.io.File; import java.util.Locale; import am.project.x.R; import am.project.x.business.others.ftp.FtpFragmentCallback; import am.project.x.utils.ContextUtils; mConfig = new LegacyFtpConfig(requireContext()); mVPort.setText(String.format(Locale.getDefault(), "%d", mConfig.getPort())); mVAuto.setChecked(mConfig.isAutoChangePort()); if (Build.VERSION.SDK_INT >= 23 && !ContextUtils.hasWriteExternalStoragePermission(requireContext())) mVPath.setText(null); else { if (mConfig.getPath() == null) mConfig.setPath(Environment.getExternalStorageDirectory().getAbsolutePath()); mVPath.setText(mConfig.getPath()); } mVPort.addTextChangedListener(this); mVAuto.setOnCheckedChangeListener(this); mVPath.addTextChangedListener(this); findViewById(R.id.legacy_btn_open).setOnClickListener(this); findViewById(R.id.legacy_btn_close).setOnClickListener(this); mVPath.setOnClickListener(this); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_ftp_legacy, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.ftp_advanced) { final Activity activity = getActivity();
if (activity instanceof FtpFragmentCallback)
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/about/AboutActivity.java
// Path: app/src/main/java/am/project/x/business/browser/BrowserActivity.java // public class BrowserActivity extends AppCompatActivity implements PowerfulWebView.OnTitleListener { // // private static final String EXTRA_URL = "url"; // private PowerfulWebView mVContent; // // public BrowserActivity() { // super(R.layout.activity_browser); // } // // public static void start(Context context, String url) { // final Intent starter = new Intent(context, BrowserActivity.class); // starter.putExtra(EXTRA_URL, url); // context.startActivity(starter); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.browser_toolbar); // final String url = getIntent().getStringExtra(EXTRA_URL); // if (TextUtils.isEmpty(url)) { // finish(); // return; // } // setTitle(""); // mVContent = findViewById(R.id.browser_wb_content); // WebSettings webSettings = mVContent.getSettings(); // webSettings.setUseWideViewPort(true); // webSettings.setLoadWithOverviewMode(true); // webSettings.setSupportZoom(true); // webSettings.setNeedInitialFocus(true); // webSettings.setBuiltInZoomControls(true); // webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // webSettings.setBlockNetworkImage(false); // webSettings.setLoadsImagesAutomatically(true); // webSettings.setDisplayZoomControls(false); // webSettings.setDomStorageEnabled(true); // webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); // if (Build.VERSION.SDK_INT >= 21) { // webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // } // webSettings.setDefaultTextEncodingName("utf-8"); // mVContent.setWebViewClient(new PowerfulWebView.StateWebViewClient()); // mVContent.setOnTitleListener(this); // mVContent.loadUrl(url); // } // // @Override // protected void onResume() { // super.onResume(); // mVContent.onResume(); // mVContent.resumeTimers(); // } // // @Override // protected void onPause() { // super.onPause(); // mVContent.onPause(); // mVContent.pauseTimers(); // } // // @Override // protected void onDestroy() { // super.onDestroy(); // mVContent.powerfulDestroy(); // } // // @Override // public void onBackPressed() { // if (mVContent.canGoBack()) { // mVContent.goBack(); // return; // } // super.onBackPressed(); // } // // // Listener // @Override // public void onTitleChanged(PowerfulWebView view, String title) { // setTitle(title); // } // // } // // Path: app/src/main/java/am/project/x/utils/ViewUtils.java // public class ViewUtils { // // private ViewUtils() { // //no instance // } // // /** // * 设置布局可绘制在状态栏下 // * // * @param navigation 是否包含导航栏 // */ // public static void setLayoutFullscreen(View view, boolean navigation) { // if (view == null) // return; // if (Build.VERSION.SDK_INT >= 16) { // int visibility = view.getSystemUiVisibility(); // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; // if (navigation) { // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; // } // view.setSystemUiVisibility(visibility); // } // } // }
import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import androidx.annotation.Nullable; import com.am.appcompat.app.AppCompatActivity; import am.project.x.BuildConfig; import am.project.x.R; import am.project.x.business.browser.BrowserActivity; import am.project.x.utils.ViewUtils;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.about; /** * 关于 */ public class AboutActivity extends AppCompatActivity { public AboutActivity() { super(R.layout.activity_about); } public static void start(Context context) { context.startActivity(new Intent(context, AboutActivity.class)); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Path: app/src/main/java/am/project/x/business/browser/BrowserActivity.java // public class BrowserActivity extends AppCompatActivity implements PowerfulWebView.OnTitleListener { // // private static final String EXTRA_URL = "url"; // private PowerfulWebView mVContent; // // public BrowserActivity() { // super(R.layout.activity_browser); // } // // public static void start(Context context, String url) { // final Intent starter = new Intent(context, BrowserActivity.class); // starter.putExtra(EXTRA_URL, url); // context.startActivity(starter); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.browser_toolbar); // final String url = getIntent().getStringExtra(EXTRA_URL); // if (TextUtils.isEmpty(url)) { // finish(); // return; // } // setTitle(""); // mVContent = findViewById(R.id.browser_wb_content); // WebSettings webSettings = mVContent.getSettings(); // webSettings.setUseWideViewPort(true); // webSettings.setLoadWithOverviewMode(true); // webSettings.setSupportZoom(true); // webSettings.setNeedInitialFocus(true); // webSettings.setBuiltInZoomControls(true); // webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // webSettings.setBlockNetworkImage(false); // webSettings.setLoadsImagesAutomatically(true); // webSettings.setDisplayZoomControls(false); // webSettings.setDomStorageEnabled(true); // webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); // if (Build.VERSION.SDK_INT >= 21) { // webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // } // webSettings.setDefaultTextEncodingName("utf-8"); // mVContent.setWebViewClient(new PowerfulWebView.StateWebViewClient()); // mVContent.setOnTitleListener(this); // mVContent.loadUrl(url); // } // // @Override // protected void onResume() { // super.onResume(); // mVContent.onResume(); // mVContent.resumeTimers(); // } // // @Override // protected void onPause() { // super.onPause(); // mVContent.onPause(); // mVContent.pauseTimers(); // } // // @Override // protected void onDestroy() { // super.onDestroy(); // mVContent.powerfulDestroy(); // } // // @Override // public void onBackPressed() { // if (mVContent.canGoBack()) { // mVContent.goBack(); // return; // } // super.onBackPressed(); // } // // // Listener // @Override // public void onTitleChanged(PowerfulWebView view, String title) { // setTitle(title); // } // // } // // Path: app/src/main/java/am/project/x/utils/ViewUtils.java // public class ViewUtils { // // private ViewUtils() { // //no instance // } // // /** // * 设置布局可绘制在状态栏下 // * // * @param navigation 是否包含导航栏 // */ // public static void setLayoutFullscreen(View view, boolean navigation) { // if (view == null) // return; // if (Build.VERSION.SDK_INT >= 16) { // int visibility = view.getSystemUiVisibility(); // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; // if (navigation) { // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; // } // view.setSystemUiVisibility(visibility); // } // } // } // Path: app/src/main/java/am/project/x/business/about/AboutActivity.java import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import androidx.annotation.Nullable; import com.am.appcompat.app.AppCompatActivity; import am.project.x.BuildConfig; import am.project.x.R; import am.project.x.business.browser.BrowserActivity; import am.project.x.utils.ViewUtils; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.about; /** * 关于 */ public class AboutActivity extends AppCompatActivity { public AboutActivity() { super(R.layout.activity_about); } public static void start(Context context) { context.startActivity(new Intent(context, AboutActivity.class)); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState);
ViewUtils.setLayoutFullscreen(getWindow().getDecorView(), false);
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/about/AboutActivity.java
// Path: app/src/main/java/am/project/x/business/browser/BrowserActivity.java // public class BrowserActivity extends AppCompatActivity implements PowerfulWebView.OnTitleListener { // // private static final String EXTRA_URL = "url"; // private PowerfulWebView mVContent; // // public BrowserActivity() { // super(R.layout.activity_browser); // } // // public static void start(Context context, String url) { // final Intent starter = new Intent(context, BrowserActivity.class); // starter.putExtra(EXTRA_URL, url); // context.startActivity(starter); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.browser_toolbar); // final String url = getIntent().getStringExtra(EXTRA_URL); // if (TextUtils.isEmpty(url)) { // finish(); // return; // } // setTitle(""); // mVContent = findViewById(R.id.browser_wb_content); // WebSettings webSettings = mVContent.getSettings(); // webSettings.setUseWideViewPort(true); // webSettings.setLoadWithOverviewMode(true); // webSettings.setSupportZoom(true); // webSettings.setNeedInitialFocus(true); // webSettings.setBuiltInZoomControls(true); // webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // webSettings.setBlockNetworkImage(false); // webSettings.setLoadsImagesAutomatically(true); // webSettings.setDisplayZoomControls(false); // webSettings.setDomStorageEnabled(true); // webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); // if (Build.VERSION.SDK_INT >= 21) { // webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // } // webSettings.setDefaultTextEncodingName("utf-8"); // mVContent.setWebViewClient(new PowerfulWebView.StateWebViewClient()); // mVContent.setOnTitleListener(this); // mVContent.loadUrl(url); // } // // @Override // protected void onResume() { // super.onResume(); // mVContent.onResume(); // mVContent.resumeTimers(); // } // // @Override // protected void onPause() { // super.onPause(); // mVContent.onPause(); // mVContent.pauseTimers(); // } // // @Override // protected void onDestroy() { // super.onDestroy(); // mVContent.powerfulDestroy(); // } // // @Override // public void onBackPressed() { // if (mVContent.canGoBack()) { // mVContent.goBack(); // return; // } // super.onBackPressed(); // } // // // Listener // @Override // public void onTitleChanged(PowerfulWebView view, String title) { // setTitle(title); // } // // } // // Path: app/src/main/java/am/project/x/utils/ViewUtils.java // public class ViewUtils { // // private ViewUtils() { // //no instance // } // // /** // * 设置布局可绘制在状态栏下 // * // * @param navigation 是否包含导航栏 // */ // public static void setLayoutFullscreen(View view, boolean navigation) { // if (view == null) // return; // if (Build.VERSION.SDK_INT >= 16) { // int visibility = view.getSystemUiVisibility(); // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; // if (navigation) { // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; // } // view.setSystemUiVisibility(visibility); // } // } // }
import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import androidx.annotation.Nullable; import com.am.appcompat.app.AppCompatActivity; import am.project.x.BuildConfig; import am.project.x.R; import am.project.x.business.browser.BrowserActivity; import am.project.x.utils.ViewUtils;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.about; /** * 关于 */ public class AboutActivity extends AppCompatActivity { public AboutActivity() { super(R.layout.activity_about); } public static void start(Context context) { context.startActivity(new Intent(context, AboutActivity.class)); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewUtils.setLayoutFullscreen(getWindow().getDecorView(), false); setSupportActionBar(R.id.about_toolbar); ((TextView) findViewById(R.id.about_tv_version)).setText( getString(R.string.about_version, BuildConfig.VERSION_NAME)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_about, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about_privacy:
// Path: app/src/main/java/am/project/x/business/browser/BrowserActivity.java // public class BrowserActivity extends AppCompatActivity implements PowerfulWebView.OnTitleListener { // // private static final String EXTRA_URL = "url"; // private PowerfulWebView mVContent; // // public BrowserActivity() { // super(R.layout.activity_browser); // } // // public static void start(Context context, String url) { // final Intent starter = new Intent(context, BrowserActivity.class); // starter.putExtra(EXTRA_URL, url); // context.startActivity(starter); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.browser_toolbar); // final String url = getIntent().getStringExtra(EXTRA_URL); // if (TextUtils.isEmpty(url)) { // finish(); // return; // } // setTitle(""); // mVContent = findViewById(R.id.browser_wb_content); // WebSettings webSettings = mVContent.getSettings(); // webSettings.setUseWideViewPort(true); // webSettings.setLoadWithOverviewMode(true); // webSettings.setSupportZoom(true); // webSettings.setNeedInitialFocus(true); // webSettings.setBuiltInZoomControls(true); // webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // webSettings.setBlockNetworkImage(false); // webSettings.setLoadsImagesAutomatically(true); // webSettings.setDisplayZoomControls(false); // webSettings.setDomStorageEnabled(true); // webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); // if (Build.VERSION.SDK_INT >= 21) { // webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // } // webSettings.setDefaultTextEncodingName("utf-8"); // mVContent.setWebViewClient(new PowerfulWebView.StateWebViewClient()); // mVContent.setOnTitleListener(this); // mVContent.loadUrl(url); // } // // @Override // protected void onResume() { // super.onResume(); // mVContent.onResume(); // mVContent.resumeTimers(); // } // // @Override // protected void onPause() { // super.onPause(); // mVContent.onPause(); // mVContent.pauseTimers(); // } // // @Override // protected void onDestroy() { // super.onDestroy(); // mVContent.powerfulDestroy(); // } // // @Override // public void onBackPressed() { // if (mVContent.canGoBack()) { // mVContent.goBack(); // return; // } // super.onBackPressed(); // } // // // Listener // @Override // public void onTitleChanged(PowerfulWebView view, String title) { // setTitle(title); // } // // } // // Path: app/src/main/java/am/project/x/utils/ViewUtils.java // public class ViewUtils { // // private ViewUtils() { // //no instance // } // // /** // * 设置布局可绘制在状态栏下 // * // * @param navigation 是否包含导航栏 // */ // public static void setLayoutFullscreen(View view, boolean navigation) { // if (view == null) // return; // if (Build.VERSION.SDK_INT >= 16) { // int visibility = view.getSystemUiVisibility(); // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; // if (navigation) { // visibility = visibility | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; // } // view.setSystemUiVisibility(visibility); // } // } // } // Path: app/src/main/java/am/project/x/business/about/AboutActivity.java import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import androidx.annotation.Nullable; import com.am.appcompat.app.AppCompatActivity; import am.project.x.BuildConfig; import am.project.x.R; import am.project.x.business.browser.BrowserActivity; import am.project.x.utils.ViewUtils; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.about; /** * 关于 */ public class AboutActivity extends AppCompatActivity { public AboutActivity() { super(R.layout.activity_about); } public static void start(Context context) { context.startActivity(new Intent(context, AboutActivity.class)); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewUtils.setLayoutFullscreen(getWindow().getDecorView(), false); setSupportActionBar(R.id.about_toolbar); ((TextView) findViewById(R.id.about_tv_version)).setText( getString(R.string.about_version, BuildConfig.VERSION_NAME)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_about, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about_privacy:
BrowserActivity.start(this, "file:///android_asset/html/privacy.html");
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/main/fragments/DevelopFragment.java
// Path: app/src/main/java/am/project/x/business/developing/DevelopingActivity.java // public class DevelopingActivity extends AppCompatActivity { // // public DevelopingActivity() { // super(R.layout.activity_developing); // } // // public static void start(Context context) { // context.startActivity(new Intent(context, DevelopingActivity.class)); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.developing_toolbar); // } // }
import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.am.appcompat.app.Fragment; import am.project.x.R; import am.project.x.business.developing.DevelopingActivity;
/* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.main.fragments; public class DevelopFragment extends Fragment { public static DevelopFragment newInstance() { return new DevelopFragment(); } public DevelopFragment() { super(R.layout.fragment_main_develop); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); findViewById(R.id.develop_btn_developing).setOnClickListener(this::open); // findViewById(R.id.develop_btn_supergridview).setOnClickListener(this::open); } private void open(View view) {
// Path: app/src/main/java/am/project/x/business/developing/DevelopingActivity.java // public class DevelopingActivity extends AppCompatActivity { // // public DevelopingActivity() { // super(R.layout.activity_developing); // } // // public static void start(Context context) { // context.startActivity(new Intent(context, DevelopingActivity.class)); // } // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setSupportActionBar(R.id.developing_toolbar); // } // } // Path: app/src/main/java/am/project/x/business/main/fragments/DevelopFragment.java import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.am.appcompat.app.Fragment; import am.project.x.R; import am.project.x.business.developing.DevelopingActivity; /* * Copyright (C) 2018 AlexMofer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package am.project.x.business.main.fragments; public class DevelopFragment extends Fragment { public static DevelopFragment newInstance() { return new DevelopFragment(); } public DevelopFragment() { super(R.layout.fragment_main_develop); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); findViewById(R.id.develop_btn_developing).setOnClickListener(this::open); // findViewById(R.id.develop_btn_supergridview).setOnClickListener(this::open); } private void open(View view) {
DevelopingActivity.start(requireContext());
AlexMofer/ProjectX
app/src/main/java/am/project/x/business/others/font/FontModel.java
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // }
import android.content.Context; import com.am.font.TypefaceCollection; import com.am.font.TypefaceConfig; import com.am.font.TypefaceFallback; import com.am.font.TypefaceItem; import com.am.mvp.core.MVPModel; import java.io.File; import java.util.List; import am.project.x.ProjectXApplication; import am.project.x.R;
final int nameCount = mNames == null ? 0 : mNames.size(); final int aliaCount = mAlias == null ? 0 : mAlias.size(); return nameCount + aliaCount; } @Override public String getFamilyNameOrAlias(int position) { final int nameCount = mNames == null ? 0 : mNames.size(); //noinspection ConstantConditions return position < nameCount ? mNames.get(position) : mAlias.get(position - nameCount); } @Override public boolean isFamilyAlias(int position) { return position >= (mNames == null ? 0 : mNames.size()); } // AdapterViewModel @Override public int getTypefaceFallbackCount() { return mFallbacks == null ? 0 : mFallbacks.size(); } @Override public String getTypefaceName() { return mTypeface == null ? null : mTypeface.getName(); } @Override public String getCommonTitle() {
// Path: app/src/main/java/am/project/x/ProjectXApplication.java // public class ProjectXApplication extends BroadcastApplication { // // private static ProjectXApplication mInstance; // // @Override // public void onCreate() { // mInstance = this; // super.onCreate(); // NotificationChannelHelper.updateNotificationChannel(this); // } // // /** // * 获取Application // * // * @return Application // */ // public static ProjectXApplication getInstance() { // return mInstance; // } // } // Path: app/src/main/java/am/project/x/business/others/font/FontModel.java import android.content.Context; import com.am.font.TypefaceCollection; import com.am.font.TypefaceConfig; import com.am.font.TypefaceFallback; import com.am.font.TypefaceItem; import com.am.mvp.core.MVPModel; import java.io.File; import java.util.List; import am.project.x.ProjectXApplication; import am.project.x.R; final int nameCount = mNames == null ? 0 : mNames.size(); final int aliaCount = mAlias == null ? 0 : mAlias.size(); return nameCount + aliaCount; } @Override public String getFamilyNameOrAlias(int position) { final int nameCount = mNames == null ? 0 : mNames.size(); //noinspection ConstantConditions return position < nameCount ? mNames.get(position) : mAlias.get(position - nameCount); } @Override public boolean isFamilyAlias(int position) { return position >= (mNames == null ? 0 : mNames.size()); } // AdapterViewModel @Override public int getTypefaceFallbackCount() { return mFallbacks == null ? 0 : mFallbacks.size(); } @Override public String getTypefaceName() { return mTypeface == null ? null : mTypeface.getName(); } @Override public String getCommonTitle() {
return ProjectXApplication.getInstance().getString(R.string.font_common);
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/dto/TodoDtoList.java
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // }
import com.hoserdude.toboot.document.Todo; import javax.xml.bind.annotation.XmlRootElement; import java.util.ArrayList; import java.util.List;
package com.hoserdude.toboot.dto; @XmlRootElement public class TodoDtoList { private List<TodoDto> todoDto; /** * Always default constructors, no matter what your IDE says */ public TodoDtoList() { this.todoDto = new ArrayList<TodoDto>(); } public List<TodoDto> getTodoDto() { return todoDto; } public void setTodoDto(List<TodoDto> todoDto) { this.todoDto = todoDto; }
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // Path: src/main/java/com/hoserdude/toboot/dto/TodoDtoList.java import com.hoserdude.toboot.document.Todo; import javax.xml.bind.annotation.XmlRootElement; import java.util.ArrayList; import java.util.List; package com.hoserdude.toboot.dto; @XmlRootElement public class TodoDtoList { private List<TodoDto> todoDto; /** * Always default constructors, no matter what your IDE says */ public TodoDtoList() { this.todoDto = new ArrayList<TodoDto>(); } public List<TodoDto> getTodoDto() { return todoDto; } public void setTodoDto(List<TodoDto> todoDto) { this.todoDto = todoDto; }
public static TodoDtoList fromTodos(List<Todo> todos) {
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/service/TodoServiceImpl.java
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // }
import com.hoserdude.toboot.aop.Instrumentable; import com.hoserdude.toboot.document.Todo; import com.hoserdude.toboot.documentRepository.TodoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List;
package com.hoserdude.toboot.service; @Service public class TodoServiceImpl implements TodoService { @Autowired
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // Path: src/main/java/com/hoserdude/toboot/service/TodoServiceImpl.java import com.hoserdude.toboot.aop.Instrumentable; import com.hoserdude.toboot.document.Todo; import com.hoserdude.toboot.documentRepository.TodoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; package com.hoserdude.toboot.service; @Service public class TodoServiceImpl implements TodoService { @Autowired
private TodoRepository todoRepository;
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/service/TodoServiceImpl.java
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // }
import com.hoserdude.toboot.aop.Instrumentable; import com.hoserdude.toboot.document.Todo; import com.hoserdude.toboot.documentRepository.TodoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List;
package com.hoserdude.toboot.service; @Service public class TodoServiceImpl implements TodoService { @Autowired private TodoRepository todoRepository; @Override @Instrumentable
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // Path: src/main/java/com/hoserdude/toboot/service/TodoServiceImpl.java import com.hoserdude.toboot.aop.Instrumentable; import com.hoserdude.toboot.document.Todo; import com.hoserdude.toboot.documentRepository.TodoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; package com.hoserdude.toboot.service; @Service public class TodoServiceImpl implements TodoService { @Autowired private TodoRepository todoRepository; @Override @Instrumentable
public List<Todo> getTodos(String userId) {
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/config/DatabaseConfig.java
// Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // // Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // }
import com.hoserdude.toboot.documentRepository.TodoRepository; import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.springframework.boot.orm.jpa.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
package com.hoserdude.toboot.config; @Configuration @EnableJpaRepositories(basePackageClasses = {UserRepository.class})
// Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // // Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // } // Path: src/main/java/com/hoserdude/toboot/config/DatabaseConfig.java import com.hoserdude.toboot.documentRepository.TodoRepository; import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.springframework.boot.orm.jpa.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; package com.hoserdude.toboot.config; @Configuration @EnableJpaRepositories(basePackageClasses = {UserRepository.class})
@EnableMongoRepositories(basePackageClasses = {TodoRepository.class})
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/config/DatabaseConfig.java
// Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // // Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // }
import com.hoserdude.toboot.documentRepository.TodoRepository; import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.springframework.boot.orm.jpa.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
package com.hoserdude.toboot.config; @Configuration @EnableJpaRepositories(basePackageClasses = {UserRepository.class}) @EnableMongoRepositories(basePackageClasses = {TodoRepository.class})
// Path: src/main/java/com/hoserdude/toboot/documentRepository/TodoRepository.java // public interface TodoRepository extends MongoRepository<Todo, String> { // Todo findByUserIdAndId(String userId, String id); // List<Todo> findByUserId(String userId); // } // // Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // } // Path: src/main/java/com/hoserdude/toboot/config/DatabaseConfig.java import com.hoserdude.toboot.documentRepository.TodoRepository; import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.springframework.boot.orm.jpa.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; package com.hoserdude.toboot.config; @Configuration @EnableJpaRepositories(basePackageClasses = {UserRepository.class}) @EnableMongoRepositories(basePackageClasses = {TodoRepository.class})
@EntityScan(basePackageClasses = {User.class})
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/dto/TodoDto.java
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // }
import com.fasterxml.jackson.annotation.JsonIgnore; import com.hoserdude.toboot.document.Todo; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient;
* Prevents the XML marshaller from sending it back to the client. * @return */ @XmlTransient public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public boolean isCompleted() { return completed; } public void setCompleted(boolean completed) { this.completed = completed; } //Mapping to and from domain and DTO
// Path: src/main/java/com/hoserdude/toboot/document/Todo.java // @Document // public class Todo { // // @Id // private String id; // // private String userId; // // private String title; // // private boolean completed; // // public Todo() {} // // public Todo(String userId, String title, boolean completed) { // this.userId = userId; // this.title = title; // this.completed = completed; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public boolean isCompleted() { // return completed; // } // // public void setCompleted(boolean completed) { // this.completed = completed; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // Path: src/main/java/com/hoserdude/toboot/dto/TodoDto.java import com.fasterxml.jackson.annotation.JsonIgnore; import com.hoserdude.toboot.document.Todo; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; * Prevents the XML marshaller from sending it back to the client. * @return */ @XmlTransient public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public boolean isCompleted() { return completed; } public void setCompleted(boolean completed) { this.completed = completed; } //Mapping to and from domain and DTO
public static TodoDto fromTodo(Todo todo) {
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // }
import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.openid.OpenIDAttribute; import org.springframework.security.openid.OpenIDAuthenticationToken; import org.springframework.stereotype.Service; import java.util.List;
package com.hoserdude.toboot.service; @Service public class UserServiceImpl implements UserService { private static Logger logger = LoggerFactory.getLogger(UserService.class); @Autowired
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // } // Path: src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.openid.OpenIDAttribute; import org.springframework.security.openid.OpenIDAuthenticationToken; import org.springframework.stereotype.Service; import java.util.List; package com.hoserdude.toboot.service; @Service public class UserServiceImpl implements UserService { private static Logger logger = LoggerFactory.getLogger(UserService.class); @Autowired
private UserRepository userRepository;
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // }
import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.openid.OpenIDAttribute; import org.springframework.security.openid.OpenIDAuthenticationToken; import org.springframework.stereotype.Service; import java.util.List;
final List<OpenIDAttribute> attributes = token.getAttributes(); String emailAddress = null; String fullName = null; String firstName = null; String lastName = null; //Grab their name and email for (OpenIDAttribute attribute : attributes) { String name = attribute.getName(); if (name.equals("email")) { if (attribute.getCount() == 1) { emailAddress = attribute.getValues().get(0); } } if (name.equals("fullname")) { if (attribute.getCount() == 1) { fullName = attribute.getValues().get(0); } } if (name.equals("firstname")) { if (attribute.getCount() == 1) { firstName = attribute.getValues().get(0); } } if (name.equals("lastname")) { if (attribute.getCount() == 1) { lastName = attribute.getValues().get(0); } } } if (emailAddress != null) {
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // // Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java // @Repository // public interface UserRepository extends CrudRepository<User, Long> { // User findByEmail(String email); // } // Path: src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java import com.hoserdude.toboot.domain.User; import com.hoserdude.toboot.domainRepository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.openid.OpenIDAttribute; import org.springframework.security.openid.OpenIDAuthenticationToken; import org.springframework.stereotype.Service; import java.util.List; final List<OpenIDAttribute> attributes = token.getAttributes(); String emailAddress = null; String fullName = null; String firstName = null; String lastName = null; //Grab their name and email for (OpenIDAttribute attribute : attributes) { String name = attribute.getName(); if (name.equals("email")) { if (attribute.getCount() == 1) { emailAddress = attribute.getValues().get(0); } } if (name.equals("fullname")) { if (attribute.getCount() == 1) { fullName = attribute.getValues().get(0); } } if (name.equals("firstname")) { if (attribute.getCount() == 1) { firstName = attribute.getValues().get(0); } } if (name.equals("lastname")) { if (attribute.getCount() == 1) { lastName = attribute.getValues().get(0); } } } if (emailAddress != null) {
User user = userRepository.findByEmail(emailAddress);
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/config/SecurityConfig.java
// Path: src/main/java/com/hoserdude/toboot/service/UserService.java // public interface UserService extends AuthenticationUserDetailsService<OpenIDAuthenticationToken> { // }
import com.hoserdude.toboot.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
package com.hoserdude.toboot.config; @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; @Autowired
// Path: src/main/java/com/hoserdude/toboot/service/UserService.java // public interface UserService extends AuthenticationUserDetailsService<OpenIDAuthenticationToken> { // } // Path: src/main/java/com/hoserdude/toboot/config/SecurityConfig.java import com.hoserdude.toboot.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; package com.hoserdude.toboot.config; @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; @Autowired
private UserService userService;
hoserdude/to-boot
src/main/java/com/hoserdude/toboot/web/HomeController.java
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // }
import com.hoserdude.toboot.domain.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
package com.hoserdude.toboot.web; //No need to subclass anything, any class can be a controller. @Controller public class HomeController { private static Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Names of the methods mean nothing, it's all about the RequestMapping defined above. * The RequestMapping is your Routing rule - all GET hits to the root of the context come here * * @param model where did this come from? Automatically injected for your convenience. */ @RequestMapping(value = "/home", method = RequestMethod.GET) public String home(Model model, Authentication authentication) {
// Path: src/main/java/com/hoserdude/toboot/domain/User.java // @Entity // @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")}) // public class User implements UserDetails { // // @Id // @GeneratedValue(strategy= GenerationType.AUTO) // private Long id; // // /** // * See unique constraint in Table definition // */ // @Column // private String userId; // // @Column // private String fullName; // // @Column // private String email; // // public User() {} // // public User(String userId, String fullName, String email) { // this.userId = userId; // this.fullName = fullName; // this.email = email; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public String getFullName() { // return fullName; // } // // public void setFullName(String fullName) { // this.fullName = fullName; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // // Everything down here is to be cool with Spring Security Interface we are implementing. // // @Override // public Collection<? extends GrantedAuthority> getAuthorities() { // return AuthorityUtils.createAuthorityList("ROLE_USER"); // } // // /** // * Since we use OpenId, we never store this. // * @return // */ // @Override // public String getPassword() { // return ""; // } // // /** // * We're using the unique ID from OpenID // * @return // */ // @Override // public String getUsername() { // return this.userId; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // } // Path: src/main/java/com/hoserdude/toboot/web/HomeController.java import com.hoserdude.toboot.domain.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; package com.hoserdude.toboot.web; //No need to subclass anything, any class can be a controller. @Controller public class HomeController { private static Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Names of the methods mean nothing, it's all about the RequestMapping defined above. * The RequestMapping is your Routing rule - all GET hits to the root of the context come here * * @param model where did this come from? Automatically injected for your convenience. */ @RequestMapping(value = "/home", method = RequestMethod.GET) public String home(Model model, Authentication authentication) {
User user = (User)authentication.getPrincipal();
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; public class BarChartSeries extends HighChartsSeriesImpl { public BarChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; public class BarChartSeries extends HighChartsSeriesImpl { public BarChartSeries(String name) {
chartType = ChartType.BAR;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; public class BarChartSeries extends HighChartsSeriesImpl { public BarChartSeries(String name) { chartType = ChartType.BAR; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; public class BarChartSeries extends HighChartsSeriesImpl { public BarChartSeries(String name) { chartType = ChartType.BAR; this.name = name; }
public BarChartSeries(String name, List<HighChartsData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/AreaRangeChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class AreaRangeChartPlotOptions extends HighChartsPlotOptionsImpl { public AreaRangeChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/AreaRangeChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class AreaRangeChartPlotOptions extends HighChartsPlotOptionsImpl { public AreaRangeChartPlotOptions() {
chartType = ChartType.AREARANGE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/BubbleChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.plotoptions<br> * Klasse: BoxPlotChartPlotOptions.class<br> * Erstellt am 24. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartPlotOptions extends HighChartsPlotOptionsImpl { public BubbleChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/BubbleChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.plotoptions<br> * Klasse: BoxPlotChartPlotOptions.class<br> * Erstellt am 24. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartPlotOptions extends HighChartsPlotOptionsImpl { public BubbleChartPlotOptions() {
this.chartType = ChartType.BUBBLE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import java.util.List; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class LineChartSeries extends HighChartsSeriesImpl { public LineChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java import java.util.List; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class LineChartSeries extends HighChartsSeriesImpl { public LineChartSeries(String name) {
chartType = ChartType.LINE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import java.util.List; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class LineChartSeries extends HighChartsSeriesImpl { public LineChartSeries(String name) { chartType = ChartType.LINE; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java import java.util.List; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class LineChartSeries extends HighChartsSeriesImpl { public LineChartSeries(String name) { chartType = ChartType.LINE; this.name = name; }
public LineChartSeries(String name, List<HighChartsData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ErrorBarChartSeries extends HighChartsSeriesImpl { public ErrorBarChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ErrorBarChartSeries extends HighChartsSeriesImpl { public ErrorBarChartSeries(String name) {
chartType = ChartType.ERRORBAR;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ErrorBarChartSeries extends HighChartsSeriesImpl { public ErrorBarChartSeries(String name) { chartType = ChartType.ERRORBAR; this.name = name; } public ErrorBarChartSeries(String name, List<ErrorBarChartData> data) { chartType = ChartType.ERRORBAR; this.name = name; if (!data.isEmpty()) { for (ErrorBarChartData errorBarChartData : data) { this.data.add(errorBarChartData); } } } public void addData(ErrorBarChartData errorBarChartData) { this.data.add(errorBarChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(ErrorBarChartData)} instead. */ @Deprecated @Override
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ErrorBarChartSeries extends HighChartsSeriesImpl { public ErrorBarChartSeries(String name) { chartType = ChartType.ERRORBAR; this.name = name; } public ErrorBarChartSeries(String name, List<ErrorBarChartData> data) { chartType = ChartType.ERRORBAR; this.name = name; if (!data.isEmpty()) { for (ErrorBarChartData errorBarChartData : data) { this.data.add(errorBarChartData); } } } public void addData(ErrorBarChartData errorBarChartData) { this.data.add(errorBarChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(ErrorBarChartData)} instead. */ @Deprecated @Override
public void addData(HighChartsData highChartsData) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) {
chartType = ChartType.BUBBLE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) { chartType = ChartType.BUBBLE; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) { chartType = ChartType.BUBBLE; this.name = name; }
public BubbleChartSeries(String name, List<BubbleChartData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) { chartType = ChartType.BUBBLE; this.name = name; } public BubbleChartSeries(String name, List<BubbleChartData> data) { chartType = ChartType.BUBBLE; this.name = name; if (!data.isEmpty()) { for (BubbleChartData bubbleChartData : data) { this.data.add(bubbleChartData); } } } public void addData(BubbleChartData bubbleChartData) { this.data.add(bubbleChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(BubbleChartData)} instead. */ @Deprecated @Override
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java // public class BubbleChartData implements HighChartsData { // // private double x; // private double y; // private double z; // // public BubbleChartData(double x, double y, double z) { // this.x = x; // this.y = y; // this.z = z; // } // // public double getX() { // return x; // } // // public void setX(double x) { // this.x = x; // } // // public double getY() { // return y; // } // // public void setY(double y) { // this.y = y; // } // // public double getZ() { // return z; // } // // public void setZ(double z) { // this.z = z; // } // // @Override // public String getHighChartValue() { // return "[" + x + ", " + y + ", " + z + "]"; // } // // @Override // public String toString() { // return this.getHighChartValue(); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BubbleChartSeries extends HighChartsSeriesImpl { public BubbleChartSeries(String name) { chartType = ChartType.BUBBLE; this.name = name; } public BubbleChartSeries(String name, List<BubbleChartData> data) { chartType = ChartType.BUBBLE; this.name = name; if (!data.isEmpty()) { for (BubbleChartData bubbleChartData : data) { this.data.add(bubbleChartData); } } } public void addData(BubbleChartData bubbleChartData) { this.data.add(bubbleChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(BubbleChartData)} instead. */ @Deprecated @Override
public void addData(HighChartsData highChartsData) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/PieChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class PieChartPlotOptions extends HighChartsPlotOptionsImpl { public PieChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/PieChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class PieChartPlotOptions extends HighChartsPlotOptionsImpl { public PieChartPlotOptions() {
chartType = ChartType.PIE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; public class AreaChartSeries extends HighChartsSeriesImpl { public AreaChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; public class AreaChartSeries extends HighChartsSeriesImpl { public AreaChartSeries(String name) {
chartType = ChartType.AREA;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; public class AreaChartSeries extends HighChartsSeriesImpl { public AreaChartSeries(String name) { chartType = ChartType.AREA; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; public class AreaChartSeries extends HighChartsSeriesImpl { public AreaChartSeries(String name) { chartType = ChartType.AREA; this.name = name; }
public AreaChartSeries(String name, List<HighChartsData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/FunnelChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class FunnelChartPlotOptions extends HighChartsPlotOptionsImpl { public FunnelChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/FunnelChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class FunnelChartPlotOptions extends HighChartsPlotOptionsImpl { public FunnelChartPlotOptions() {
chartType = ChartType.FUNNEL;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/AreaSplineChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class AreaSplineChartPlotOptions extends HighChartsPlotOptionsImpl { public AreaSplineChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/AreaSplineChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class AreaSplineChartPlotOptions extends HighChartsPlotOptionsImpl { public AreaSplineChartPlotOptions() {
chartType = ChartType.AREASPLINE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/BoxPlotChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.plotoptions<br> * Klasse: BoxPlotChartPlotOptions.class<br> * Erstellt am 24. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BoxPlotChartPlotOptions extends HighChartsPlotOptionsImpl { public BoxPlotChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/BoxPlotChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.plotoptions<br> * Klasse: BoxPlotChartPlotOptions.class<br> * Erstellt am 24. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class BoxPlotChartPlotOptions extends HighChartsPlotOptionsImpl { public BoxPlotChartPlotOptions() {
this.chartType = ChartType.BOXPLOT;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) {
chartType = ChartType.COLUMNRANGE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) { chartType = ChartType.COLUMNRANGE; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) { chartType = ChartType.COLUMNRANGE; this.name = name; }
public ColumnRangeChartSeries(String name, List<ColumnRangeChartData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) { chartType = ChartType.COLUMNRANGE; this.name = name; } public ColumnRangeChartSeries(String name, List<ColumnRangeChartData> data) { chartType = ChartType.COLUMNRANGE; this.name = name; if (!data.isEmpty()) { for (ColumnRangeChartData columnRangeChartData : data) { this.data.add(columnRangeChartData); } } } public void addData(ColumnRangeChartData columnRangeChartData) { this.data.add(columnRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(ColumnRangeChartData)} instead. */ @Deprecated @Override
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java // public class ColumnRangeChartData extends RangeData { // // public ColumnRangeChartData(double x, double low, double high) { // super(x, low, high); // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class ColumnRangeChartSeries extends HighChartsSeriesImpl { public ColumnRangeChartSeries(String name) { chartType = ChartType.COLUMNRANGE; this.name = name; } public ColumnRangeChartSeries(String name, List<ColumnRangeChartData> data) { chartType = ChartType.COLUMNRANGE; this.name = name; if (!data.isEmpty()) { for (ColumnRangeChartData columnRangeChartData : data) { this.data.add(columnRangeChartData); } } } public void addData(ColumnRangeChartData columnRangeChartData) { this.data.add(columnRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(ColumnRangeChartData)} instead. */ @Deprecated @Override
public void addData(HighChartsData highChartsData) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/PieChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/PieChartData.java // public class PieChartData implements HighChartsData { // // private String name; // private Object value; // // public PieChartData(String name, Object value) { // this.name = name; // this.value = value; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Object getValue() { // return value; // } // // public void setValue(Object value) { // this.value = value; // } // // @Override // public String getHighChartValue() { // return "['" + this.name + "', " + this.value + "]"; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.PieChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.ArrayList; import java.util.List;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class PieChartSeries extends HighChartsSeriesImpl { private List<PieChartData> data = new ArrayList<PieChartData>(); public PieChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/PieChartData.java // public class PieChartData implements HighChartsData { // // private String name; // private Object value; // // public PieChartData(String name, Object value) { // this.name = name; // this.value = value; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Object getValue() { // return value; // } // // public void setValue(Object value) { // this.value = value; // } // // @Override // public String getHighChartValue() { // return "['" + this.name + "', " + this.value + "]"; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/PieChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.PieChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.ArrayList; import java.util.List; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.series; public class PieChartSeries extends HighChartsSeriesImpl { private List<PieChartData> data = new ArrayList<PieChartData>(); public PieChartSeries(String name) {
this.chartType = ChartType.PIE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) {
chartType = ChartType.AREARANGE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) { chartType = ChartType.AREARANGE; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) { chartType = ChartType.AREARANGE; this.name = name; }
public AreaRangeChartSeries(String name, List<AreaRangeChartData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) { chartType = ChartType.AREARANGE; this.name = name; } public AreaRangeChartSeries(String name, List<AreaRangeChartData> data) { chartType = ChartType.AREARANGE; this.name = name; if (!data.isEmpty()) { for (AreaRangeChartData areaRangeChartData : data) { this.data.add(areaRangeChartData); } } } public void addData(AreaRangeChartData areaRangeChartData) { this.data.add(areaRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(AreaRangeChartData)} instead. */ @Deprecated @Override
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java // public class AreaRangeChartData extends RangeData { // // public AreaRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaRangeChartSeries extends HighChartsSeriesImpl { public AreaRangeChartSeries(String name) { chartType = ChartType.AREARANGE; this.name = name; } public AreaRangeChartSeries(String name, List<AreaRangeChartData> data) { chartType = ChartType.AREARANGE; this.name = name; if (!data.isEmpty()) { for (AreaRangeChartData areaRangeChartData : data) { this.data.add(areaRangeChartData); } } } public void addData(AreaRangeChartData areaRangeChartData) { this.data.add(areaRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(AreaRangeChartData)} instead. */ @Deprecated @Override
public void addData(HighChartsData highChartsData) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/ColumnRangeChartPlotOptions.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType;
/* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class ColumnRangeChartPlotOptions extends HighChartsPlotOptionsImpl { public ColumnRangeChartPlotOptions() {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/plotoptions/ColumnRangeChartPlotOptions.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; /* * Copyright (c) 2015 by Manfred Huber. */ package at.downdrown.vaadinaddons.highchartsapi.model.plotoptions; public class ColumnRangeChartPlotOptions extends HighChartsPlotOptionsImpl { public ColumnRangeChartPlotOptions() {
chartType = ChartType.COLUMNRANGE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) {
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) {
chartType = ChartType.AREASPLINERANGE;
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) { chartType = ChartType.AREASPLINERANGE; this.name = name; }
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) { chartType = ChartType.AREASPLINERANGE; this.name = name; }
public AreaSplineRangeChartSeries(String name, List<AreaSplineRangeChartData> data) {
downdrown/VaadinHighChartsAPI
src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // }
import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List;
package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) { chartType = ChartType.AREASPLINERANGE; this.name = name; } public AreaSplineRangeChartSeries(String name, List<AreaSplineRangeChartData> data) { chartType = ChartType.AREASPLINERANGE; this.name = name; if (!data.isEmpty()) { for (AreaSplineRangeChartData areaSplineRangeChartData : data) { this.data.add(areaSplineRangeChartData); } } } public void addData(AreaSplineRangeChartData areaSplineRangeChartData) { this.data.add(areaSplineRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(AreaSplineRangeChartData)} instead. */ @Deprecated @Override
// Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/ChartType.java // public enum ChartType implements HighchartsObject { // // AREA("area"), // AREARANGE("arearange"), // AREASPLINE("areaspline"), // AREASPLINERANGE("areasplinerange"), // BAR("bar"), // BOXPLOT("boxplot"), // BUBBLE("bubble"), // COLUMN("column"), // COLUMNRANGE("columnrange"), // ERRORBAR("errorbar"), // FUNNEL("funnel"), // GAUGE("gauge"), // HEATMAP("heatmap"), // LINE("line"), // PIE("pie"), // POLYGON("polygon"), // PYRAMID("pyramid"), // SCATTER("scatter"), // SOLIDGAUGE("solidgauge"), // SPLINE("spline"), // TREEMAP("treemap"), // WATERFALL("waterfall"); // // private String highchartsvalue; // // ChartType(String highchartsvalue) { // this.highchartsvalue = highchartsvalue; // } // // public String getHighChartValue() { // return this.highchartsvalue; // } // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java // public class AreaSplineRangeChartData extends RangeData { // // public AreaSplineRangeChartData(double x, double low, double high) { // super(x, low, high); // } // // } // // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/HighChartsData.java // public interface HighChartsData extends HighchartsObject { // // } // Path: src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import java.util.List; package at.downdrown.vaadinaddons.highchartsapi.model.series; /** * Projekt: VaadinHighChartsAPI<br> * Package: at.downdrown.vaadinaddons.highchartsapi.model.series<br> * Klasse: AreaSplineRangeChartSeries.class<br> * Erstellt am 21. August 2015.<br> * Copyright &copy; HSWE Allg. Applikationen.<br> * <br> * * @author Manfred Huber (02ub0j08)<br> */ public class AreaSplineRangeChartSeries extends HighChartsSeriesImpl { public AreaSplineRangeChartSeries(String name) { chartType = ChartType.AREASPLINERANGE; this.name = name; } public AreaSplineRangeChartSeries(String name, List<AreaSplineRangeChartData> data) { chartType = ChartType.AREASPLINERANGE; this.name = name; if (!data.isEmpty()) { for (AreaSplineRangeChartData areaSplineRangeChartData : data) { this.data.add(areaSplineRangeChartData); } } } public void addData(AreaSplineRangeChartData areaSplineRangeChartData) { this.data.add(areaSplineRangeChartData); } /** * @deprecated This method isn't implemented for this type. * Use {@link #addData(AreaSplineRangeChartData)} instead. */ @Deprecated @Override
public void addData(HighChartsData highChartsData) {