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
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/MD5.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils;
/* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The MD5 Message-Digest Algorithm */ class MD5 { /** * MD Buffer */ private int A; private int B; private int C; private int D; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/MD5.java import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils; /* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The MD5 Message-Digest Algorithm */ class MD5 { /** * MD Buffer */ private int A; private int B; private int C; private int D; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
int[] array = ArrayUtils.convertListToArray(intList);
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // }
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread;
/* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.builders; /** * This class implements basic function of synchronous and asynchronous encoding */ public abstract class BaseBuilder<B extends BaseBuilder>{ byte[] message; /** * Callback for getting the result of encryption */
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread; /* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.builders; /** * This class implements basic function of synchronous and asynchronous encoding */ public abstract class BaseBuilder<B extends BaseBuilder>{ byte[] message; /** * Callback for getting the result of encryption */
private volatile EncodeCallback callback;
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // }
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread;
} catch (FileNotFoundException e) { e.printStackTrace(); } return null; } public B message(InputStream inputStream) { try { message = new byte[inputStream.available()]; inputStream.read(message); } catch (IOException e) { e.printStackTrace(); } return (B) this; } /** * Set the callback */ public BaseBuilder encryptCallBack(EncodeCallback callback){ this.callback = callback; return this; } /** * Start of asynchronous encrypting */ public void encryptAsync(){ if(hasEnoughData()){
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; } public B message(InputStream inputStream) { try { message = new byte[inputStream.available()]; inputStream.read(message); } catch (IOException e) { e.printStackTrace(); } return (B) this; } /** * Set the callback */ public BaseBuilder encryptCallBack(EncodeCallback callback){ this.callback = callback; return this; } /** * Start of asynchronous encrypting */ public void encryptAsync(){ if(hasEnoughData()){
BaseThread.EncodeAction action = new BaseThread.EncodeAction() {
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // }
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread;
e.printStackTrace(); } return (B) this; } /** * Set the callback */ public BaseBuilder encryptCallBack(EncodeCallback callback){ this.callback = callback; return this; } /** * Start of asynchronous encrypting */ public void encryptAsync(){ if(hasEnoughData()){ BaseThread.EncodeAction action = new BaseThread.EncodeAction() { @Override public String action() { try { return encryption(); } catch (Exception e) { callback.onFailure(e); } return null; } };
// Path: encoder/src/main/java/ru/bullyboo/encoder/callbacks/EncodeCallback.java // public interface EncodeCallback { // // void onSuccess(String result); // // void onFailure(Throwable e); // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/BaseThread.java // public abstract class BaseThread<T> extends Thread implements RunnableFuture<T> { // // private EncodeAction encodeAction; // // private ThreadCallback threadCallback; // // private volatile T result; // // public interface EncodeAction<T>{ // T action(); // } // // public interface ThreadCallback<T>{ // void onFinish(T parametr); // // void onFailed(Throwable e); // } // // public BaseThread(EncodeAction<T> encodeAction, ThreadCallback<T> threadCallback) { // super(); // this.encodeAction = encodeAction; // this.threadCallback = threadCallback; // } // // @Override // public void run(){ // super.run(); // result = (T) encodeAction.action(); // // interrupt(); // } // // @Override // public void interrupt() { // super.interrupt(); // try { // threadCallback.onFinish(get()); // } catch (Exception e) { // threadCallback.onFailed(e); // } // } // // @Override // public boolean cancel(boolean mayInterruptIfRunning) { // if(mayInterruptIfRunning){ // interrupt(); // } // return mayInterruptIfRunning; // } // // @Override // public boolean isCancelled() { // return interrupted(); // } // // @Override // public boolean isDone() { // if(result != null){ // return true; // } // return false; // } // // @Override // public T get() throws InterruptedException, ExecutionException { // return result; // } // // @Override // public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // return result; // } // } // // Path: encoder/src/main/java/ru/bullyboo/encoder/threads/EncodingThread.java // public class EncodingThread extends BaseThread<String>{ // // public EncodingThread(EncodeAction<String> encodeAction, ThreadCallback<String> threadCallback) { // super(encodeAction, threadCallback); // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/builders/BaseBuilder.java import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import ru.bullyboo.encoder.callbacks.EncodeCallback; import ru.bullyboo.encoder.threads.BaseThread; import ru.bullyboo.encoder.threads.EncodingThread; e.printStackTrace(); } return (B) this; } /** * Set the callback */ public BaseBuilder encryptCallBack(EncodeCallback callback){ this.callback = callback; return this; } /** * Start of asynchronous encrypting */ public void encryptAsync(){ if(hasEnoughData()){ BaseThread.EncodeAction action = new BaseThread.EncodeAction() { @Override public String action() { try { return encryption(); } catch (Exception e) { callback.onFailure(e); } return null; } };
new EncodingThread(action, new BaseThread.ThreadCallback<String>() {
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/RIPEMD_160.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils;
*/ private static final int[] X = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, }; /** * Index of 32-bits word in right line */ private static final int[] XX = { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/RIPEMD_160.java import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils; */ private static final int[] X = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, }; /** * Index of 32-bits word in right line */ private static final int[] XX = { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
int[] array = ArrayUtils.convertListToArray(intList);
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/MD4.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils;
/* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The MD4 Message-Digest Algorithm */ class MD4 { /** * MD Buffer */ private int A; private int B; private int C; private int D; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/MD4.java import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils; /* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The MD4 Message-Digest Algorithm */ class MD4 { /** * MD Buffer */ private int A; private int B; private int C; private int D; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
int[] array = ArrayUtils.convertListToArray(intList);
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/SHA224.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils;
/* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The SHA224 Message-Digest Algorithm */ class SHA224 { private static final int[] K = { 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 }; /** * Message Digest Buffer */ private int A; private int B; private int C; private int D; private int E; private int F; private int G; private int H; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/SHA224.java import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils; /* * Copyright (C) 2017 BullyBoo * * 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 ru.bullyboo.encoder.hashes; /** * The SHA224 Message-Digest Algorithm */ class SHA224 { private static final int[] K = { 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 }; /** * Message Digest Buffer */ private int A; private int B; private int C; private int D; private int E; private int F; private int G; private int H; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
int[] array = ArrayUtils.convertListToArray(intList);
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/RIPEMD_320.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils;
*/ private static final int[] X = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, }; /** * Index of 32-bits word in right line */ private static final int[] XX = { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/RIPEMD_320.java import java.util.ArrayList; import java.util.List; import ru.bullyboo.encoder.utils.ArrayUtils; */ private static final int[] X = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, }; /** * Index of 32-bits word in right line */ private static final int[] XX = { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }; /** * This method return hash of message */ public String getHash(String input){ byte[] bytes = input.getBytes(); List<Integer> intList = appendPaddingBits(bytes); intList = appendLength(intList, bytes.length * 8);
int[] array = ArrayUtils.convertListToArray(intList);
BullyBoo/Encryption
encoder/src/main/java/ru/bullyboo/encoder/hashes/MD2.java
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // }
import ru.bullyboo.encoder.utils.ArrayUtils;
* becomes congruent to 0, modulo 16. At least one byte and at most 16 * 16 bytes are appended. * * At this point the resulting message (after padding with bytes) has a * length that is an exact multiple of 16 bytes. Let M[0 ... N-1] denote * the bytes of the resulting message, where N is a multiple of 16. * * Copied from RFC 1319 * Page 1 * https://tools.ietf.org/html/rfc1319 * */ private int[] appendPaddingBytes(byte[] bytes){ int size = bytes.length; int temp = size; do{ temp++; } while (temp % 16 != 0); int value = temp - size; int[] paddingBytes = new int[value]; for(int i = 0; i < value ; i++){ paddingBytes[i] = value; }
// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java // public class ArrayUtils { // // public static int[] mergeArrays(byte[] mainArray, int[] appendArray){ // // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // for(int i = 0; i < mainSize; i++){ // array[i] = mainArray[i]; // } // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] mergeArrays(int[] mainArray, int[] appendArray){ // int[] array = new int[mainArray.length + appendArray.length]; // // int mainSize = mainArray.length; // int appendSize = appendArray.length; // // System.arraycopy(mainArray, 0, array, 0, mainSize); // // System.arraycopy(appendArray, 0, array, mainSize, appendSize); // // return array; // } // // public static int[] convertListToArray(List<Integer> integerList){ // int[] array = new int[integerList.size()]; // // for(int i = 0; i < integerList.size(); i++){ // array[i] = integerList.get(i); // } // // return array; // } // } // Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/MD2.java import ru.bullyboo.encoder.utils.ArrayUtils; * becomes congruent to 0, modulo 16. At least one byte and at most 16 * 16 bytes are appended. * * At this point the resulting message (after padding with bytes) has a * length that is an exact multiple of 16 bytes. Let M[0 ... N-1] denote * the bytes of the resulting message, where N is a multiple of 16. * * Copied from RFC 1319 * Page 1 * https://tools.ietf.org/html/rfc1319 * */ private int[] appendPaddingBytes(byte[] bytes){ int size = bytes.length; int temp = size; do{ temp++; } while (temp % 16 != 0); int value = temp - size; int[] paddingBytes = new int[value]; for(int i = 0; i < value ; i++){ paddingBytes[i] = value; }
return ArrayUtils.mergeArrays(bytes, paddingBytes);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HelpActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/ExpandableListAdapter.java // public class ExpandableListAdapter extends BaseExpandableListAdapter { // // private final Context context; // private final List<String> expandableListTitle; // private final HashMap<String, List<String>> expandableListDetail; // // public ExpandableListAdapter(Context context, List<String> expandableListTitle, // HashMap<String, List<String>> expandableListDetail) { // this.context = context; // this.expandableListTitle = expandableListTitle; // this.expandableListDetail = expandableListDetail; // } // // @Override // public Object getChild(int listPosition, int expandedListPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .get(expandedListPosition); // } // // @Override // public long getChildId(int listPosition, int expandedListPosition) { // return expandedListPosition; // } // // @Override // public View getChildView(int listPosition, final int expandedListPosition, // boolean isLastChild, View convertView, ViewGroup parent) { // final String expandedListText = (String) getChild(listPosition, expandedListPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_item, null); // } // TextView expandedListTextView = (TextView) convertView // .findViewById(R.id.expandedListItem); // expandedListTextView.setText(expandedListText); // return convertView; // } // // @Override // public int getChildrenCount(int listPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .size(); // } // // @Override // public Object getGroup(int listPosition) { // return this.expandableListTitle.get(listPosition); // } // // @Override // public int getGroupCount() { // return this.expandableListTitle.size(); // } // // @Override // public long getGroupId(int listPosition) { // return listPosition; // } // // @Override // public View getGroupView(int listPosition, boolean isExpanded, // View convertView, ViewGroup parent) { // String listTitle = (String) getGroup(listPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context. // getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_group, null); // } // TextView listTitleTextView = (TextView) convertView // .findViewById(R.id.listTitle); // listTitleTextView.setTypeface(null, Typeface.BOLD); // listTitleTextView.setText(listTitle); // return convertView; // } // // @Override // public boolean hasStableIds() { // return false; // } // // @Override // public boolean isChildSelectable(int listPosition, int expandedListPosition) { // return true; // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/HelpDataDump.java // public class HelpDataDump { // // private final Context context; // // public HelpDataDump(Context context) { // this.context = context; // } // // public LinkedHashMap<String, List<String>> getDataGeneral() { // LinkedHashMap<String, List<String>> expandableListDetail = new LinkedHashMap<String, List<String>>(); // // List<String> general = new ArrayList<String>(); // general.add(context.getResources().getString(R.string.help_whatis_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_whatis), general); // // List<String> features = new ArrayList<String>(); // features.add(context.getResources().getString(R.string.help_usability_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_usability), features); // // List<String> privacy = new ArrayList<String>(); // // privacy.add(context.getResources().getString(R.string.help_privacy_answer)); // // // expandableListDetail.put(context.getResources().getString(R.string.help_privacy), privacy); // // List<String> permissions = new ArrayList<String>(); // permissions.add(context.getResources().getString(R.string.help_permission_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_permission), permissions); // // return expandableListDetail; // } // // }
import android.annotation.SuppressLint; import android.os.Bundle; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.ExpandableListAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.HelpDataDump; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; public class HelpActivity extends AppCompatActivity { @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/ExpandableListAdapter.java // public class ExpandableListAdapter extends BaseExpandableListAdapter { // // private final Context context; // private final List<String> expandableListTitle; // private final HashMap<String, List<String>> expandableListDetail; // // public ExpandableListAdapter(Context context, List<String> expandableListTitle, // HashMap<String, List<String>> expandableListDetail) { // this.context = context; // this.expandableListTitle = expandableListTitle; // this.expandableListDetail = expandableListDetail; // } // // @Override // public Object getChild(int listPosition, int expandedListPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .get(expandedListPosition); // } // // @Override // public long getChildId(int listPosition, int expandedListPosition) { // return expandedListPosition; // } // // @Override // public View getChildView(int listPosition, final int expandedListPosition, // boolean isLastChild, View convertView, ViewGroup parent) { // final String expandedListText = (String) getChild(listPosition, expandedListPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_item, null); // } // TextView expandedListTextView = (TextView) convertView // .findViewById(R.id.expandedListItem); // expandedListTextView.setText(expandedListText); // return convertView; // } // // @Override // public int getChildrenCount(int listPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .size(); // } // // @Override // public Object getGroup(int listPosition) { // return this.expandableListTitle.get(listPosition); // } // // @Override // public int getGroupCount() { // return this.expandableListTitle.size(); // } // // @Override // public long getGroupId(int listPosition) { // return listPosition; // } // // @Override // public View getGroupView(int listPosition, boolean isExpanded, // View convertView, ViewGroup parent) { // String listTitle = (String) getGroup(listPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context. // getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_group, null); // } // TextView listTitleTextView = (TextView) convertView // .findViewById(R.id.listTitle); // listTitleTextView.setTypeface(null, Typeface.BOLD); // listTitleTextView.setText(listTitle); // return convertView; // } // // @Override // public boolean hasStableIds() { // return false; // } // // @Override // public boolean isChildSelectable(int listPosition, int expandedListPosition) { // return true; // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/HelpDataDump.java // public class HelpDataDump { // // private final Context context; // // public HelpDataDump(Context context) { // this.context = context; // } // // public LinkedHashMap<String, List<String>> getDataGeneral() { // LinkedHashMap<String, List<String>> expandableListDetail = new LinkedHashMap<String, List<String>>(); // // List<String> general = new ArrayList<String>(); // general.add(context.getResources().getString(R.string.help_whatis_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_whatis), general); // // List<String> features = new ArrayList<String>(); // features.add(context.getResources().getString(R.string.help_usability_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_usability), features); // // List<String> privacy = new ArrayList<String>(); // // privacy.add(context.getResources().getString(R.string.help_privacy_answer)); // // // expandableListDetail.put(context.getResources().getString(R.string.help_privacy), privacy); // // List<String> permissions = new ArrayList<String>(); // permissions.add(context.getResources().getString(R.string.help_permission_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_permission), permissions); // // return expandableListDetail; // } // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HelpActivity.java import android.annotation.SuppressLint; import android.os.Bundle; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.ExpandableListAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.HelpDataDump; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; public class HelpActivity extends AppCompatActivity { @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
ExpandableListAdapter expandableListAdapter;
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HelpActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/ExpandableListAdapter.java // public class ExpandableListAdapter extends BaseExpandableListAdapter { // // private final Context context; // private final List<String> expandableListTitle; // private final HashMap<String, List<String>> expandableListDetail; // // public ExpandableListAdapter(Context context, List<String> expandableListTitle, // HashMap<String, List<String>> expandableListDetail) { // this.context = context; // this.expandableListTitle = expandableListTitle; // this.expandableListDetail = expandableListDetail; // } // // @Override // public Object getChild(int listPosition, int expandedListPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .get(expandedListPosition); // } // // @Override // public long getChildId(int listPosition, int expandedListPosition) { // return expandedListPosition; // } // // @Override // public View getChildView(int listPosition, final int expandedListPosition, // boolean isLastChild, View convertView, ViewGroup parent) { // final String expandedListText = (String) getChild(listPosition, expandedListPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_item, null); // } // TextView expandedListTextView = (TextView) convertView // .findViewById(R.id.expandedListItem); // expandedListTextView.setText(expandedListText); // return convertView; // } // // @Override // public int getChildrenCount(int listPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .size(); // } // // @Override // public Object getGroup(int listPosition) { // return this.expandableListTitle.get(listPosition); // } // // @Override // public int getGroupCount() { // return this.expandableListTitle.size(); // } // // @Override // public long getGroupId(int listPosition) { // return listPosition; // } // // @Override // public View getGroupView(int listPosition, boolean isExpanded, // View convertView, ViewGroup parent) { // String listTitle = (String) getGroup(listPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context. // getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_group, null); // } // TextView listTitleTextView = (TextView) convertView // .findViewById(R.id.listTitle); // listTitleTextView.setTypeface(null, Typeface.BOLD); // listTitleTextView.setText(listTitle); // return convertView; // } // // @Override // public boolean hasStableIds() { // return false; // } // // @Override // public boolean isChildSelectable(int listPosition, int expandedListPosition) { // return true; // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/HelpDataDump.java // public class HelpDataDump { // // private final Context context; // // public HelpDataDump(Context context) { // this.context = context; // } // // public LinkedHashMap<String, List<String>> getDataGeneral() { // LinkedHashMap<String, List<String>> expandableListDetail = new LinkedHashMap<String, List<String>>(); // // List<String> general = new ArrayList<String>(); // general.add(context.getResources().getString(R.string.help_whatis_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_whatis), general); // // List<String> features = new ArrayList<String>(); // features.add(context.getResources().getString(R.string.help_usability_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_usability), features); // // List<String> privacy = new ArrayList<String>(); // // privacy.add(context.getResources().getString(R.string.help_privacy_answer)); // // // expandableListDetail.put(context.getResources().getString(R.string.help_privacy), privacy); // // List<String> permissions = new ArrayList<String>(); // permissions.add(context.getResources().getString(R.string.help_permission_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_permission), permissions); // // return expandableListDetail; // } // // }
import android.annotation.SuppressLint; import android.os.Bundle; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.ExpandableListAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.HelpDataDump; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; public class HelpActivity extends AppCompatActivity { @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); ExpandableListAdapter expandableListAdapter;
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/ExpandableListAdapter.java // public class ExpandableListAdapter extends BaseExpandableListAdapter { // // private final Context context; // private final List<String> expandableListTitle; // private final HashMap<String, List<String>> expandableListDetail; // // public ExpandableListAdapter(Context context, List<String> expandableListTitle, // HashMap<String, List<String>> expandableListDetail) { // this.context = context; // this.expandableListTitle = expandableListTitle; // this.expandableListDetail = expandableListDetail; // } // // @Override // public Object getChild(int listPosition, int expandedListPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .get(expandedListPosition); // } // // @Override // public long getChildId(int listPosition, int expandedListPosition) { // return expandedListPosition; // } // // @Override // public View getChildView(int listPosition, final int expandedListPosition, // boolean isLastChild, View convertView, ViewGroup parent) { // final String expandedListText = (String) getChild(listPosition, expandedListPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_item, null); // } // TextView expandedListTextView = (TextView) convertView // .findViewById(R.id.expandedListItem); // expandedListTextView.setText(expandedListText); // return convertView; // } // // @Override // public int getChildrenCount(int listPosition) { // return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) // .size(); // } // // @Override // public Object getGroup(int listPosition) { // return this.expandableListTitle.get(listPosition); // } // // @Override // public int getGroupCount() { // return this.expandableListTitle.size(); // } // // @Override // public long getGroupId(int listPosition) { // return listPosition; // } // // @Override // public View getGroupView(int listPosition, boolean isExpanded, // View convertView, ViewGroup parent) { // String listTitle = (String) getGroup(listPosition); // if (convertView == null) { // LayoutInflater layoutInflater = (LayoutInflater) this.context. // getSystemService(Context.LAYOUT_INFLATER_SERVICE); // convertView = layoutInflater.inflate(R.layout.list_group, null); // } // TextView listTitleTextView = (TextView) convertView // .findViewById(R.id.listTitle); // listTitleTextView.setTypeface(null, Typeface.BOLD); // listTitleTextView.setText(listTitle); // return convertView; // } // // @Override // public boolean hasStableIds() { // return false; // } // // @Override // public boolean isChildSelectable(int listPosition, int expandedListPosition) { // return true; // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/helpers/HelpDataDump.java // public class HelpDataDump { // // private final Context context; // // public HelpDataDump(Context context) { // this.context = context; // } // // public LinkedHashMap<String, List<String>> getDataGeneral() { // LinkedHashMap<String, List<String>> expandableListDetail = new LinkedHashMap<String, List<String>>(); // // List<String> general = new ArrayList<String>(); // general.add(context.getResources().getString(R.string.help_whatis_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_whatis), general); // // List<String> features = new ArrayList<String>(); // features.add(context.getResources().getString(R.string.help_usability_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_usability), features); // // List<String> privacy = new ArrayList<String>(); // // privacy.add(context.getResources().getString(R.string.help_privacy_answer)); // // // expandableListDetail.put(context.getResources().getString(R.string.help_privacy), privacy); // // List<String> permissions = new ArrayList<String>(); // permissions.add(context.getResources().getString(R.string.help_permission_answer)); // // expandableListDetail.put(context.getResources().getString(R.string.help_permission), permissions); // // return expandableListDetail; // } // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HelpActivity.java import android.annotation.SuppressLint; import android.os.Bundle; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.ExpandableListAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.HelpDataDump; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; public class HelpActivity extends AppCompatActivity { @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); ExpandableListAdapter expandableListAdapter;
HelpDataDump helpDataDump = new HelpDataDump(this);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/resultfragments/EmailResultFragment.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/EmailResultAdapter.java // public class EmailResultAdapter extends RecyclerView.Adapter<EmailResultAdapter.EmailViewHolder> { // // public static class EmailResultItem { // public final EmailResultItemType type; // public final String content; // // EmailResultItem(EmailResultItemType type, String content) { // this.type = type; // this.content = content; // } // } // // public enum EmailResultItemType { // TYPE_TO(R.string.item_result_email_to), // TYPE_CC(R.string.item_result_email_cc), // TYPE_BCC(R.string.item_result_email_bcc), // TYPE_SUBJECT(R.string.item_result_email_subject), // TYPE_BODY(R.string.item_result_email_body); // // @StringRes // int local; // // EmailResultItemType(int local) { // this.local = local; // } // } // // private final List<EmailResultItem> resultItems = new ArrayList<>(); // // private EmailResultAdapter(@NonNull List<EmailResultItem> resultItems) { // this.resultItems.addAll(resultItems); // } // // public EmailResultAdapter(EmailAddressParsedResult result) { // this(buildResultItems(result)); // } // // private static List<EmailResultItem> buildResultItems(EmailAddressParsedResult result) { // List<EmailResultItem> items = new ArrayList<>(); // // if(result != null) { // if(result.getTos() != null) { // for(String to : result.getTos()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_TO, to)); // } // } // if(result.getCCs() != null) { // for(String cc : result.getCCs()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_CC, cc)); // } // } // if(result.getBCCs() != null) { // for(String bcc : result.getBCCs()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_BCC, bcc)); // } // } // if(result.getSubject() != null) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_SUBJECT, result.getSubject())); // } // if(result.getBody() != null) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_BODY, result.getBody())); // } // } // return items; // } // // @NonNull // @Override // public EmailViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { // LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); // View v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // switch(EmailResultItemType.values()[viewType]) { // // case TYPE_CC: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_BCC: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_SUBJECT: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_BODY: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_TO: default: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // // // } // return new EmailViewHolder(v); // } // // @Override // public void onBindViewHolder(@NonNull EmailViewHolder viewHolder, int i) { // Context context = viewHolder.content.getContext(); // viewHolder.content.setText(resultItems.get(i).content); // viewHolder.type.setText(context.getString(resultItems.get(i).type.local)); // } // // @Override // public int getItemCount() { // return resultItems.size(); // } // // @Override // public int getItemViewType(int position) { // return resultItems.get(position).type.ordinal(); // } // // class EmailViewHolder extends RecyclerView.ViewHolder { // TextView content; // TextView type; // EmailViewHolder(@NonNull View itemView) { // super(itemView); // content = itemView.findViewById(R.id.item_result_email_content); // type = itemView.findViewById(R.id.item_result_email_type); // } // } // }
import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.zxing.client.result.EmailAddressParsedResult; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.EmailResultAdapter;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments; public class EmailResultFragment extends ResultFragment { EmailAddressParsedResult result; RecyclerView resultList; public EmailResultFragment() { // Required empty public constructor } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_result_email, container, false); result = (EmailAddressParsedResult) parsedResult; resultList = v.findViewById(R.id.fragment_result_recycler_view); resultList.setLayoutManager(new LinearLayoutManager(getContext()));
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/EmailResultAdapter.java // public class EmailResultAdapter extends RecyclerView.Adapter<EmailResultAdapter.EmailViewHolder> { // // public static class EmailResultItem { // public final EmailResultItemType type; // public final String content; // // EmailResultItem(EmailResultItemType type, String content) { // this.type = type; // this.content = content; // } // } // // public enum EmailResultItemType { // TYPE_TO(R.string.item_result_email_to), // TYPE_CC(R.string.item_result_email_cc), // TYPE_BCC(R.string.item_result_email_bcc), // TYPE_SUBJECT(R.string.item_result_email_subject), // TYPE_BODY(R.string.item_result_email_body); // // @StringRes // int local; // // EmailResultItemType(int local) { // this.local = local; // } // } // // private final List<EmailResultItem> resultItems = new ArrayList<>(); // // private EmailResultAdapter(@NonNull List<EmailResultItem> resultItems) { // this.resultItems.addAll(resultItems); // } // // public EmailResultAdapter(EmailAddressParsedResult result) { // this(buildResultItems(result)); // } // // private static List<EmailResultItem> buildResultItems(EmailAddressParsedResult result) { // List<EmailResultItem> items = new ArrayList<>(); // // if(result != null) { // if(result.getTos() != null) { // for(String to : result.getTos()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_TO, to)); // } // } // if(result.getCCs() != null) { // for(String cc : result.getCCs()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_CC, cc)); // } // } // if(result.getBCCs() != null) { // for(String bcc : result.getBCCs()) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_BCC, bcc)); // } // } // if(result.getSubject() != null) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_SUBJECT, result.getSubject())); // } // if(result.getBody() != null) { // items.add(new EmailResultItem(EmailResultItemType.TYPE_BODY, result.getBody())); // } // } // return items; // } // // @NonNull // @Override // public EmailViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { // LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); // View v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // switch(EmailResultItemType.values()[viewType]) { // // case TYPE_CC: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_BCC: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_SUBJECT: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_BODY: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // case TYPE_TO: default: // // v = inflater.inflate(R.layout.item_result_email, viewGroup, false); // // break; // // // // } // return new EmailViewHolder(v); // } // // @Override // public void onBindViewHolder(@NonNull EmailViewHolder viewHolder, int i) { // Context context = viewHolder.content.getContext(); // viewHolder.content.setText(resultItems.get(i).content); // viewHolder.type.setText(context.getString(resultItems.get(i).type.local)); // } // // @Override // public int getItemCount() { // return resultItems.size(); // } // // @Override // public int getItemViewType(int position) { // return resultItems.get(position).type.ordinal(); // } // // class EmailViewHolder extends RecyclerView.ViewHolder { // TextView content; // TextView type; // EmailViewHolder(@NonNull View itemView) { // super(itemView); // content = itemView.findViewById(R.id.item_result_email_content); // type = itemView.findViewById(R.id.item_result_email_type); // } // } // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/resultfragments/EmailResultFragment.java import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.zxing.client.result.EmailAddressParsedResult; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.EmailResultAdapter; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments; public class EmailResultFragment extends ResultFragment { EmailAddressParsedResult result; RecyclerView resultList; public EmailResultFragment() { // Required empty public constructor } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_result_email, container, false); result = (EmailAddressParsedResult) parsedResult; resultList = v.findViewById(R.id.fragment_result_recycler_view); resultList.setLayoutManager(new LinearLayoutManager(getContext()));
resultList.setAdapter(new EmailResultAdapter(result));
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/HistoryItem.java // @Entity(tableName = "Histories") // public class HistoryItem { // // @PrimaryKey(autoGenerate = true) private int _id; // private Bitmap image; // @NonNull // private String text = ""; // private byte[] rawBytes; // private int numBits; // private ResultPoint[] resultPoints; // private BarcodeFormat format; // private long timestamp; // // public void setImage(Bitmap image) { // this.image = image; // } // // public int get_id() { // return _id; // } // // public void set_id(int _id) { // this._id = _id; // } // // @NonNull // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // public byte[] getRawBytes() { // return rawBytes; // } // // public void setRawBytes(byte[] rawBytes) { // this.rawBytes = rawBytes; // } // // public int getNumBits() { // return numBits; // } // // public void setNumBits(int numBits) { // this.numBits = numBits; // } // // public ResultPoint[] getResultPoints() { // return resultPoints; // } // // public void setResultPoints(ResultPoint[] resultPoints) { // this.resultPoints = resultPoints; // } // // public BarcodeFormat getFormat() { // return format; // } // // public void setFormat(BarcodeFormat format) { // this.format = format; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public HistoryItem() {} // // @Ignore // protected HistoryItem(Parcel in) { // _id = in.readInt(); // image = Converters.decodeImage(in.readString()); // text = in.readString(); // rawBytes = in.createByteArray(); // numBits = in.readInt(); // timestamp = in.readLong(); // format = BarcodeFormat.values()[in.readInt()]; // // resultPoints = new ResultPoint[in.readInt()]; // for(int i = 0; i < resultPoints.length; i++) { // resultPoints[i] = new ResultPoint(in.readFloat(), in.readFloat()); // } // } // // public void writeToParcel(Parcel dest, int flags) { // dest.writeInt(_id); // dest.writeString(Converters.encodeImage(image)); // dest.writeString(text); // dest.writeByteArray(rawBytes); // dest.writeInt(numBits); // dest.writeLong(timestamp); // dest.writeInt(format.ordinal()); // // dest.writeInt(resultPoints != null ? resultPoints.length : 0); // for(ResultPoint rp : resultPoints) { // dest.writeFloat(rp.getX()); // dest.writeFloat(rp.getY()); // } // } // // public int describeContents() { // return 0; // } // // // public static final Creator<HistoryItem> CREATOR = new Creator<HistoryItem>() { // // @Override // // public HistoryItem createFromParcel(Parcel in) { // // return new HistoryItem(in); // // } // // // // @Override // // public HistoryItem[] newArray(int size) { // // return new HistoryItem[size]; // // } // // }; // // public Result getResult() { // return new Result(text, rawBytes, numBits, resultPoints,format,timestamp); // } // public Bitmap getImage() { // return image; // } // // public long getTimestamp() { // return timestamp; // } // // // }
import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.database.HistoryItem; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel; public class HistoryViewModel extends AndroidViewModel { private final ExecutorService executorService = Executors.newSingleThreadExecutor();
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/HistoryItem.java // @Entity(tableName = "Histories") // public class HistoryItem { // // @PrimaryKey(autoGenerate = true) private int _id; // private Bitmap image; // @NonNull // private String text = ""; // private byte[] rawBytes; // private int numBits; // private ResultPoint[] resultPoints; // private BarcodeFormat format; // private long timestamp; // // public void setImage(Bitmap image) { // this.image = image; // } // // public int get_id() { // return _id; // } // // public void set_id(int _id) { // this._id = _id; // } // // @NonNull // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // public byte[] getRawBytes() { // return rawBytes; // } // // public void setRawBytes(byte[] rawBytes) { // this.rawBytes = rawBytes; // } // // public int getNumBits() { // return numBits; // } // // public void setNumBits(int numBits) { // this.numBits = numBits; // } // // public ResultPoint[] getResultPoints() { // return resultPoints; // } // // public void setResultPoints(ResultPoint[] resultPoints) { // this.resultPoints = resultPoints; // } // // public BarcodeFormat getFormat() { // return format; // } // // public void setFormat(BarcodeFormat format) { // this.format = format; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public HistoryItem() {} // // @Ignore // protected HistoryItem(Parcel in) { // _id = in.readInt(); // image = Converters.decodeImage(in.readString()); // text = in.readString(); // rawBytes = in.createByteArray(); // numBits = in.readInt(); // timestamp = in.readLong(); // format = BarcodeFormat.values()[in.readInt()]; // // resultPoints = new ResultPoint[in.readInt()]; // for(int i = 0; i < resultPoints.length; i++) { // resultPoints[i] = new ResultPoint(in.readFloat(), in.readFloat()); // } // } // // public void writeToParcel(Parcel dest, int flags) { // dest.writeInt(_id); // dest.writeString(Converters.encodeImage(image)); // dest.writeString(text); // dest.writeByteArray(rawBytes); // dest.writeInt(numBits); // dest.writeLong(timestamp); // dest.writeInt(format.ordinal()); // // dest.writeInt(resultPoints != null ? resultPoints.length : 0); // for(ResultPoint rp : resultPoints) { // dest.writeFloat(rp.getX()); // dest.writeFloat(rp.getY()); // } // } // // public int describeContents() { // return 0; // } // // // public static final Creator<HistoryItem> CREATOR = new Creator<HistoryItem>() { // // @Override // // public HistoryItem createFromParcel(Parcel in) { // // return new HistoryItem(in); // // } // // // // @Override // // public HistoryItem[] newArray(int size) { // // return new HistoryItem[size]; // // } // // }; // // public Result getResult() { // return new Result(text, rawBytes, numBits, resultPoints,format,timestamp); // } // public Bitmap getImage() { // return image; // } // // public long getTimestamp() { // return timestamp; // } // // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.database.HistoryItem; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel; public class HistoryViewModel extends AndroidViewModel { private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private final MediatorLiveData<List<HistoryItem>> historyItemsLiveData = new MediatorLiveData<>();
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/HistoryItem.java // @Entity(tableName = "Histories") // public class HistoryItem { // // @PrimaryKey(autoGenerate = true) private int _id; // private Bitmap image; // @NonNull // private String text = ""; // private byte[] rawBytes; // private int numBits; // private ResultPoint[] resultPoints; // private BarcodeFormat format; // private long timestamp; // // public void setImage(Bitmap image) { // this.image = image; // } // // public int get_id() { // return _id; // } // // public void set_id(int _id) { // this._id = _id; // } // // @NonNull // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // public byte[] getRawBytes() { // return rawBytes; // } // // public void setRawBytes(byte[] rawBytes) { // this.rawBytes = rawBytes; // } // // public int getNumBits() { // return numBits; // } // // public void setNumBits(int numBits) { // this.numBits = numBits; // } // // public ResultPoint[] getResultPoints() { // return resultPoints; // } // // public void setResultPoints(ResultPoint[] resultPoints) { // this.resultPoints = resultPoints; // } // // public BarcodeFormat getFormat() { // return format; // } // // public void setFormat(BarcodeFormat format) { // this.format = format; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public HistoryItem() {} // // @Ignore // protected HistoryItem(Parcel in) { // _id = in.readInt(); // image = Converters.decodeImage(in.readString()); // text = in.readString(); // rawBytes = in.createByteArray(); // numBits = in.readInt(); // timestamp = in.readLong(); // format = BarcodeFormat.values()[in.readInt()]; // // resultPoints = new ResultPoint[in.readInt()]; // for(int i = 0; i < resultPoints.length; i++) { // resultPoints[i] = new ResultPoint(in.readFloat(), in.readFloat()); // } // } // // public void writeToParcel(Parcel dest, int flags) { // dest.writeInt(_id); // dest.writeString(Converters.encodeImage(image)); // dest.writeString(text); // dest.writeByteArray(rawBytes); // dest.writeInt(numBits); // dest.writeLong(timestamp); // dest.writeInt(format.ordinal()); // // dest.writeInt(resultPoints != null ? resultPoints.length : 0); // for(ResultPoint rp : resultPoints) { // dest.writeFloat(rp.getX()); // dest.writeFloat(rp.getY()); // } // } // // public int describeContents() { // return 0; // } // // // public static final Creator<HistoryItem> CREATOR = new Creator<HistoryItem>() { // // @Override // // public HistoryItem createFromParcel(Parcel in) { // // return new HistoryItem(in); // // } // // // // @Override // // public HistoryItem[] newArray(int size) { // // return new HistoryItem[size]; // // } // // }; // // public Result getResult() { // return new Result(text, rawBytes, numBits, resultPoints,format,timestamp); // } // public Bitmap getImage() { // return image; // } // // public long getTimestamp() { // return timestamp; // } // // // }
import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.database.HistoryItem; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel; public class HistoryViewModel extends AndroidViewModel { private final ExecutorService executorService = Executors.newSingleThreadExecutor(); private final MediatorLiveData<List<HistoryItem>> historyItemsLiveData = new MediatorLiveData<>(); public HistoryViewModel(@NonNull final Application application) { super(application); loadHistories(); } public LiveData<List<HistoryItem>> getHistoryItems() { return historyItemsLiveData; } private void loadHistories() {
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/HistoryItem.java // @Entity(tableName = "Histories") // public class HistoryItem { // // @PrimaryKey(autoGenerate = true) private int _id; // private Bitmap image; // @NonNull // private String text = ""; // private byte[] rawBytes; // private int numBits; // private ResultPoint[] resultPoints; // private BarcodeFormat format; // private long timestamp; // // public void setImage(Bitmap image) { // this.image = image; // } // // public int get_id() { // return _id; // } // // public void set_id(int _id) { // this._id = _id; // } // // @NonNull // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // public byte[] getRawBytes() { // return rawBytes; // } // // public void setRawBytes(byte[] rawBytes) { // this.rawBytes = rawBytes; // } // // public int getNumBits() { // return numBits; // } // // public void setNumBits(int numBits) { // this.numBits = numBits; // } // // public ResultPoint[] getResultPoints() { // return resultPoints; // } // // public void setResultPoints(ResultPoint[] resultPoints) { // this.resultPoints = resultPoints; // } // // public BarcodeFormat getFormat() { // return format; // } // // public void setFormat(BarcodeFormat format) { // this.format = format; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public HistoryItem() {} // // @Ignore // protected HistoryItem(Parcel in) { // _id = in.readInt(); // image = Converters.decodeImage(in.readString()); // text = in.readString(); // rawBytes = in.createByteArray(); // numBits = in.readInt(); // timestamp = in.readLong(); // format = BarcodeFormat.values()[in.readInt()]; // // resultPoints = new ResultPoint[in.readInt()]; // for(int i = 0; i < resultPoints.length; i++) { // resultPoints[i] = new ResultPoint(in.readFloat(), in.readFloat()); // } // } // // public void writeToParcel(Parcel dest, int flags) { // dest.writeInt(_id); // dest.writeString(Converters.encodeImage(image)); // dest.writeString(text); // dest.writeByteArray(rawBytes); // dest.writeInt(numBits); // dest.writeLong(timestamp); // dest.writeInt(format.ordinal()); // // dest.writeInt(resultPoints != null ? resultPoints.length : 0); // for(ResultPoint rp : resultPoints) { // dest.writeFloat(rp.getX()); // dest.writeFloat(rp.getY()); // } // } // // public int describeContents() { // return 0; // } // // // public static final Creator<HistoryItem> CREATOR = new Creator<HistoryItem>() { // // @Override // // public HistoryItem createFromParcel(Parcel in) { // // return new HistoryItem(in); // // } // // // // @Override // // public HistoryItem[] newArray(int size) { // // return new HistoryItem[size]; // // } // // }; // // public Result getResult() { // return new Result(text, rawBytes, numBits, resultPoints,format,timestamp); // } // public Bitmap getImage() { // return image; // } // // public long getTimestamp() { // return timestamp; // } // // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.database.HistoryItem; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel; public class HistoryViewModel extends AndroidViewModel { private final ExecutorService executorService = Executors.newSingleThreadExecutor(); private final MediatorLiveData<List<HistoryItem>> historyItemsLiveData = new MediatorLiveData<>(); public HistoryViewModel(@NonNull final Application application) { super(application); loadHistories(); } public LiveData<List<HistoryItem>> getHistoryItems() { return historyItemsLiveData; } private void loadHistories() {
LiveData<List<HistoryItem>> historyEntries = AppRepository.getInstance(getApplication()).getHistoryEntriesLiveData();
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppDatabase.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/Utils.java // public class Utils { // // public static Bitmap generateCode(String data, BarcodeFormat format, Map<EncodeHintType, Object> hints, Map<ResultMetadataType,Object> metadata) { // if(hints == null) { // hints = new EnumMap<>(EncodeHintType.class); // } // // if(!hints.containsKey(ERROR_CORRECTION) && metadata != null && metadata.containsKey(ERROR_CORRECTION_LEVEL)) { // Object ec = metadata.get(ERROR_CORRECTION_LEVEL); // if(ec != null) { // hints.put(ERROR_CORRECTION, ec); // } // } // if(!hints.containsKey(ERROR_CORRECTION) && format!=BarcodeFormat.AZTEC) { // hints.put(ERROR_CORRECTION, ErrorCorrectionLevel.L.name()); // } // // return generateCode(data, getFormat(format), hints); // only reshow as QR Codes // } // // private static BarcodeFormat getFormat(BarcodeFormat format) { // switch (format) { // case EAN_8: // case UPC_E: // case EAN_13: // case UPC_A: // case QR_CODE: // case CODE_39: // case CODE_93: // case CODE_128: // case ITF: // case PDF_417: // case CODABAR: // case DATA_MATRIX: // case AZTEC: // return format; // default: // return BarcodeFormat.QR_CODE; // } // } // // public static Bitmap generateCode(String data, BarcodeFormat format, Map<EncodeHintType,?> hints) { // try { // MultiFormatWriter writer = new MultiFormatWriter(); // BitMatrix result = writer.encode(data, format, 100, 100, hints); // int width = result.getWidth(); // int height = result.getHeight(); // int[] pixels = new int[width * height]; // // All are 0, or black, by default // for (int y = 0; y < height; y++) { // int offset = y * width; // for (int x = 0; x < width; x++) { // pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE; // } // } // Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // bitmap.setPixels(pixels, 0, width, 0, 0, width, height); // // return bitmap; // } catch (WriterException e) { // return null; // } // } // }
import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import androidx.annotation.NonNull; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import androidx.room.TypeConverters; import androidx.room.migration.Migration; import androidx.sqlite.db.SupportSQLiteDatabase; import com.google.zxing.BarcodeFormat; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.Utils; import java.util.GregorianCalendar;
public abstract HistoryDao historyDao(); private static AppDatabase INSTANCE; public static final Migration MIGRATION_1_2 = new Migration(1,2) { @Override public void migrate(@NonNull SupportSQLiteDatabase database) { database.execSQL("CREATE TABLE `Histories` (" + "`_id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "`text` TEXT NOT NULL," + "`image` TEXT," + "`rawBytes` BLOB," + "`numBits` INTEGER NOT NULL DEFAULT 0," + "`timestamp` INTEGER NOT NULL DEFAULT 0," + "`format` TEXT," + "`resultPoints` TEXT)"); database.execSQL("INSERT INTO Histories(text) SELECT content FROM contents"); database.execSQL("DROP TABLE contents;"); HistoryItem[] items = null; Cursor c = database.query("SELECT * FROM Histories"); if(c != null) { if(c.moveToFirst()) { items = new HistoryItem[c.getCount()]; int i = 0; while (!c.isAfterLast()) { items[i] = new HistoryItem(); items[i].set_id(c.getInt(c.getColumnIndex("_id"))); items[i].setText(c.getString(c.getColumnIndex("text")));
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/Utils.java // public class Utils { // // public static Bitmap generateCode(String data, BarcodeFormat format, Map<EncodeHintType, Object> hints, Map<ResultMetadataType,Object> metadata) { // if(hints == null) { // hints = new EnumMap<>(EncodeHintType.class); // } // // if(!hints.containsKey(ERROR_CORRECTION) && metadata != null && metadata.containsKey(ERROR_CORRECTION_LEVEL)) { // Object ec = metadata.get(ERROR_CORRECTION_LEVEL); // if(ec != null) { // hints.put(ERROR_CORRECTION, ec); // } // } // if(!hints.containsKey(ERROR_CORRECTION) && format!=BarcodeFormat.AZTEC) { // hints.put(ERROR_CORRECTION, ErrorCorrectionLevel.L.name()); // } // // return generateCode(data, getFormat(format), hints); // only reshow as QR Codes // } // // private static BarcodeFormat getFormat(BarcodeFormat format) { // switch (format) { // case EAN_8: // case UPC_E: // case EAN_13: // case UPC_A: // case QR_CODE: // case CODE_39: // case CODE_93: // case CODE_128: // case ITF: // case PDF_417: // case CODABAR: // case DATA_MATRIX: // case AZTEC: // return format; // default: // return BarcodeFormat.QR_CODE; // } // } // // public static Bitmap generateCode(String data, BarcodeFormat format, Map<EncodeHintType,?> hints) { // try { // MultiFormatWriter writer = new MultiFormatWriter(); // BitMatrix result = writer.encode(data, format, 100, 100, hints); // int width = result.getWidth(); // int height = result.getHeight(); // int[] pixels = new int[width * height]; // // All are 0, or black, by default // for (int y = 0; y < height; y++) { // int offset = y * width; // for (int x = 0; x < width; x++) { // pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE; // } // } // Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // bitmap.setPixels(pixels, 0, width, 0, 0, width, height); // // return bitmap; // } catch (WriterException e) { // return null; // } // } // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppDatabase.java import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import androidx.annotation.NonNull; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import androidx.room.TypeConverters; import androidx.room.migration.Migration; import androidx.sqlite.db.SupportSQLiteDatabase; import com.google.zxing.BarcodeFormat; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.Utils; import java.util.GregorianCalendar; public abstract HistoryDao historyDao(); private static AppDatabase INSTANCE; public static final Migration MIGRATION_1_2 = new Migration(1,2) { @Override public void migrate(@NonNull SupportSQLiteDatabase database) { database.execSQL("CREATE TABLE `Histories` (" + "`_id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "`text` TEXT NOT NULL," + "`image` TEXT," + "`rawBytes` BLOB," + "`numBits` INTEGER NOT NULL DEFAULT 0," + "`timestamp` INTEGER NOT NULL DEFAULT 0," + "`format` TEXT," + "`resultPoints` TEXT)"); database.execSQL("INSERT INTO Histories(text) SELECT content FROM contents"); database.execSQL("DROP TABLE contents;"); HistoryItem[] items = null; Cursor c = database.query("SELECT * FROM Histories"); if(c != null) { if(c.moveToFirst()) { items = new HistoryItem[c.getCount()]; int i = 0; while (!c.isAfterLast()) { items[i] = new HistoryItem(); items[i].set_id(c.getInt(c.getColumnIndex("_id"))); items[i].setText(c.getString(c.getColumnIndex("text")));
items[i].setImage(Utils.generateCode(items[i].getText(), BarcodeFormat.QR_CODE, null));
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/VcardEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); int maxLength7 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength7)}); int maxLength8 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength8)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = "N:"+qrLastname.getText().toString()+"\n"+"FN:"+qrName.getText().toString()+"\n"+"ORG:"+qrCompany.getText().toString()+"\n"+"TITLE:"+qrTitle.getText().toString()+"\n"+"ADR:;;"+qrStreet.getText().toString()+";"+qrCity.getText().toString()+"\n"+qrPostal.getText().toString()+"\n"+"TEL;CELL:"+qrPhone.getText().toString()+"\n"+"EMAIL;WORK;INTERNET:"+qrMail.getText().toString()+"\n"+"END:VCARD"; Intent i = new Intent(VcardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/VcardEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); int maxLength7 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength7)}); int maxLength8 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength8)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = "N:"+qrLastname.getText().toString()+"\n"+"FN:"+qrName.getText().toString()+"\n"+"ORG:"+qrCompany.getText().toString()+"\n"+"TITLE:"+qrTitle.getText().toString()+"\n"+"ADR:;;"+qrStreet.getText().toString()+";"+qrCity.getText().toString()+"\n"+qrPostal.getText().toString()+"\n"+"TEL;CELL:"+qrPhone.getText().toString()+"\n"+"EMAIL;WORK;INTERNET:"+qrMail.getText().toString()+"\n"+"END:VCARD"; Intent i = new Intent(VcardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.V_Card);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HistoryActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/HistoryAdapter.java // public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.HistoryItemViewHolder> { // // private final Context context; // private final List<HistoryItem> historyEntries; // // public HistoryAdapter(Context context) { // this.context = context; // this.historyEntries = new ArrayList<>(); // // setHasStableIds(true); // } // // public void setHistoryEntries(List<HistoryItem> entries) { // historyEntries.clear(); // historyEntries.addAll(entries); // notifyDataSetChanged(); // } // // @NonNull // @Override // public HistoryItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { // ItemHistoryCodeBinding binding = DataBindingUtil.inflate( // LayoutInflater.from(viewGroup.getContext()), // R.layout.item_history_code, // viewGroup, // false // ); // return new HistoryItemViewHolder(binding); // } // // @Override // public void onBindViewHolder(@NonNull HistoryItemViewHolder historyItemViewHolder, int i) { // ItemHistoryCodeBinding binding = historyItemViewHolder.binding; // HistoryItemViewModel viewModel = new HistoryItemViewModel(context, historyEntries.get(i)); // binding.setViewModel(viewModel); // binding.itemView.setOnClickListener(viewModel.onClickItem()); // binding.itemView.setOnLongClickListener(viewModel.onLongClickItem()); // // Bitmap image = historyEntries.get(i).getImage(); // if(image != null) { // Glide.with(context).load(image).placeholder(R.drawable.ic_no_image_accent_24dp).into(binding.itemHistoryImage); // } else { // Glide.with(context).load(R.drawable.ic_no_image_accent_24dp).into(binding.itemHistoryImage); // } // } // // @Override // public int getItemCount() { // return historyEntries.size(); // } // // @Override // public long getItemId(int i) { // return historyEntries.get(i).get_id(); // } // // public static class HistoryItemViewHolder extends RecyclerView.ViewHolder { // ItemHistoryCodeBinding binding; // // public HistoryItemViewHolder(@NonNull ItemHistoryCodeBinding binding) { // super(binding.itemView); // this.binding = binding; // } // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java // public class HistoryViewModel extends AndroidViewModel { // // private final ExecutorService executorService = Executors.newSingleThreadExecutor(); // // private final MediatorLiveData<List<HistoryItem>> historyItemsLiveData = new MediatorLiveData<>(); // // public HistoryViewModel(@NonNull final Application application) { // super(application); // // loadHistories(); // } // // public LiveData<List<HistoryItem>> getHistoryItems() { // return historyItemsLiveData; // } // // private void loadHistories() { // LiveData<List<HistoryItem>> historyEntries = AppRepository.getInstance(getApplication()).getHistoryEntriesLiveData(); // historyItemsLiveData.addSource(historyEntries, historyItemsLiveData::setValue); // } // }
import android.content.DialogInterface; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.HistoryAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel.HistoryViewModel;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * History Overview that shows a list of scanned codes. * * @author Christopher Beckmann */ public class HistoryActivity extends AppCompatActivity { private HistoryAdapter mHistoryAdapter; private RecyclerView mHistoryRecyclerView;
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/database/AppRepository.java // public class AppRepository { // // private static AppRepository INSTANCE = null; // // private final AppDatabase appDatabase; // // private final ExecutorService executor = Executors.newSingleThreadExecutor(); // // public synchronized static AppRepository getInstance(Context context) { // if(INSTANCE == null) { // INSTANCE = new AppRepository(context); // } // return INSTANCE; // } // // private AppRepository(Context context) { // this.appDatabase = AppDatabase.getInstance(context); // } // // public void deleteHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().delete(entry)); // } // // public void insertHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().insert(entry)); // } // // public void updateHistoryEntry(HistoryItem entry) { // executor.execute(() -> appDatabase.historyDao().update(entry)); // } // // public LiveData<List<HistoryItem>> getHistoryEntriesLiveData() { // return appDatabase.historyDao().getAllLiveData(); // } // // public void deleteAllHistoryEntries() { // executor.execute(() -> appDatabase.historyDao().deleteAll()); // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/adapter/HistoryAdapter.java // public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.HistoryItemViewHolder> { // // private final Context context; // private final List<HistoryItem> historyEntries; // // public HistoryAdapter(Context context) { // this.context = context; // this.historyEntries = new ArrayList<>(); // // setHasStableIds(true); // } // // public void setHistoryEntries(List<HistoryItem> entries) { // historyEntries.clear(); // historyEntries.addAll(entries); // notifyDataSetChanged(); // } // // @NonNull // @Override // public HistoryItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { // ItemHistoryCodeBinding binding = DataBindingUtil.inflate( // LayoutInflater.from(viewGroup.getContext()), // R.layout.item_history_code, // viewGroup, // false // ); // return new HistoryItemViewHolder(binding); // } // // @Override // public void onBindViewHolder(@NonNull HistoryItemViewHolder historyItemViewHolder, int i) { // ItemHistoryCodeBinding binding = historyItemViewHolder.binding; // HistoryItemViewModel viewModel = new HistoryItemViewModel(context, historyEntries.get(i)); // binding.setViewModel(viewModel); // binding.itemView.setOnClickListener(viewModel.onClickItem()); // binding.itemView.setOnLongClickListener(viewModel.onLongClickItem()); // // Bitmap image = historyEntries.get(i).getImage(); // if(image != null) { // Glide.with(context).load(image).placeholder(R.drawable.ic_no_image_accent_24dp).into(binding.itemHistoryImage); // } else { // Glide.with(context).load(R.drawable.ic_no_image_accent_24dp).into(binding.itemHistoryImage); // } // } // // @Override // public int getItemCount() { // return historyEntries.size(); // } // // @Override // public long getItemId(int i) { // return historyEntries.get(i).get_id(); // } // // public static class HistoryItemViewHolder extends RecyclerView.ViewHolder { // ItemHistoryCodeBinding binding; // // public HistoryItemViewHolder(@NonNull ItemHistoryCodeBinding binding) { // super(binding.itemView); // this.binding = binding; // } // } // } // // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/HistoryViewModel.java // public class HistoryViewModel extends AndroidViewModel { // // private final ExecutorService executorService = Executors.newSingleThreadExecutor(); // // private final MediatorLiveData<List<HistoryItem>> historyItemsLiveData = new MediatorLiveData<>(); // // public HistoryViewModel(@NonNull final Application application) { // super(application); // // loadHistories(); // } // // public LiveData<List<HistoryItem>> getHistoryItems() { // return historyItemsLiveData; // } // // private void loadHistories() { // LiveData<List<HistoryItem>> historyEntries = AppRepository.getInstance(getApplication()).getHistoryEntriesLiveData(); // historyItemsLiveData.addSource(historyEntries, historyItemsLiveData::setValue); // } // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/HistoryActivity.java import android.content.DialogInterface; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.database.AppRepository; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.adapter.HistoryAdapter; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel.HistoryViewModel; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * History Overview that shows a list of scanned codes. * * @author Christopher Beckmann */ public class HistoryActivity extends AppCompatActivity { private HistoryAdapter mHistoryAdapter; private RecyclerView mHistoryRecyclerView;
private HistoryViewModel mViewModel;
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/TelEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class TelEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tel_enter); final EditText qrResult = (EditText) findViewById(R.id.editPhone); Button generate = (Button) findViewById(R.id.generate); int maxLength = 15; qrResult.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(TelEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(TelEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/TelEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class TelEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tel_enter); final EditText qrResult = (EditText) findViewById(R.id.editPhone); Button generate = (Button) findViewById(R.id.generate); int maxLength = 15; qrResult.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(TelEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(TelEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.PHONE);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MmsEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MmsEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mms_enter); final EditText qrMms=(EditText) findViewById(R.id.editTel); final EditText qrText=(EditText) findViewById(R.id.editText1); Button generate=(Button) findViewById(R.id.generate); int maxLength = 15; qrMms.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 300; qrText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrMms.getText().toString()+":"+qrText.getText().toString(); Intent i = new Intent(MmsEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MmsEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MmsEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mms_enter); final EditText qrMms=(EditText) findViewById(R.id.editTel); final EditText qrText=(EditText) findViewById(R.id.editText1); Button generate=(Button) findViewById(R.id.generate); int maxLength = 15; qrMms.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 300; qrText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrMms.getText().toString()+":"+qrText.getText().toString(); Intent i = new Intent(MmsEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.MMS);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/GeoLocationEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class GeoLocationEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geo_location_enter); final EditText qrLatitude=(EditText) findViewById(R.id.editGeo1); final EditText qrLongitude=(EditText) findViewById(R.id.editGeo2); Button generate=(Button) findViewById(R.id.generate); int maxLength = 11; qrLatitude.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 11; qrLongitude.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrLatitude.getText().toString()+","+qrLongitude.getText().toString(); Intent i = new Intent(GeoLocationEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/GeoLocationEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class GeoLocationEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geo_location_enter); final EditText qrLatitude=(EditText) findViewById(R.id.editGeo1); final EditText qrLongitude=(EditText) findViewById(R.id.editGeo2); Button generate=(Button) findViewById(R.id.generate); int maxLength = 11; qrLatitude.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 11; qrLongitude.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrLatitude.getText().toString()+","+qrLongitude.getText().toString(); Intent i = new Intent(GeoLocationEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.LOCATION);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/WifiEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class WifiEnterActivity extends AppCompatActivity { private static final String[] auth = {"WEP", "WPA"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wifi_enter); final Spinner spinner = (Spinner)findViewById(R.id.spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(WifiEnterActivity.this, android.R.layout.simple_spinner_item,auth); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); final EditText qrNetwork = (EditText) findViewById(R.id.editNetwork); final EditText qrPassword = (EditText) findViewById(R.id.editPassword); Button generate = (Button) findViewById(R.id.generate); int maxLength = 25; qrNetwork.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 20; qrPassword.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { // WIFI:T:WPA;S:mynetwork;P:mypass;; if(spinner.getSelectedItemPosition()==0) { result = "WEP;S:" + qrNetwork.getText().toString() + ";P:" + qrPassword.getText().toString() + ";;"; } else if (spinner.getSelectedItemPosition()==1) { result = "WPA;S:" + qrNetwork.getText().toString() + ";P:" + qrPassword.getText().toString() + ";;"; } Intent i = new Intent(WifiEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/WifiEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class WifiEnterActivity extends AppCompatActivity { private static final String[] auth = {"WEP", "WPA"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wifi_enter); final Spinner spinner = (Spinner)findViewById(R.id.spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(WifiEnterActivity.this, android.R.layout.simple_spinner_item,auth); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); final EditText qrNetwork = (EditText) findViewById(R.id.editNetwork); final EditText qrPassword = (EditText) findViewById(R.id.editPassword); Button generate = (Button) findViewById(R.id.generate); int maxLength = 25; qrNetwork.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 20; qrPassword.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { // WIFI:T:WPA;S:mynetwork;P:mypass;; if(spinner.getSelectedItemPosition()==0) { result = "WEP;S:" + qrNetwork.getText().toString() + ";P:" + qrPassword.getText().toString() + ";;"; } else if (spinner.getSelectedItemPosition()==1) { result = "WPA;S:" + qrNetwork.getText().toString() + ";P:" + qrPassword.getText().toString() + ";;"; } Intent i = new Intent(WifiEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.WIFI);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/UrlEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class UrlEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_url_enter); final EditText qrResult=(EditText) findViewById(R.id.gnResult); Button generate=(Button) findViewById(R.id.generate); int maxLength = 150; qrResult.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(UrlEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(UrlEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/UrlEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class UrlEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_url_enter); final EditText qrResult=(EditText) findViewById(R.id.gnResult); Button generate=(Button) findViewById(R.id.generate); int maxLength = 150; qrResult.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(UrlEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(UrlEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.WEB_URL);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/resultfragments/ResultFragment.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/ResultViewModel.java // public class ResultViewModel extends AndroidViewModel { // // private BarcodeResult currentBarcodeResult = null; // // public HistoryItem currentHistoryItem = null; // public ParsedResult mParsedResult = null; // public Bitmap mCodeImage = null; // public boolean mSavedToHistory = false; // // private final SharedPreferences mPreferences; // // public ResultViewModel(@NonNull Application application) { // super(application); // // mPreferences = PreferenceManager.getDefaultSharedPreferences(application); // } // // /** // * After this function is called the the following values will not be null: // * <ul> // * <li>currentHistoryItem</li> // * <li>mCodeImage</li> // * <li>mSavedToHistory</li> // * <li>mParsedResult</li> // * </ul> // * If the state can not be created the activity will call {@link AppCompatActivity#finish()} // * This method will also update the {@link HistoryItem} in the database with a recreation of the QR Code if the image is missing. // */ // public void initFromHistoryItem(HistoryItem historyItem) { // currentHistoryItem = historyItem; // mParsedResult = ResultParser.parseResult(currentHistoryItem.getResult()); // mCodeImage = currentHistoryItem.getImage(); // if(mCodeImage == null) { // mCodeImage = Utils.generateCode(currentHistoryItem.getText(), BarcodeFormat.QR_CODE, null, null); // currentHistoryItem.setImage(mCodeImage); // currentHistoryItem.setFormat(BarcodeFormat.QR_CODE); // updateHistoryItem(currentHistoryItem); // } // mSavedToHistory = true; // } // // public void initFromScan(BarcodeResult barcodeResult) { // currentBarcodeResult = barcodeResult; // mParsedResult = ResultParser.parseResult(currentBarcodeResult.getResult()); // mCodeImage = currentBarcodeResult.getBitmapWithResultPoints(ContextCompat.getColor(getApplication(), R.color.colorAccent)); // // createHistoryItem(); // if(mPreferences.getBoolean("bool_history",true)){ // this.saveHistoryItem(currentHistoryItem); // } // } // // public void saveHistoryItem(HistoryItem item) { // AppRepository.getInstance(getApplication()).insertHistoryEntry(item); // mSavedToHistory = true; // } // // // public void updateHistoryItem(HistoryItem item) { // AppRepository.getInstance(getApplication()).updateHistoryEntry(item); // } // // private void createHistoryItem() { // currentHistoryItem = new HistoryItem(); // // Bitmap image; // boolean prefSaveRealImage = mPreferences.getBoolean(PREF_SAVE_REAL_IMAGE_TO_HISTORY, false); // if(prefSaveRealImage) { // float height; // float width; // if(mCodeImage.getWidth() == 0 || mCodeImage.getWidth() == 0) { // height = 200f; // width = 200f; // } else if(mCodeImage.getWidth() > mCodeImage.getHeight()) { // height = (float)mCodeImage.getHeight() / (float)mCodeImage.getWidth() * 200f; // width = 200f; // } else { // width = (float)mCodeImage.getWidth() / (float)mCodeImage.getHeight() * 200f; // height = 200f; // } // image = Bitmap.createScaledBitmap(mCodeImage, (int)width, (int)height, false); // } else { // image = Utils.generateCode(currentBarcodeResult.getText(), currentBarcodeResult.getBarcodeFormat(), null, currentBarcodeResult.getResult().getResultMetadata()); // } // currentHistoryItem.setImage(image); // // currentHistoryItem.setFormat(currentBarcodeResult.getResult().getBarcodeFormat()); // currentHistoryItem.setNumBits(currentBarcodeResult.getResult().getNumBits()); // currentHistoryItem.setRawBytes(currentBarcodeResult.getResult().getRawBytes()); // currentHistoryItem.setResultPoints(currentBarcodeResult.getResult().getResultPoints()); // currentHistoryItem.setText(currentBarcodeResult.getResult().getText()); // currentHistoryItem.setTimestamp(currentBarcodeResult.getResult().getTimestamp()); // } // // }
import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProviders; import com.google.zxing.client.result.ParsedResult; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel.ResultViewModel;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments; public abstract class ResultFragment extends Fragment { protected ParsedResult parsedResult;
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/viewmodel/ResultViewModel.java // public class ResultViewModel extends AndroidViewModel { // // private BarcodeResult currentBarcodeResult = null; // // public HistoryItem currentHistoryItem = null; // public ParsedResult mParsedResult = null; // public Bitmap mCodeImage = null; // public boolean mSavedToHistory = false; // // private final SharedPreferences mPreferences; // // public ResultViewModel(@NonNull Application application) { // super(application); // // mPreferences = PreferenceManager.getDefaultSharedPreferences(application); // } // // /** // * After this function is called the the following values will not be null: // * <ul> // * <li>currentHistoryItem</li> // * <li>mCodeImage</li> // * <li>mSavedToHistory</li> // * <li>mParsedResult</li> // * </ul> // * If the state can not be created the activity will call {@link AppCompatActivity#finish()} // * This method will also update the {@link HistoryItem} in the database with a recreation of the QR Code if the image is missing. // */ // public void initFromHistoryItem(HistoryItem historyItem) { // currentHistoryItem = historyItem; // mParsedResult = ResultParser.parseResult(currentHistoryItem.getResult()); // mCodeImage = currentHistoryItem.getImage(); // if(mCodeImage == null) { // mCodeImage = Utils.generateCode(currentHistoryItem.getText(), BarcodeFormat.QR_CODE, null, null); // currentHistoryItem.setImage(mCodeImage); // currentHistoryItem.setFormat(BarcodeFormat.QR_CODE); // updateHistoryItem(currentHistoryItem); // } // mSavedToHistory = true; // } // // public void initFromScan(BarcodeResult barcodeResult) { // currentBarcodeResult = barcodeResult; // mParsedResult = ResultParser.parseResult(currentBarcodeResult.getResult()); // mCodeImage = currentBarcodeResult.getBitmapWithResultPoints(ContextCompat.getColor(getApplication(), R.color.colorAccent)); // // createHistoryItem(); // if(mPreferences.getBoolean("bool_history",true)){ // this.saveHistoryItem(currentHistoryItem); // } // } // // public void saveHistoryItem(HistoryItem item) { // AppRepository.getInstance(getApplication()).insertHistoryEntry(item); // mSavedToHistory = true; // } // // // public void updateHistoryItem(HistoryItem item) { // AppRepository.getInstance(getApplication()).updateHistoryEntry(item); // } // // private void createHistoryItem() { // currentHistoryItem = new HistoryItem(); // // Bitmap image; // boolean prefSaveRealImage = mPreferences.getBoolean(PREF_SAVE_REAL_IMAGE_TO_HISTORY, false); // if(prefSaveRealImage) { // float height; // float width; // if(mCodeImage.getWidth() == 0 || mCodeImage.getWidth() == 0) { // height = 200f; // width = 200f; // } else if(mCodeImage.getWidth() > mCodeImage.getHeight()) { // height = (float)mCodeImage.getHeight() / (float)mCodeImage.getWidth() * 200f; // width = 200f; // } else { // width = (float)mCodeImage.getWidth() / (float)mCodeImage.getHeight() * 200f; // height = 200f; // } // image = Bitmap.createScaledBitmap(mCodeImage, (int)width, (int)height, false); // } else { // image = Utils.generateCode(currentBarcodeResult.getText(), currentBarcodeResult.getBarcodeFormat(), null, currentBarcodeResult.getResult().getResultMetadata()); // } // currentHistoryItem.setImage(image); // // currentHistoryItem.setFormat(currentBarcodeResult.getResult().getBarcodeFormat()); // currentHistoryItem.setNumBits(currentBarcodeResult.getResult().getNumBits()); // currentHistoryItem.setRawBytes(currentBarcodeResult.getResult().getRawBytes()); // currentHistoryItem.setResultPoints(currentBarcodeResult.getResult().getResultPoints()); // currentHistoryItem.setText(currentBarcodeResult.getResult().getText()); // currentHistoryItem.setTimestamp(currentBarcodeResult.getResult().getTimestamp()); // } // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/resultfragments/ResultFragment.java import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProviders; import com.google.zxing.client.result.ParsedResult; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.ui.viewmodel.ResultViewModel; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.resultfragments; public abstract class ResultFragment extends Fragment { protected ParsedResult parsedResult;
protected ResultViewModel viewModel;
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MeCardEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
qrName.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 75; qrPhone.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); int maxLength3 = 75; qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { //MECARD:N:Owen,Sean;ADR:76 9th Avenue, 4th Floor, New York, NY 10011;TEL:12125551212;EMAIL:srowen@example.com;; result = qrName.getText().toString()+";ADR:"+qrStreet.getText().toString()+","+qrCity.getText().toString()+","+qrPostal.getText().toString()+";TEL:"+qrPhone.getText().toString()+";EMAIL:"+qrMail.getText().toString()+";;"; Intent i = new Intent(MeCardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MeCardEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; qrName.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 75; qrPhone.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); int maxLength3 = 75; qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { //MECARD:N:Owen,Sean;ADR:76 9th Avenue, 4th Floor, New York, NY 10011;TEL:12125551212;EMAIL:srowen@example.com;; result = qrName.getText().toString()+";ADR:"+qrStreet.getText().toString()+","+qrCity.getText().toString()+","+qrPostal.getText().toString()+";TEL:"+qrPhone.getText().toString()+";EMAIL:"+qrMail.getText().toString()+";;"; Intent i = new Intent(MeCardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.Me_Card);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MarketEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MarketEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_market_enter); final EditText qrMarket = (EditText) findViewById(R.id.editText); Button generate = (Button) findViewById(R.id.generate); int maxLength = 75; qrMarket.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrMarket.getText().toString(); if (result.isEmpty()) { Toast.makeText(MarketEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(MarketEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MarketEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MarketEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_market_enter); final EditText qrMarket = (EditText) findViewById(R.id.editText); Button generate = (Button) findViewById(R.id.generate); int maxLength = 75; qrMarket.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrMarket.getText().toString(); if (result.isEmpty()) { Toast.makeText(MarketEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(MarketEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.Market);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/SmsEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class SmsEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sms_enter); final EditText qrSms=(EditText) findViewById(R.id.editTel); final EditText qrText=(EditText) findViewById(R.id.editText1); Button generate=(Button) findViewById(R.id.generate); int maxLength = 15; qrSms.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 300; qrText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrSms.getText().toString()+":"+qrText.getText().toString(); Intent i = new Intent(SmsEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/SmsEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class SmsEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sms_enter); final EditText qrSms=(EditText) findViewById(R.id.editTel); final EditText qrText=(EditText) findViewById(R.id.editText1); Button generate=(Button) findViewById(R.id.generate); int maxLength = 15; qrSms.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); int maxLength2 = 300; qrText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength2)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrSms.getText().toString()+":"+qrText.getText().toString(); Intent i = new Intent(SmsEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.SMS);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/BizCardEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
int maxLength3 = 75; qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); int maxLength7 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength7)}); int maxLength8 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength8)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { //BIZCARD:N:Sean;X:Owen;T:Software Engineer;C:Google;A:76 9th Avenue, New York, NY 10011;B:+12125551212;E:srowen@google.com;; result = qrName.getText().toString()+";T:"+qrTitle.getText().toString()+";C:"+qrCompany.getText().toString()+";A:"+qrStreet.getText().toString()+","+qrCity.getText().toString()+","+qrPostal.getText().toString()+";B:"+qrPhone.getText().toString()+";E:"+qrMail.getText().toString()+";;"; Intent i = new Intent(BizCardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/BizCardEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; int maxLength3 = 75; qrMail.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength3)}); int maxLength4 = 75; qrStreet.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength4)}); int maxLength5 = 75; qrCity.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength5)}); int maxLength6 = 75; qrPostal.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength6)}); int maxLength7 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength7)}); int maxLength8 = 75; qrTitle.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength8)}); Button generate=(Button) findViewById(R.id.generate); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { //BIZCARD:N:Sean;X:Owen;T:Software Engineer;C:Google;A:76 9th Avenue, New York, NY 10011;B:+12125551212;E:srowen@google.com;; result = qrName.getText().toString()+";T:"+qrTitle.getText().toString()+";C:"+qrCompany.getText().toString()+";A:"+qrStreet.getText().toString()+","+qrCity.getText().toString()+","+qrPostal.getText().toString()+";B:"+qrPhone.getText().toString()+";E:"+qrMail.getText().toString()+";;"; Intent i = new Intent(BizCardEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.Biz_Card);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/TextEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class TextEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text_enter); final EditText qrText = (EditText) findViewById(R.id.editText); Button generate = (Button) findViewById(R.id.generate); int maxLength = 1817; qrText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrText.getText().toString(); if (result.isEmpty()) { Toast.makeText(TextEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(TextEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/TextEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class TextEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text_enter); final EditText qrText = (EditText) findViewById(R.id.editText); Button generate = (Button) findViewById(R.id.generate); int maxLength = 1817; qrText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrText.getText().toString(); if (result.isEmpty()) { Toast.makeText(TextEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(TextEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.TEXT);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/TutorialActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/PrefManager.java // public class PrefManager { // public static final String PREF_SAVE_REAL_IMAGE_TO_HISTORY = "pref_save_real_image_to_history"; // // private final SharedPreferences pref; // private final SharedPreferences.Editor editor; // // // shared pref mode // private final int PRIVATE_MODE = 0; // // // Shared preferences file name // private static final String PREF_NAME = "privacy_friendly_apps"; // // private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; // // public PrefManager(Context context) { // pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); // editor = pref.edit(); // } // // public void setFirstTimeLaunch(boolean isFirstTime) { // editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); // editor.commit(); // } // // public boolean isFirstTimeLaunch() { // return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); // } // // }
import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.PrefManager;
/* This file is part of Privacy Friendly App Example. Privacy Friendly App Example 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 any later version. Privacy Friendly App Example 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 Privacy Friendly App Example. If not, see <http://www.gnu.org/licenses/>. */ package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * Class structure taken from tutorial at http://www.androidhive.info/2016/05/android-build-intro-slider-app/ * * @author Karola Marky * @version 20161214 */ public class TutorialActivity extends AppCompatActivity { private ViewPager viewPager; private MyViewPagerAdapter myViewPagerAdapter; private LinearLayout dotsLayout; private TextView[] dots; private int[] layouts; private Button btnSkip, btnNext;
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/PrefManager.java // public class PrefManager { // public static final String PREF_SAVE_REAL_IMAGE_TO_HISTORY = "pref_save_real_image_to_history"; // // private final SharedPreferences pref; // private final SharedPreferences.Editor editor; // // // shared pref mode // private final int PRIVATE_MODE = 0; // // // Shared preferences file name // private static final String PREF_NAME = "privacy_friendly_apps"; // // private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; // // public PrefManager(Context context) { // pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); // editor = pref.edit(); // } // // public void setFirstTimeLaunch(boolean isFirstTime) { // editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); // editor.commit(); // } // // public boolean isFirstTimeLaunch() { // return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); // } // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/TutorialActivity.java import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.PrefManager; /* This file is part of Privacy Friendly App Example. Privacy Friendly App Example 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 any later version. Privacy Friendly App Example 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 Privacy Friendly App Example. If not, see <http://www.gnu.org/licenses/>. */ package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * Class structure taken from tutorial at http://www.androidhive.info/2016/05/android-build-intro-slider-app/ * * @author Karola Marky * @version 20161214 */ public class TutorialActivity extends AppCompatActivity { private ViewPager viewPager; private MyViewPagerAdapter myViewPagerAdapter; private LinearLayout dotsLayout; private TextView[] dots; private int[] layouts; private Button btnSkip, btnNext;
private PrefManager prefManager;
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MailEnterActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // }
import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MailEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mail_enter); final EditText qrResult = (EditText) findViewById(R.id.editMail); Button generate = (Button) findViewById(R.id.generate); int maxLength = 50; qrResult.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(MailEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(MailEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/generator/Contents.java // public final class Contents { // private Contents() { // } // // public static final class Type { // // public static final String UNDEFINED = "UNDEFINED"; // // // Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string // // must include "http://" or "https://". // public static final String TEXT = "TEXT_TYPE"; // // // An email type. Use Intent.putExtra(DATA, string) where string is the email address. // public static final String EMAIL = "EMAIL_TYPE"; // // // Use Intent.putExtra(DATA, string) where string is the phone number to call. // public static final String PHONE = "PHONE_TYPE"; // // // An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS. // public static final String SMS = "SMS_TYPE"; // public static final String MMS = "MMS_TYPE"; // public static final String WEB_URL = "URL_TYPE"; // public static final String WIFI = "WIFI_TYPE"; // public static final String Me_Card = "MeCard_TYPE"; // public static final String V_Card = "VCard_TYPE"; // public static final String Market = "Market_TYPE"; // public static final String Biz_Card = "BizCard_TYPE"; // // // // // // A contact. Send a request to encode it as follows: // // <p/> // // import android.provider.Contacts; // // <p/> // // Intent intent = new Intent(Intents.Encode.ACTION); intent.putExtra(Intents.Encode.TYPE, // // CONTACT); Bundle bundle = new Bundle(); bundle.putString(Contacts.Intents.Insert.NAME, // // "Jenny"); bundle.putString(Contacts.Intents.Insert.PHONE, "8675309"); // // bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com"); // // bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102"); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String CONTACT = "CONTACT_TYPE"; // // // // A geographic location. Use as follows: // // Bundle bundle = new Bundle(); // // bundle.putFloat("LAT", latitude); // // bundle.putFloat("LONG", longitude); // // intent.putExtra(Intents.Encode.DATA, bundle); // // public static final String LOCATION = "LOCATION_TYPE"; // // private Type() { // } // } // // public static final String URL_KEY = "URL_KEY"; // // public static final String NOTE_KEY = "NOTE_KEY"; // // // When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple // // phone numbers and addresses. // public static final String[] PHONE_KEYS = { // ContactsContract.Intents.Insert.PHONE, ContactsContract.Intents.Insert.SECONDARY_PHONE, // ContactsContract.Intents.Insert.TERTIARY_PHONE // }; // // public static final String[] PHONE_TYPE_KEYS = { // ContactsContract.Intents.Insert.PHONE_TYPE, // ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, // ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE // }; // // public static final String[] EMAIL_KEYS = { // ContactsContract.Intents.Insert.EMAIL, ContactsContract.Intents.Insert.SECONDARY_EMAIL, // ContactsContract.Intents.Insert.TERTIARY_EMAIL // }; // // public static final String[] EMAIL_TYPE_KEYS = { // ContactsContract.Intents.Insert.EMAIL_TYPE, // ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, // ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE // }; // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/MailEnterActivity.java import android.content.Intent; import android.os.Bundle; import android.text.InputFilter; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.R; import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; public class MailEnterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mail_enter); final EditText qrResult = (EditText) findViewById(R.id.editMail); Button generate = (Button) findViewById(R.id.generate); int maxLength = 50; qrResult.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); generate.setOnClickListener(new View.OnClickListener() { String result; @Override public void onClick(View v) { result = qrResult.getText().toString(); if (result.isEmpty()) { Toast.makeText(MailEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); return; } Intent i = new Intent(MailEnterActivity.this, QrGeneratorDisplayActivity.class); i.putExtra("gn", result);
i.putExtra("type", Contents.Type.EMAIL);
SecUSo/privacy-friendly-qr-scanner
app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/SplashActivity.java
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/PrefManager.java // public class PrefManager { // public static final String PREF_SAVE_REAL_IMAGE_TO_HISTORY = "pref_save_real_image_to_history"; // // private final SharedPreferences pref; // private final SharedPreferences.Editor editor; // // // shared pref mode // private final int PRIVATE_MODE = 0; // // // Shared preferences file name // private static final String PREF_NAME = "privacy_friendly_apps"; // // private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; // // public PrefManager(Context context) { // pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); // editor = pref.edit(); // } // // public void setFirstTimeLaunch(boolean isFirstTime) { // editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); // editor.commit(); // } // // public boolean isFirstTimeLaunch() { // return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); // } // // }
import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.PrefManager;
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * @author Karola Marky * @version 20161022 */ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/helpers/PrefManager.java // public class PrefManager { // public static final String PREF_SAVE_REAL_IMAGE_TO_HISTORY = "pref_save_real_image_to_history"; // // private final SharedPreferences pref; // private final SharedPreferences.Editor editor; // // // shared pref mode // private final int PRIVATE_MODE = 0; // // // Shared preferences file name // private static final String PREF_NAME = "privacy_friendly_apps"; // // private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; // // public PrefManager(Context context) { // pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); // editor = pref.edit(); // } // // public void setFirstTimeLaunch(boolean isFirstTime) { // editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); // editor.commit(); // } // // public boolean isFirstTimeLaunch() { // return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); // } // // } // Path: app/src/main/java/com/secuso/privacyfriendlycodescanner/qrscanner/ui/activities/SplashActivity.java import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.secuso.privacyfriendlycodescanner.qrscanner.helpers.PrefManager; package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities; /** * @author Karola Marky * @version 20161022 */ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
PrefManager firstStartPref = new PrefManager(this);
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/constraint/ActivityConstraint.java
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // }
import org.biopax.paxtools.model.level3.PhysicalEntity; import org.biopax.paxtools.pattern.Match;
package org.biopax.paxtools.pattern.constraint; /** * Checks if the PhysicalEntity controls anything. * * @author Ozgun Babur */ public class ActivityConstraint extends ConstraintAdapter { /** * Desired activity. */ boolean active; /** * Constructor with the desired activity. * @param active desires activity */ public ActivityConstraint(boolean active) { super(1); this.active = active; } /** * Checks if the PhysicalEntity controls anything. * @param match current match to validate * @param ind mapped index * @return true if it controls anything */ @Override
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // } // Path: src/org/biopax/paxtools/pattern/constraint/ActivityConstraint.java import org.biopax.paxtools.model.level3.PhysicalEntity; import org.biopax.paxtools.pattern.Match; package org.biopax.paxtools.pattern.constraint; /** * Checks if the PhysicalEntity controls anything. * * @author Ozgun Babur */ public class ActivityConstraint extends ConstraintAdapter { /** * Desired activity. */ boolean active; /** * Constructor with the desired activity. * @param active desires activity */ public ActivityConstraint(boolean active) { super(1); this.active = active; } /** * Checks if the PhysicalEntity controls anything. * @param match current match to validate * @param ind mapped index * @return true if it controls anything */ @Override
public boolean satisfies(Match match, int... ind)
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/Venn_Overview.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames;
import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames;
package edu.uic.ncdm.venn; /* * EVL temperature visualization. * * Copyright 2011 by Tuan Dang. * * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ public class Venn_Overview{ int count = 0; public String[][] data; public double[] areas; public double[][] centers; public double[] diameters; public String[] labels; private int size; private double mins, maxs; public PApplet parent; public int brushing=-1; public float bx=0; public float by=0; public float br=0; public ArrayList<String>[] pair2; public boolean[] deactive; public static int numMinerContainData=-1; public static int[] minerGlobalIDof; public static float currentSize; public Venn_Overview(PApplet pa) { parent = pa; centers = new double[0][0]; } public void initialize() { // Select the list of miner numMinerContainData = 0;
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames; // Path: src/edu/uic/ncdm/venn/Venn_Overview.java import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames; package edu.uic.ncdm.venn; /* * EVL temperature visualization. * * Copyright 2011 by Tuan Dang. * * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ public class Venn_Overview{ int count = 0; public String[][] data; public double[] areas; public double[][] centers; public double[] diameters; public String[] labels; private int size; private double mins, maxs; public PApplet parent; public int brushing=-1; public float bx=0; public float by=0; public float br=0; public ArrayList<String>[] pair2; public boolean[] deactive; public static int numMinerContainData=-1; public static int[] minerGlobalIDof; public static float currentSize; public Venn_Overview(PApplet pa) { parent = pa; centers = new double[0][0]; } public void initialize() { // Select the list of miner numMinerContainData = 0;
for (int i=0;i<minerList.size();i++){
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/Venn_Overview.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames;
import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames;
public float bx=0; public float by=0; public float br=0; public ArrayList<String>[] pair2; public boolean[] deactive; public static int numMinerContainData=-1; public static int[] minerGlobalIDof; public static float currentSize; public Venn_Overview(PApplet pa) { parent = pa; centers = new double[0][0]; } public void initialize() { // Select the list of miner numMinerContainData = 0; for (int i=0;i<minerList.size();i++){ if (main.PathwayMatrix_1_1.pairs[i].size()>0) numMinerContainData++; } if (numMinerContainData==0) return; //System.out.println(minerList.size()+" numMiner="+numMiner); pair2 = new ArrayList[numMinerContainData]; minerGlobalIDof = new int[numMinerContainData];
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames; // Path: src/edu/uic/ncdm/venn/Venn_Overview.java import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames; public float bx=0; public float by=0; public float br=0; public ArrayList<String>[] pair2; public boolean[] deactive; public static int numMinerContainData=-1; public static int[] minerGlobalIDof; public static float currentSize; public Venn_Overview(PApplet pa) { parent = pa; centers = new double[0][0]; } public void initialize() { // Select the list of miner numMinerContainData = 0; for (int i=0;i<minerList.size();i++){ if (main.PathwayMatrix_1_1.pairs[i].size()>0) numMinerContainData++; } if (numMinerContainData==0) return; //System.out.println(minerList.size()+" numMiner="+numMiner); pair2 = new ArrayList[numMinerContainData]; minerGlobalIDof = new int[numMinerContainData];
minerNames = new String[numMinerContainData];
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/Venn_Overview.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames;
import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames;
} if (countRelations>0){ aData.add(minerNames[i]+"&"+minerNames[j]); aAreas.add(countRelations); } } } data = new String[numMinerContainData+aData.size()][1]; areas = new double[numMinerContainData+aData.size()]; for (int i =0; i< numMinerContainData; i++){ data[i][0] = minerNames[i]; areas[i]=pair2[i].size(); } for (int i =0; i< aData.size(); i++){ data[i+numMinerContainData][0] = aData.get(i); areas[i+numMinerContainData] = aAreas.get(i); } /* System.out.println(); System.out.println("****** PRINT Venn Overview numMiner="+numMiner); for (int i =0; i< areas.length; i++){ System.out.println("\t"+data[i][0]+" "+areas[i]); } System.out.println(); */
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static List<Miner> minerList = new ArrayList<Miner>(); // // Path: application.windows/source/main/PathwayMatrix_1_1.java // public static String[] minerNames; // Path: src/edu/uic/ncdm/venn/Venn_Overview.java import processing.core.*; import java.awt.Color; import java.util.ArrayList; import edu.uic.ncdm.venn.data.VennData; import static main.PathwayMatrix_1_1.minerList; import static main.PathwayMatrix_1_1.minerNames; } if (countRelations>0){ aData.add(minerNames[i]+"&"+minerNames[j]); aAreas.add(countRelations); } } } data = new String[numMinerContainData+aData.size()][1]; areas = new double[numMinerContainData+aData.size()]; for (int i =0; i< numMinerContainData; i++){ data[i][0] = minerNames[i]; areas[i]=pair2[i].size(); } for (int i =0; i< aData.size(); i++){ data[i+numMinerContainData][0] = aData.get(i); areas[i+numMinerContainData] = aAreas.get(i); } /* System.out.println(); System.out.println("****** PRINT Venn Overview numMiner="+numMiner); for (int i =0; i< areas.length; i++){ System.out.println("\t"+data[i][0]+" "+areas[i]); } System.out.println(); */
VennData dv = new VennData(data, areas);
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/constraint/Equality.java
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // }
import org.biopax.paxtools.pattern.Match;
package org.biopax.paxtools.pattern.constraint; /** * Checks identity of two elements. * Size = 2. * Checks if e1 == e2. * * @author Ozgun Babur */ public class Equality extends ConstraintAdapter { /** * Desired output. */ private boolean equals; /** * Constructor with the desired output. * @param equals the desired output */ public Equality(boolean equals) { super(2); this.equals = equals; } /** * Checks if the two elements are identical or not identical as desired. * @param match current pattern match * @param ind mapped indices * @return true if identity checks equals the desired value */ @Override
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // } // Path: src/org/biopax/paxtools/pattern/constraint/Equality.java import org.biopax.paxtools.pattern.Match; package org.biopax.paxtools.pattern.constraint; /** * Checks identity of two elements. * Size = 2. * Checks if e1 == e2. * * @author Ozgun Babur */ public class Equality extends ConstraintAdapter { /** * Desired output. */ private boolean equals; /** * Constructor with the desired output. * @param equals the desired output */ public Equality(boolean equals) { super(2); this.equals = equals; } /** * Checks if the two elements are identical or not identical as desired. * @param match current pattern match * @param ind mapped indices * @return true if identity checks equals the desired value */ @Override
public boolean satisfies(Match match, int... ind)
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/Venn2.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: src/edu/uic/ncdm/venn/display/VennFrame.java // public class VennFrame extends JFrame { // private int HEIGHT = 700; // private int WIDTH = 700; // // public VennFrame(VennDiagram vd) { // Container con = this.getContentPane(); // con.setBackground(Color.white); // VennCanvas vc = new VennCanvas(vd); // con.add(vc); // setTitle("Venn/Euler Diagram"); // setBounds(0, 0, WIDTH, HEIGHT); // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // setResizable(false); // setVisible(true); // } // }
import edu.uic.ncdm.venn.display.VennFrame; import edu.uic.ncdm.venn.data.VennData;
/* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class Venn2 { private Venn2() { } public static void main(String[] argv) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { read(); } }); } private static void read() {
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: src/edu/uic/ncdm/venn/display/VennFrame.java // public class VennFrame extends JFrame { // private int HEIGHT = 700; // private int WIDTH = 700; // // public VennFrame(VennDiagram vd) { // Container con = this.getContentPane(); // con.setBackground(Color.white); // VennCanvas vc = new VennCanvas(vd); // con.add(vc); // setTitle("Venn/Euler Diagram"); // setBounds(0, 0, WIDTH, HEIGHT); // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // setResizable(false); // setVisible(true); // } // } // Path: src/edu/uic/ncdm/venn/Venn2.java import edu.uic.ncdm.venn.display.VennFrame; import edu.uic.ncdm.venn.data.VennData; /* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class Venn2 { private Venn2() { } public static void main(String[] argv) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { read(); } }); } private static void read() {
VennData dv = getData();
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/Venn2.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: src/edu/uic/ncdm/venn/display/VennFrame.java // public class VennFrame extends JFrame { // private int HEIGHT = 700; // private int WIDTH = 700; // // public VennFrame(VennDiagram vd) { // Container con = this.getContentPane(); // con.setBackground(Color.white); // VennCanvas vc = new VennCanvas(vd); // con.add(vc); // setTitle("Venn/Euler Diagram"); // setBounds(0, 0, WIDTH, HEIGHT); // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // setResizable(false); // setVisible(true); // } // }
import edu.uic.ncdm.venn.display.VennFrame; import edu.uic.ncdm.venn.data.VennData;
/* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class Venn2 { private Venn2() { } public static void main(String[] argv) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { read(); } }); } private static void read() { VennData dv = getData(); VennAnalytic va = new VennAnalytic(); VennDiagram vd = va.compute(dv);
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // // Path: src/edu/uic/ncdm/venn/display/VennFrame.java // public class VennFrame extends JFrame { // private int HEIGHT = 700; // private int WIDTH = 700; // // public VennFrame(VennDiagram vd) { // Container con = this.getContentPane(); // con.setBackground(Color.white); // VennCanvas vc = new VennCanvas(vd); // con.add(vc); // setTitle("Venn/Euler Diagram"); // setBounds(0, 0, WIDTH, HEIGHT); // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // setResizable(false); // setVisible(true); // } // } // Path: src/edu/uic/ncdm/venn/Venn2.java import edu.uic.ncdm.venn.display.VennFrame; import edu.uic.ncdm.venn.data.VennData; /* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class Venn2 { private Venn2() { } public static void main(String[] argv) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { read(); } }); } private static void read() { VennData dv = getData(); VennAnalytic va = new VennAnalytic(); VennDiagram vd = va.compute(dv);
new VennFrame(vd);
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/display/VennCanvas.java
// Path: src/edu/uic/ncdm/venn/VennDiagram.java // public class VennDiagram { // public double[][] centers; // public double[] diameters; // public double[] areas; // public double[] residuals; // public double[] colors; // public String[] circleLabels; // public String[] residualLabels; // public double stress; // public double stress01; // public double stress05; // // public VennDiagram(double[][] centers, double[] diameters, double[] areas, double[] residuals, // String[] circleLabels, String[] residualLabels, double[] colors, // double stress, double stress01, double stress05) { // this.centers = centers; // this.diameters = diameters; // this.areas = areas; // this.residuals = residuals; // this.colors = colors; // this.circleLabels = circleLabels; // this.residualLabels = residualLabels; // this.stress = stress; // this.stress01 = stress01; // this.stress05 = stress05; // } // }
import edu.uic.ncdm.venn.VennDiagram; import javax.swing.*; import java.awt.*; import java.awt.font.FontRenderContext; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage;
/* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn.display; public class VennCanvas extends JPanel { private BufferedImage bi; public double[][] centers; public double[] diameters; public double[] colors; public String[] labels; private int size; private double mins, maxs; private FontRenderContext frc;
// Path: src/edu/uic/ncdm/venn/VennDiagram.java // public class VennDiagram { // public double[][] centers; // public double[] diameters; // public double[] areas; // public double[] residuals; // public double[] colors; // public String[] circleLabels; // public String[] residualLabels; // public double stress; // public double stress01; // public double stress05; // // public VennDiagram(double[][] centers, double[] diameters, double[] areas, double[] residuals, // String[] circleLabels, String[] residualLabels, double[] colors, // double stress, double stress01, double stress05) { // this.centers = centers; // this.diameters = diameters; // this.areas = areas; // this.residuals = residuals; // this.colors = colors; // this.circleLabels = circleLabels; // this.residualLabels = residualLabels; // this.stress = stress; // this.stress01 = stress01; // this.stress05 = stress05; // } // } // Path: src/edu/uic/ncdm/venn/display/VennCanvas.java import edu.uic.ncdm.venn.VennDiagram; import javax.swing.*; import java.awt.*; import java.awt.font.FontRenderContext; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; /* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn.display; public class VennCanvas extends JPanel { private BufferedImage bi; public double[][] centers; public double[] diameters; public double[] colors; public String[] labels; private int size; private double mins, maxs; private FontRenderContext frc;
public VennCanvas(VennDiagram venn) {
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/display/VennFrame.java
// Path: src/edu/uic/ncdm/venn/VennDiagram.java // public class VennDiagram { // public double[][] centers; // public double[] diameters; // public double[] areas; // public double[] residuals; // public double[] colors; // public String[] circleLabels; // public String[] residualLabels; // public double stress; // public double stress01; // public double stress05; // // public VennDiagram(double[][] centers, double[] diameters, double[] areas, double[] residuals, // String[] circleLabels, String[] residualLabels, double[] colors, // double stress, double stress01, double stress05) { // this.centers = centers; // this.diameters = diameters; // this.areas = areas; // this.residuals = residuals; // this.colors = colors; // this.circleLabels = circleLabels; // this.residualLabels = residualLabels; // this.stress = stress; // this.stress01 = stress01; // this.stress05 = stress05; // } // }
import edu.uic.ncdm.venn.VennDiagram; import javax.swing.*; import java.awt.*;
/* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn.display; public class VennFrame extends JFrame { private int HEIGHT = 700; private int WIDTH = 700;
// Path: src/edu/uic/ncdm/venn/VennDiagram.java // public class VennDiagram { // public double[][] centers; // public double[] diameters; // public double[] areas; // public double[] residuals; // public double[] colors; // public String[] circleLabels; // public String[] residualLabels; // public double stress; // public double stress01; // public double stress05; // // public VennDiagram(double[][] centers, double[] diameters, double[] areas, double[] residuals, // String[] circleLabels, String[] residualLabels, double[] colors, // double stress, double stress01, double stress05) { // this.centers = centers; // this.diameters = diameters; // this.areas = areas; // this.residuals = residuals; // this.colors = colors; // this.circleLabels = circleLabels; // this.residualLabels = residualLabels; // this.stress = stress; // this.stress01 = stress01; // this.stress05 = stress05; // } // } // Path: src/edu/uic/ncdm/venn/display/VennFrame.java import edu.uic.ncdm.venn.VennDiagram; import javax.swing.*; import java.awt.*; /* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn.display; public class VennFrame extends JFrame { private int HEIGHT = 700; private int WIDTH = 700;
public VennFrame(VennDiagram vd) {
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/constraint/MultiPathConstraint.java
// Path: src/org/biopax/paxtools/pattern/MappedConst.java // public class MappedConst implements Constraint // { // /** // * The constraint to map. // */ // private Constraint constr; // // /** // * Indexes of elements in the match for the constraint to check validity. // */ // private int[] inds; // // /** // * Constructor with the constraint and the index mapping. // * @param constr constraint to map // * @param inds mapped indexes // */ // public MappedConst(Constraint constr, int ... inds) // { // this.constr = constr; // this.inds = inds; // } // // /** // * Getter for the constraint. // * @return the wrapped constraint // */ // public Constraint getConstr() // { // return constr; // } // // /** // * Getter for the mapped indices. // * @return mapped indices // */ // public int[] getInds() // { // return inds; // } // // /** // * Gets the maximum index. // * @return maximum index // */ // public int getMaxInd() // { // int max = -1; // for (int ind : inds) // { // if (ind > max) max = ind; // } // return max; // } // // /** // * This methods translates the indexes of outer constraint, to this inner constraint. // * // * @param outer mapped indices for the outer constraints // * @return translated indices // */ // protected int[] translate(int[] outer) // { // int[] t = new int[inds.length]; // for (int i = 0; i < t.length; i++) // { // t[i] = outer[inds[i]]; // } // return t; // } // // /** // * Can generate only if the wrapped constraint is generative. // * @return if the wrapped constraint is generative // */ // public boolean canGenerate() // { // return constr.canGenerate(); // } // // /** // * Calls generate method of the constraint with index translation. // * @param match current pattern match // * @param outer untranslated indices // * @return generated satisfying elements // */ // @Override // public Collection<BioPAXElement> generate(Match match, int... outer) // { // return constr.generate(match, translate(outer)); // } // // /** // * Directs to satisfies method of the wrapped constraint with index translation. // * @param match current pattern match // * @param outer untranslated indices // * @return true if the constraint is satisfied // */ // public boolean satisfies(Match match, int ... outer) // { // return constr.satisfies(match, translate(outer)); // } // // /** // * Gets variable size of the wrapped constraint. // * @return variable size of the wrapped constraint // */ // @Override // public int getVariableSize() // { // return constr.getVariableSize(); // } // // }
import org.biopax.paxtools.pattern.MappedConst;
package org.biopax.paxtools.pattern.constraint; /** * Logical OR of several PathConstraints. * * @author Ozgun Babur */ public class MultiPathConstraint extends OR { /** * Constructor with specifier string of the path constraints. * @param paths constructor strings for the path constraints */ public MultiPathConstraint(String ... paths) {
// Path: src/org/biopax/paxtools/pattern/MappedConst.java // public class MappedConst implements Constraint // { // /** // * The constraint to map. // */ // private Constraint constr; // // /** // * Indexes of elements in the match for the constraint to check validity. // */ // private int[] inds; // // /** // * Constructor with the constraint and the index mapping. // * @param constr constraint to map // * @param inds mapped indexes // */ // public MappedConst(Constraint constr, int ... inds) // { // this.constr = constr; // this.inds = inds; // } // // /** // * Getter for the constraint. // * @return the wrapped constraint // */ // public Constraint getConstr() // { // return constr; // } // // /** // * Getter for the mapped indices. // * @return mapped indices // */ // public int[] getInds() // { // return inds; // } // // /** // * Gets the maximum index. // * @return maximum index // */ // public int getMaxInd() // { // int max = -1; // for (int ind : inds) // { // if (ind > max) max = ind; // } // return max; // } // // /** // * This methods translates the indexes of outer constraint, to this inner constraint. // * // * @param outer mapped indices for the outer constraints // * @return translated indices // */ // protected int[] translate(int[] outer) // { // int[] t = new int[inds.length]; // for (int i = 0; i < t.length; i++) // { // t[i] = outer[inds[i]]; // } // return t; // } // // /** // * Can generate only if the wrapped constraint is generative. // * @return if the wrapped constraint is generative // */ // public boolean canGenerate() // { // return constr.canGenerate(); // } // // /** // * Calls generate method of the constraint with index translation. // * @param match current pattern match // * @param outer untranslated indices // * @return generated satisfying elements // */ // @Override // public Collection<BioPAXElement> generate(Match match, int... outer) // { // return constr.generate(match, translate(outer)); // } // // /** // * Directs to satisfies method of the wrapped constraint with index translation. // * @param match current pattern match // * @param outer untranslated indices // * @return true if the constraint is satisfied // */ // public boolean satisfies(Match match, int ... outer) // { // return constr.satisfies(match, translate(outer)); // } // // /** // * Gets variable size of the wrapped constraint. // * @return variable size of the wrapped constraint // */ // @Override // public int getVariableSize() // { // return constr.getVariableSize(); // } // // } // Path: src/org/biopax/paxtools/pattern/constraint/MultiPathConstraint.java import org.biopax.paxtools.pattern.MappedConst; package org.biopax.paxtools.pattern.constraint; /** * Logical OR of several PathConstraints. * * @author Ozgun Babur */ public class MultiPathConstraint extends OR { /** * Constructor with specifier string of the path constraints. * @param paths constructor strings for the path constraints */ public MultiPathConstraint(String ... paths) {
con = new MappedConst[paths.length];
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/constraint/HasAnID.java
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // } // // Path: src/org/biopax/paxtools/pattern/miner/IDFetcher.java // public interface IDFetcher // { // /** // * Finds a String ID for the given element. // * @param ele element to fecth the ID from // * @return ID // */ // public String fetchID(BioPAXElement ele); // }
import org.biopax.paxtools.pattern.Match; import org.biopax.paxtools.pattern.miner.IDFetcher; import java.util.Set;
package org.biopax.paxtools.pattern.constraint; /** * Checks if the element has a valid ID. * * @author Ozgun Babur */ public class HasAnID extends ConstraintAdapter { /** * ID generator object. */
// Path: src/org/biopax/paxtools/pattern/Match.java // public class Match implements Cloneable // { // /** // * Array of variables. // */ // private BioPAXElement[] variables; // // /** // * Constructor with size. // * @param size array size // */ // public Match(int size) // { // this.variables = new BioPAXElement[size]; // } // // /** // * Getter for the element array. // * @return element array // */ // public BioPAXElement[] getVariables() // { // return variables; // } // // /** // * Gets element at the index. // * @param index index of the element to get // * @return element at the index // */ // public BioPAXElement get(int index) // { // return variables[index]; // } // // /** // * Gets element corresponding to the given label in the pattern. // * @param label label of the element in the pattern // * @param p related pattern // * @return element of the given label // * @throws IllegalArgumentException if the label not in the pattern // */ // public BioPAXElement get(String label, Pattern p) // { // return variables[p.indexOf(label)]; // } // // /** // * Gets elements corresponding to the given labels in the pattern. // * @param label labels of the element in the pattern // * @param p related pattern // * @return elements of the given label // * @throws IllegalArgumentException if one of the labels not in the pattern // */ // public List<BioPAXElement> get(String[] label, Pattern p) // { // if (label == null) return Collections.emptyList(); // // List<BioPAXElement> list = new ArrayList<BioPAXElement>(label.length); // for (String lab : label) // { // list.add(variables[p.indexOf(lab)]); // } // return list; // } // // /** // * Gets first element of the match // * @return first element // */ // public BioPAXElement getFirst() // { // return variables[0]; // } // // /** // * Gets last element of the match. // * @return last element // */ // public BioPAXElement getLast() // { // return variables[variables.length - 1]; // } // // /** // * Gets the array size. // * @return array size // */ // public int varSize() // { // return variables.length; // } // // /** // * Sets the given element to the given index. // * @param ele element to set // * @param index index to set // */ // public void set(BioPAXElement ele, int index) // { // variables[index] = ele; // } // // /** // * Checks if all given indices are assigned. // * @param ind indices to check // * @return true if none of them are null // */ // public boolean varsPresent(int ... ind) // { // for (int i : ind) // { // if (variables[i] == null) return false; // } // return true; // } // // /** // * Clones a match. // * @return clone of the match // */ // @Override // public Object clone() // { // Match m = null; // try // { // m = (Match) super.clone(); // m.variables = new BioPAXElement[variables.length]; // System.arraycopy(variables, 0, m.variables, 0, variables.length); // return m; // } // catch (CloneNotSupportedException e) // { // throw new RuntimeException("super.clone() not supported."); // } // } // // /** // * Gets name of variables. // * @return names of variables // */ // @Override // public String toString() // { // String s = ""; // // int i = 0; // for (BioPAXElement ele : variables) // { // if (ele != null) s += i + " - " + getAName(ele) + "\n"; // i++; // } // return s; // } // // /** // * Finds a name for the variable. // * @param ele element to check // * @return a name // */ // public String getAName(BioPAXElement ele) // { // String name = null; // // if (ele instanceof Named) // { // Named n = (Named) ele; // if (n.getDisplayName() != null && n.getDisplayName().length() > 0) // name = n.getDisplayName(); // else if (n.getStandardName() != null && n.getStandardName().length() > 0) // name = n.getStandardName(); // else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) // name = n.getName().iterator().next(); // } // if (name == null ) name = ele.getRDFId(); // // return name + " (" + ele.getModelInterface().getName().substring( // ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; // } // } // // Path: src/org/biopax/paxtools/pattern/miner/IDFetcher.java // public interface IDFetcher // { // /** // * Finds a String ID for the given element. // * @param ele element to fecth the ID from // * @return ID // */ // public String fetchID(BioPAXElement ele); // } // Path: src/org/biopax/paxtools/pattern/constraint/HasAnID.java import org.biopax.paxtools.pattern.Match; import org.biopax.paxtools.pattern.miner.IDFetcher; import java.util.Set; package org.biopax.paxtools.pattern.constraint; /** * Checks if the element has a valid ID. * * @author Ozgun Babur */ public class HasAnID extends ConstraintAdapter { /** * ID generator object. */
private IDFetcher idFetcher;
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/Searcher.java
// Path: src/org/biopax/paxtools/pattern/util/ProgressWatcher.java // public interface ProgressWatcher // { // /** // * Sets how many ticks are there in total. // * @param total total number of ticks // */ // public void setTotalTicks(int total); // // /** // * Ticks the progress watcher. // * @param times times to tick // */ // public void tick(int times); // }
import org.biopax.paxtools.controller.Cloner; import org.biopax.paxtools.controller.Completer; import org.biopax.paxtools.controller.SimpleEditorMap; import org.biopax.paxtools.io.BioPAXIOHandler; import org.biopax.paxtools.io.SimpleIOHandler; import org.biopax.paxtools.model.BioPAXElement; import org.biopax.paxtools.model.BioPAXLevel; import org.biopax.paxtools.model.Model; import org.biopax.paxtools.model.level3.*; import org.biopax.paxtools.model.level3.Process; import org.biopax.paxtools.pattern.util.ProgressWatcher; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.*;
{ List<Match> list = new LinkedList<Match>(); Map<BioPAXElement, List<Match>> map = search(eles, pattern); for (List<Match> matches : map.values()) { list.addAll(matches); } return list; } /** * Searches the given pattern in the given model. * @param model model to search in * @param pattern pattern to search for * @return map from starting elements to the list matching results */ public static Map<BioPAXElement, List<Match>> search(Model model, Pattern pattern) { return search(model, pattern, null); } /** * Searches the given pattern in the given model. * @param model model to search in * @param pattern pattern to search for * @param prg progress watcher to keep track of the progress * @return map from starting elements to the list matching results */ public static Map<BioPAXElement, List<Match>> search(Model model, Pattern pattern,
// Path: src/org/biopax/paxtools/pattern/util/ProgressWatcher.java // public interface ProgressWatcher // { // /** // * Sets how many ticks are there in total. // * @param total total number of ticks // */ // public void setTotalTicks(int total); // // /** // * Ticks the progress watcher. // * @param times times to tick // */ // public void tick(int times); // } // Path: src/org/biopax/paxtools/pattern/Searcher.java import org.biopax.paxtools.controller.Cloner; import org.biopax.paxtools.controller.Completer; import org.biopax.paxtools.controller.SimpleEditorMap; import org.biopax.paxtools.io.BioPAXIOHandler; import org.biopax.paxtools.io.SimpleIOHandler; import org.biopax.paxtools.model.BioPAXElement; import org.biopax.paxtools.model.BioPAXLevel; import org.biopax.paxtools.model.Model; import org.biopax.paxtools.model.level3.*; import org.biopax.paxtools.model.level3.Process; import org.biopax.paxtools.pattern.util.ProgressWatcher; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.*; { List<Match> list = new LinkedList<Match>(); Map<BioPAXElement, List<Match>> map = search(eles, pattern); for (List<Match> matches : map.values()) { list.addAll(matches); } return list; } /** * Searches the given pattern in the given model. * @param model model to search in * @param pattern pattern to search for * @return map from starting elements to the list matching results */ public static Map<BioPAXElement, List<Match>> search(Model model, Pattern pattern) { return search(model, pattern, null); } /** * Searches the given pattern in the given model. * @param model model to search in * @param pattern pattern to search for * @param prg progress watcher to keep track of the progress * @return map from starting elements to the list matching results */ public static Map<BioPAXElement, List<Match>> search(Model model, Pattern pattern,
ProgressWatcher prg)
CreativeCodingLab/PathwayMatrix
src/edu/uic/ncdm/venn/VennAnalytic.java
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // }
import java.util.HashMap; import java.util.Iterator; import java.util.Set; import edu.uic.ncdm.venn.data.VennData;
/* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class VennAnalytic { private int nRows; private int nCircles; private int nPolygons; private int nTot; private double stress; private double minStress; private double[] polyData; private double[] polyAreas; private double[] polyHats; private double[] circleData; private String[] circleLabels; private double[][] centers; private double[] diameters; private double stepsize; private int totalCount; private boolean isEqualArea; public VennAnalytic() { stepsize = .01; minStress = .000001; isEqualArea = false; }
// Path: src/edu/uic/ncdm/venn/data/VennData.java // public class VennData { // public double[] areas; // public String[][] data; // // public VennData(String[][] data, double[] areas) { // this.data = data; // this.areas = areas; // } // } // Path: src/edu/uic/ncdm/venn/VennAnalytic.java import java.util.HashMap; import java.util.Iterator; import java.util.Set; import edu.uic.ncdm.venn.data.VennData; /* * VennEuler -- A Venn and Euler Diagram program. * * Copyright 2009 by Leland Wilkinson. * * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. */ package edu.uic.ncdm.venn; public class VennAnalytic { private int nRows; private int nCircles; private int nPolygons; private int nTot; private double stress; private double minStress; private double[] polyData; private double[] polyAreas; private double[] polyHats; private double[] circleData; private String[] circleLabels; private double[][] centers; private double[] diameters; private double stepsize; private int totalCount; private boolean isEqualArea; public VennAnalytic() { stepsize = .01; minStress = .000001; isEqualArea = false; }
public VennDiagram compute(VennData vd) {
CreativeCodingLab/PathwayMatrix
src/org/biopax/paxtools/pattern/miner/CommonIDFetcher.java
// Path: src/org/biopax/paxtools/pattern/util/HGNC.java // public class HGNC // { // private static Map<String, String> sym2id; // private static Map<String, String> id2sym; // private static Map<String, String> old2new; // // public static void main(String[] args) // { // System.out.println(getSymbol("PKCA")); // } // // public static String getSymbol(String idOrSymbol) // { // if (id2sym.containsKey(idOrSymbol)) return id2sym.get(idOrSymbol); // else if (sym2id.containsKey(idOrSymbol)) return idOrSymbol; // else if (old2new.containsKey(idOrSymbol)) return old2new.get(idOrSymbol); // else if (!idOrSymbol.toUpperCase().equals(idOrSymbol)) // return getSymbol(idOrSymbol.toUpperCase()); // else return null; // } // // static // { // try // { // sym2id = new HashMap<String, String>(); // id2sym = new HashMap<String, String>(); // old2new = new HashMap<String, String>(); // BufferedReader reader = new BufferedReader(new InputStreamReader( // HGNC.class.getResourceAsStream("hgnc.txt"))); // // reader.readLine(); //skip header // for (String line = reader.readLine(); line != null; line = reader.readLine()) // { // String[] token = line.split("\t"); // String sym = token[1]; // String id = token[0]; // sym2id.put(sym, id); // id2sym.put(id, sym); // // if (token.length > 2) // { // String olds = token[2]; // for (String old : olds.split(",")) // { // old = old.trim(); // old2new.put(old, sym); // } // } // } // reader.close(); // } // catch (FileNotFoundException e) // { // e.printStackTrace(); // } // catch (IOException e) // { // e.printStackTrace(); // } // } // }
import org.biopax.paxtools.model.BioPAXElement; import org.biopax.paxtools.model.level3.SmallMoleculeReference; import org.biopax.paxtools.model.level3.XReferrable; import org.biopax.paxtools.model.level3.Xref; import org.biopax.paxtools.pattern.util.HGNC;
package org.biopax.paxtools.pattern.miner; /** * Tries to get gene symbols for genes and display names for small molecules. * * @author Ozgun Babur */ public class CommonIDFetcher implements IDFetcher { @Override public String fetchID(BioPAXElement ele) { if (ele instanceof SmallMoleculeReference) { SmallMoleculeReference smr = (SmallMoleculeReference) ele; if (smr.getDisplayName() != null) return smr.getDisplayName(); else if (!smr.getName().isEmpty()) return smr.getName().iterator().next(); else return null; } else if (ele instanceof XReferrable) { for (Xref xr : ((XReferrable) ele).getXref()) { String db = xr.getDb(); if (db != null) { db = db.toLowerCase(); if (db.startsWith("hgnc")) { String id = xr.getId(); if (id != null) {
// Path: src/org/biopax/paxtools/pattern/util/HGNC.java // public class HGNC // { // private static Map<String, String> sym2id; // private static Map<String, String> id2sym; // private static Map<String, String> old2new; // // public static void main(String[] args) // { // System.out.println(getSymbol("PKCA")); // } // // public static String getSymbol(String idOrSymbol) // { // if (id2sym.containsKey(idOrSymbol)) return id2sym.get(idOrSymbol); // else if (sym2id.containsKey(idOrSymbol)) return idOrSymbol; // else if (old2new.containsKey(idOrSymbol)) return old2new.get(idOrSymbol); // else if (!idOrSymbol.toUpperCase().equals(idOrSymbol)) // return getSymbol(idOrSymbol.toUpperCase()); // else return null; // } // // static // { // try // { // sym2id = new HashMap<String, String>(); // id2sym = new HashMap<String, String>(); // old2new = new HashMap<String, String>(); // BufferedReader reader = new BufferedReader(new InputStreamReader( // HGNC.class.getResourceAsStream("hgnc.txt"))); // // reader.readLine(); //skip header // for (String line = reader.readLine(); line != null; line = reader.readLine()) // { // String[] token = line.split("\t"); // String sym = token[1]; // String id = token[0]; // sym2id.put(sym, id); // id2sym.put(id, sym); // // if (token.length > 2) // { // String olds = token[2]; // for (String old : olds.split(",")) // { // old = old.trim(); // old2new.put(old, sym); // } // } // } // reader.close(); // } // catch (FileNotFoundException e) // { // e.printStackTrace(); // } // catch (IOException e) // { // e.printStackTrace(); // } // } // } // Path: src/org/biopax/paxtools/pattern/miner/CommonIDFetcher.java import org.biopax.paxtools.model.BioPAXElement; import org.biopax.paxtools.model.level3.SmallMoleculeReference; import org.biopax.paxtools.model.level3.XReferrable; import org.biopax.paxtools.model.level3.Xref; import org.biopax.paxtools.pattern.util.HGNC; package org.biopax.paxtools.pattern.miner; /** * Tries to get gene symbols for genes and display names for small molecules. * * @author Ozgun Babur */ public class CommonIDFetcher implements IDFetcher { @Override public String fetchID(BioPAXElement ele) { if (ele instanceof SmallMoleculeReference) { SmallMoleculeReference smr = (SmallMoleculeReference) ele; if (smr.getDisplayName() != null) return smr.getDisplayName(); else if (!smr.getName().isEmpty()) return smr.getName().iterator().next(); else return null; } else if (ele instanceof XReferrable) { for (Xref xr : ((XReferrable) ele).getXref()) { String db = xr.getDb(); if (db != null) { db = db.toLowerCase(); if (db.startsWith("hgnc")) { String id = xr.getId(); if (id != null) {
String symbol = HGNC.getSymbol(id);
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/RequestContext.java
// Path: Web/src/main/java/org/emerjoin/hi/web/internal/JSCommandSchedule.java // public class JSCommandSchedule { // // private String name; // private Map<String,Object> parameters = new HashMap<>(); // // public JSCommandSchedule(String name){ // this(name, Collections.emptyMap()); // } // // public JSCommandSchedule(String name, Map<String,Object> parameters){ // this.name = name; // this.parameters = parameters; // } // // public String getName() { // return name; // } // // public Map<String, Object> getParameters() { // return parameters; // } // }
import org.emerjoin.hi.web.internal.JSCommandSchedule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map;
package org.emerjoin.hi.web; //TODO: JavaDoc @RequestScoped public class RequestContext { public static String AJAX_HEADER_KEY = "AJAX_MVC"; @Inject private AppContext appContext; @Inject private HttpServletRequest request = null; private HttpServletResponse response = null; @Inject
// Path: Web/src/main/java/org/emerjoin/hi/web/internal/JSCommandSchedule.java // public class JSCommandSchedule { // // private String name; // private Map<String,Object> parameters = new HashMap<>(); // // public JSCommandSchedule(String name){ // this(name, Collections.emptyMap()); // } // // public JSCommandSchedule(String name, Map<String,Object> parameters){ // this.name = name; // this.parameters = parameters; // } // // public String getName() { // return name; // } // // public Map<String, Object> getParameters() { // return parameters; // } // } // Path: Web/src/main/java/org/emerjoin/hi/web/RequestContext.java import org.emerjoin.hi.web.internal.JSCommandSchedule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; package org.emerjoin.hi.web; //TODO: JavaDoc @RequestScoped public class RequestContext { public static String AJAX_HEADER_KEY = "AJAX_MVC"; @Inject private AppContext appContext; @Inject private HttpServletRequest request = null; private HttpServletResponse response = null; @Inject
private Event<JSCommandSchedule> jsCommandScheduleEvent;
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/config/xml/XMLConfigProvider.java
// Path: Web/src/main/java/org/emerjoin/hi/web/exceptions/HiException.java // public class HiException extends ServletException { // // public HiException(String m){ // // super(m); // // } // // public HiException(String m, Throwable throwable){ // // super(m,throwable); // // } // // }
import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory; import org.emerjoin.hi.web.config.*; import org.emerjoin.hi.web.exceptions.HiException; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.DotName; import org.jboss.jandex.Index; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.enterprise.context.ApplicationScoped; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.Validator; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set;
package org.emerjoin.hi.web.config.xml; /** * Created by Mario Junior. */ @ApplicationScoped public class XMLConfigProvider implements ConfigProvider { private String docsPath = null; private Logger _log = LoggerFactory.getLogger(XMLConfigProvider.class);
// Path: Web/src/main/java/org/emerjoin/hi/web/exceptions/HiException.java // public class HiException extends ServletException { // // public HiException(String m){ // // super(m); // // } // // public HiException(String m, Throwable throwable){ // // super(m,throwable); // // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/config/xml/XMLConfigProvider.java import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory; import org.emerjoin.hi.web.config.*; import org.emerjoin.hi.web.exceptions.HiException; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.DotName; import org.jboss.jandex.Index; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.enterprise.context.ApplicationScoped; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.Validator; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; package org.emerjoin.hi.web.config.xml; /** * Created by Mario Junior. */ @ApplicationScoped public class XMLConfigProvider implements ConfigProvider { private String docsPath = null; private Logger _log = LoggerFactory.getLogger(XMLConfigProvider.class);
private Configurator getConfigurator(Class<? extends Configurator> clazz) throws HiException {
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/i18n/I18nRuntime.java
// Path: Web/src/main/java/org/emerjoin/hi/web/config/AppConfigurations.java // public class AppConfigurations { // // private String viewsDirectory; // private String welcomeUrl; // private String templates[]={"index"}; // private List<String> frontiers = new ArrayList<>(); // private List<String> frontierPackages = new ArrayList<>(); // private Tunings tunings = new Tunings(); // private Map<String,Boolean> testFiles = new HashMap<>(); // private String defaultLanguage = "default"; // private String defaultTemplate = "index"; // private long frontiersTimeout = 0; // private String baseUrl; // // private Map<String,String> testedViews = new HashMap<>(); // private List<String> smartCachingExtensions = new ArrayList<>(); // private DeploymentMode deploymentMode = DeploymentMode.DEVELOPMENT; // private Frontiers frontiersConfig = new Frontiers(); // private Security securityConfig = new Security(); // private Events eventsConfig = new Events(); // private Logger _log = LoggerFactory.getLogger(AppConfigurations.class); // // public static enum DeploymentMode { // // DEVELOPMENT, PRODUCTION // // } // // private AppConfigurations(){ // // smartCachingExtensions.add("css"); // smartCachingExtensions.add("js"); // // } // // public Map<String,String> getTestedViews() { // return testedViews; // } // // // public List<String> getSmartCachingExtensions(){ // // return smartCachingExtensions; // // } // // private static AppConfigurations appConfigurations = null; // // public static void set(AppConfigurations config){ // // appConfigurations = config; // // } // // public static AppConfigurations get(){ // // if(appConfigurations==null) // appConfigurations = new AppConfigurations(); // return appConfigurations; // // } // // // // public boolean underDevelopment(){ // // return deploymentMode==DeploymentMode.DEVELOPMENT; // // } // // // public String getViewsDirectory() { // return viewsDirectory; // } // // public void setViewsDirectory(String viewsDirectory) { // this.viewsDirectory = viewsDirectory; // } // // public String[] getTemplates() { // return templates; // } // // public void setTemplates(String[] templates) { // // this.templates = templates; // this.defaultTemplate = templates[0]; // _log.info("Setting default template : "+this.defaultTemplate); // } // // // public String getWelcomeUrl() { // // return welcomeUrl; // // } // // public void setWelcomeUrl(String welcomeUrl) { // this.welcomeUrl = welcomeUrl; // } // // // public List<String> getFrontiers() { // // return frontiers; // // } // // public void setFrontiers(List<String> frontiers) { // // this.frontiers = frontiers; // // } // // public Tunings getTunings() { // return tunings; // } // // public void setTunings(Tunings tunings) { // this.tunings = tunings; // } // // // public Map<String, Boolean> getTestFiles() { // return testFiles; // } // // public void setTestFiles(Map<String, Boolean> testFiles) { // this.testFiles = testFiles; // } // // public String getDefaultLanguage() { // return defaultLanguage; // } // // public void setDefaultLanguage(String defaultLanguage) { // this.defaultLanguage = defaultLanguage; // } // // public void setDeploymentMode(DeploymentMode mode){ // // this.deploymentMode = mode; // // } // // public List<String> getFrontierPackages() { // return frontierPackages; // } // // public void setFrontierPackages(List<String> frontierPackages) { // this.frontierPackages = frontierPackages; // } // // public DeploymentMode getDeploymentMode() { // return deploymentMode; // } // // public String getDefaultTemplate(){ // // return defaultTemplate; // // } // // public long getFrontiersTimeout() { // return frontiersTimeout; // } // // public void setFrontiersTimeout(long frontiersTimeout) { // this.frontiersTimeout = frontiersTimeout; // } // // public String getBaseUrl() { // return baseUrl; // } // // public void setBaseUrl(String baseUrl) { // this.baseUrl = baseUrl; // } // // public Frontiers getFrontiersConfig() { // return frontiersConfig; // } // // public void setFrontiersConfig(Frontiers frontiersConfig) { // this.frontiersConfig = frontiersConfig; // } // // public Security getSecurityConfig() { // return securityConfig; // } // // public void setSecurityConfig(Security securityConfig) { // this.securityConfig = securityConfig; // } // // public Events getEventsConfig(){ // // return this.eventsConfig; // // } // // public void setEventsConfig(Events eventsConfig){ // // this.eventsConfig = eventsConfig; // // } // // }
import org.emerjoin.hi.web.config.AppConfigurations; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import java.util.HashMap; import java.util.Map;
package org.emerjoin.hi.web.i18n; /** * @author Mário Júnior */ public class I18nRuntime { private static I18nRuntime instance = null; private Map<String,LanguageBundle> bundles = null; private ThreadLocal<String> currentLanguage = new ThreadLocal<>(); private ThreadLocal<LanguageBundle> currentBundle = new ThreadLocal<>(); private I18nCache cache = null; private DOMTranslator DOMTranslator = null; private boolean underDevelopment = false; private I18nConfiguration configuration; private String activeLanguage = null; private I18nRuntime(){ this.DOMTranslator = new DOMTranslator(); this.bundles = new HashMap<>(); } public static boolean isReady(){ return instance!=null; } public static I18nRuntime get(){ if(instance==null) throw new I18nException("I18n is not available. Please activate it in Hi.xml"); return instance; }
// Path: Web/src/main/java/org/emerjoin/hi/web/config/AppConfigurations.java // public class AppConfigurations { // // private String viewsDirectory; // private String welcomeUrl; // private String templates[]={"index"}; // private List<String> frontiers = new ArrayList<>(); // private List<String> frontierPackages = new ArrayList<>(); // private Tunings tunings = new Tunings(); // private Map<String,Boolean> testFiles = new HashMap<>(); // private String defaultLanguage = "default"; // private String defaultTemplate = "index"; // private long frontiersTimeout = 0; // private String baseUrl; // // private Map<String,String> testedViews = new HashMap<>(); // private List<String> smartCachingExtensions = new ArrayList<>(); // private DeploymentMode deploymentMode = DeploymentMode.DEVELOPMENT; // private Frontiers frontiersConfig = new Frontiers(); // private Security securityConfig = new Security(); // private Events eventsConfig = new Events(); // private Logger _log = LoggerFactory.getLogger(AppConfigurations.class); // // public static enum DeploymentMode { // // DEVELOPMENT, PRODUCTION // // } // // private AppConfigurations(){ // // smartCachingExtensions.add("css"); // smartCachingExtensions.add("js"); // // } // // public Map<String,String> getTestedViews() { // return testedViews; // } // // // public List<String> getSmartCachingExtensions(){ // // return smartCachingExtensions; // // } // // private static AppConfigurations appConfigurations = null; // // public static void set(AppConfigurations config){ // // appConfigurations = config; // // } // // public static AppConfigurations get(){ // // if(appConfigurations==null) // appConfigurations = new AppConfigurations(); // return appConfigurations; // // } // // // // public boolean underDevelopment(){ // // return deploymentMode==DeploymentMode.DEVELOPMENT; // // } // // // public String getViewsDirectory() { // return viewsDirectory; // } // // public void setViewsDirectory(String viewsDirectory) { // this.viewsDirectory = viewsDirectory; // } // // public String[] getTemplates() { // return templates; // } // // public void setTemplates(String[] templates) { // // this.templates = templates; // this.defaultTemplate = templates[0]; // _log.info("Setting default template : "+this.defaultTemplate); // } // // // public String getWelcomeUrl() { // // return welcomeUrl; // // } // // public void setWelcomeUrl(String welcomeUrl) { // this.welcomeUrl = welcomeUrl; // } // // // public List<String> getFrontiers() { // // return frontiers; // // } // // public void setFrontiers(List<String> frontiers) { // // this.frontiers = frontiers; // // } // // public Tunings getTunings() { // return tunings; // } // // public void setTunings(Tunings tunings) { // this.tunings = tunings; // } // // // public Map<String, Boolean> getTestFiles() { // return testFiles; // } // // public void setTestFiles(Map<String, Boolean> testFiles) { // this.testFiles = testFiles; // } // // public String getDefaultLanguage() { // return defaultLanguage; // } // // public void setDefaultLanguage(String defaultLanguage) { // this.defaultLanguage = defaultLanguage; // } // // public void setDeploymentMode(DeploymentMode mode){ // // this.deploymentMode = mode; // // } // // public List<String> getFrontierPackages() { // return frontierPackages; // } // // public void setFrontierPackages(List<String> frontierPackages) { // this.frontierPackages = frontierPackages; // } // // public DeploymentMode getDeploymentMode() { // return deploymentMode; // } // // public String getDefaultTemplate(){ // // return defaultTemplate; // // } // // public long getFrontiersTimeout() { // return frontiersTimeout; // } // // public void setFrontiersTimeout(long frontiersTimeout) { // this.frontiersTimeout = frontiersTimeout; // } // // public String getBaseUrl() { // return baseUrl; // } // // public void setBaseUrl(String baseUrl) { // this.baseUrl = baseUrl; // } // // public Frontiers getFrontiersConfig() { // return frontiersConfig; // } // // public void setFrontiersConfig(Frontiers frontiersConfig) { // this.frontiersConfig = frontiersConfig; // } // // public Security getSecurityConfig() { // return securityConfig; // } // // public void setSecurityConfig(Security securityConfig) { // this.securityConfig = securityConfig; // } // // public Events getEventsConfig(){ // // return this.eventsConfig; // // } // // public void setEventsConfig(Events eventsConfig){ // // this.eventsConfig = eventsConfig; // // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/i18n/I18nRuntime.java import org.emerjoin.hi.web.config.AppConfigurations; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import java.util.HashMap; import java.util.Map; package org.emerjoin.hi.web.i18n; /** * @author Mário Júnior */ public class I18nRuntime { private static I18nRuntime instance = null; private Map<String,LanguageBundle> bundles = null; private ThreadLocal<String> currentLanguage = new ThreadLocal<>(); private ThreadLocal<LanguageBundle> currentBundle = new ThreadLocal<>(); private I18nCache cache = null; private DOMTranslator DOMTranslator = null; private boolean underDevelopment = false; private I18nConfiguration configuration; private String activeLanguage = null; private I18nRuntime(){ this.DOMTranslator = new DOMTranslator(); this.bundles = new HashMap<>(); } public static boolean isReady(){ return instance!=null; } public static I18nRuntime get(){ if(instance==null) throw new I18nException("I18n is not available. Please activate it in Hi.xml"); return instance; }
protected static void init(I18nStarter i18NStarter, AppConfigurations configurations){
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // }
import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List;
package org.emerjoin.hi.web; /** * @author Mário Júnior */ //TODO: JavaDoc @SessionScoped public class ActiveUser implements Serializable { private String uniqueId = null; private String webEventChannel = "default"; private List<String> webEventSubscriptions = new ArrayList<>(); private String csrfToken = ""; private String eventsToken = ""; private HashMap<String,Object> data = new HashMap<>(); private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class);
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List; package org.emerjoin.hi.web; /** * @author Mário Júnior */ //TODO: JavaDoc @SessionScoped public class ActiveUser implements Serializable { private String uniqueId = null; private String webEventChannel = "default"; private List<String> webEventSubscriptions = new ArrayList<>(); private String csrfToken = ""; private String eventsToken = ""; private HashMap<String,Object> data = new HashMap<>(); private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class);
private static final SecureTokenUtil csrfTokeUtil = new SecureTokenUtil();
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // }
import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List;
package org.emerjoin.hi.web; /** * @author Mário Júnior */ //TODO: JavaDoc @SessionScoped public class ActiveUser implements Serializable { private String uniqueId = null; private String webEventChannel = "default"; private List<String> webEventSubscriptions = new ArrayList<>(); private String csrfToken = ""; private String eventsToken = ""; private HashMap<String,Object> data = new HashMap<>(); private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class); private static final SecureTokenUtil csrfTokeUtil = new SecureTokenUtil(); @Inject
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List; package org.emerjoin.hi.web; /** * @author Mário Júnior */ //TODO: JavaDoc @SessionScoped public class ActiveUser implements Serializable { private String uniqueId = null; private String webEventChannel = "default"; private List<String> webEventSubscriptions = new ArrayList<>(); private String csrfToken = ""; private String eventsToken = ""; private HashMap<String,Object> data = new HashMap<>(); private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class); private static final SecureTokenUtil csrfTokeUtil = new SecureTokenUtil(); @Inject
private transient Event<UserSubscriptionEvent> channelEvent;
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // }
import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List;
} public Object getProperty(String name){ return data.get(name); } public Object getProperty(String name,Object defaultValue){ Object value = data.get(name); if(value==null) return defaultValue; return value; } public void setProperty(String name, Object value){ data.put(name,value); } public List<String> getWebEventSubscriptions() { return Collections.unmodifiableList( webEventSubscriptions); } public void subscribe(String webEventChannel) { if (webEventChannel == null || webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); this.webEventSubscriptions.add(webEventChannel);
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List; } public Object getProperty(String name){ return data.get(name); } public Object getProperty(String name,Object defaultValue){ Object value = data.get(name); if(value==null) return defaultValue; return value; } public void setProperty(String name, Object value){ data.put(name,value); } public List<String> getWebEventSubscriptions() { return Collections.unmodifiableList( webEventSubscriptions); } public void subscribe(String webEventChannel) { if (webEventChannel == null || webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); this.webEventSubscriptions.add(webEventChannel);
channelEvent.fire(new JoinChannel(this,
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // }
import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List;
public Object getProperty(String name,Object defaultValue){ Object value = data.get(name); if(value==null) return defaultValue; return value; } public void setProperty(String name, Object value){ data.put(name,value); } public List<String> getWebEventSubscriptions() { return Collections.unmodifiableList( webEventSubscriptions); } public void subscribe(String webEventChannel) { if (webEventChannel == null || webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); this.webEventSubscriptions.add(webEventChannel); channelEvent.fire(new JoinChannel(this, webEventChannel)); } public void unsubscribe(String webEventChannel){ if(webEventChannel==null||webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); if(this.webEventSubscriptions.remove(webEventChannel))
// Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/UserSubscriptionEvent.java // public abstract class UserSubscriptionEvent extends HiEvent { // // private ActiveUser user; // private String channel; // // public UserSubscriptionEvent(ActiveUser user, String channel){ // this.user = user; // this.channel = channel; // } // // public ActiveUser getUser() { // return user; // } // // public String getChannel() { // return channel; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/JoinChannel.java // public class JoinChannel extends UserSubscriptionEvent { // // public JoinChannel(ActiveUser user, String channel) { // super(user, channel); // } // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/QuitChannel.java // public class QuitChannel extends UserSubscriptionEvent { // // public QuitChannel(ActiveUser user, String channel) { // super(user, channel); // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/security/SecureTokenUtil.java // public class SecureTokenUtil { // // private static final Logger LOGGER = LoggerFactory.getLogger(SecureTokenUtil.class); // // private String makeSecureRandom(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // int secureRandomSize = frontiersSecurity.getCrossSiteRequestForgery().getToken().getSecureRandomSize(); // SecureRandom secureRandom = new SecureRandom(); // byte[] randomBuffer = new byte[secureRandomSize]; // secureRandom.nextBytes(randomBuffer); // return DatatypeConverter.printHexBinary(randomBuffer); // } // // public String makeJwtToken(){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // // SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.valueOf(tokenConfig // .getJwtAlgorithm()); // // long nowMillis = System.currentTimeMillis(); // Date now = new Date(nowMillis); // // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig.getJwtPassphrase()); // Key signingKey = new SecretKeySpec(secretBytes, signatureAlgorithm.getJcaName()); // // //Let's set the JWT Claims // JwtBuilder builder = Jwts.builder().setId(UUID.randomUUID().toString()) // .setIssuedAt(now) // .setSubject(makeSecureRandom()) // .setIssuer("") // .signWith(signatureAlgorithm, signingKey); // // return builder.compact(); // } // // public boolean checkJwtToken(String jwt){ // AppConfigurations appConfigurations = AppConfigurations.get(); // Frontiers frontiers = appConfigurations.getFrontiersConfig(); // Frontiers.Security frontiersSecurity = frontiers.getSecurity(); // Frontiers.Security.CrossSiteRequestForgery.Token tokenConfig = frontiersSecurity // .getCrossSiteRequestForgery() // .getToken(); // byte[] secretBytes = DatatypeConverter.parseBase64Binary(tokenConfig // .getJwtPassphrase()); // try { // Jwts.parser().setSigningKey(secretBytes).parseClaimsJws(jwt) // .getBody() // .getSubject(); // return true; // }catch (SignatureException ex){ // return false; // }catch (JwtException ex){ // LOGGER.error("Error validating JSON Web Token: "+jwt, ex); // return false; // } // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java import org.emerjoin.hi.web.events.sse.UserSubscriptionEvent; import org.emerjoin.hi.web.events.sse.JoinChannel; import org.emerjoin.hi.web.events.sse.QuitChannel; import org.emerjoin.hi.web.security.SecureTokenUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import java.io.Serializable; import java.util.*; import java.util.List; public Object getProperty(String name,Object defaultValue){ Object value = data.get(name); if(value==null) return defaultValue; return value; } public void setProperty(String name, Object value){ data.put(name,value); } public List<String> getWebEventSubscriptions() { return Collections.unmodifiableList( webEventSubscriptions); } public void subscribe(String webEventChannel) { if (webEventChannel == null || webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); this.webEventSubscriptions.add(webEventChannel); channelEvent.fire(new JoinChannel(this, webEventChannel)); } public void unsubscribe(String webEventChannel){ if(webEventChannel==null||webEventChannel.isEmpty()) throw new IllegalArgumentException("webEventChannel must not be null nor empty"); if(this.webEventSubscriptions.remove(webEventChannel))
channelEvent.fire(new QuitChannel(this,
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/frontier/FrontierInvoker.java
// Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierClass.java // public class FrontierClass { // // private HashMap<String,FrontierMethod> methodsMap = new HashMap(); // private HashMap<String,FrontierMethod> hashedMethodsMap = new HashMap(); // // private String className; // private String simpleName; // private Object object; // // public FrontierClass(String clazz,String simpleName){ // // this.className = clazz; // this.simpleName = simpleName; // //this.object = object; // // } // // public String getSimpleName(){ // // return simpleName; // // } // // public String getClassName() { // return className; // } // // public void addMethod(FrontierMethod method){ // // this.methodsMap.put(method.getName(),method); // // } // // public boolean hasMethod(String name){ // // return methodsMap.containsKey(name); // // // } // // public FrontierMethod getMethod(String name){ // // return methodsMap.get(name); // // } // // // public Object getObject() { // // try { // // return CDI.current().select(Class.forName(className)).get(); // // // }catch (Exception ex){ // // return null; // // } // } // // public Class getFrontierClazz(){ // // try { // // return Class.forName(className); // // } catch (ClassNotFoundException e) { // // return null; // // } // // } // // // // // public FrontierMethod[] getMethods(){ // // FrontierMethod methods[] = new FrontierMethod[methodsMap.size()]; // methodsMap.values().toArray(methods); // return methods; // // // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierMethod.java // public class FrontierMethod { // // private String name; // private HashMap<String,MethodParam> paramsMap = new HashMap(); // private List<MethodParam> paramList = new ArrayList<MethodParam>(); // private Method method; // // public FrontierMethod(String name, Method method){ // this.name = name; // this.method = method; // // } // // // public MethodParam[] getParams(){ // // MethodParam methodParam[] = new MethodParam[paramsMap.size()]; // paramList.toArray(methodParam); // return methodParam; // // } // // public void addParam(MethodParam param){ // // paramsMap.put(param.getName(),param); // paramList.add(param); // // } // // public boolean hasParam(String name){ // // return paramsMap.containsKey(name); // // } // // public MethodParam getParam(String name){ // // // return paramsMap.get(name); // // } // // public String getName() { // // return name; // // } // // public Method getMethod() { // return method; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/MethodParam.java // public class MethodParam { // // private String name; // private Class type; // private boolean nullable; // // public MethodParam(String name, Class type, boolean nullable){ // this.name = name; // this.type = type; // this.nullable = nullable; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Class getType() { // return type; // } // // public void setType(Class type) { // this.type = type; // } // // public boolean isNullable() { // return nullable; // } // // public void setNullable(boolean nullable) { // this.nullable = nullable; // } // }
import org.emerjoin.hi.web.frontier.model.FrontierClass; import org.emerjoin.hi.web.frontier.model.FrontierMethod; import org.emerjoin.hi.web.frontier.model.MethodParam; import javax.validation.ConstraintViolationException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map;
package org.emerjoin.hi.web.frontier; /** * Created by Mario Junior. */ public class FrontierInvoker { private FrontierClass frontier;
// Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierClass.java // public class FrontierClass { // // private HashMap<String,FrontierMethod> methodsMap = new HashMap(); // private HashMap<String,FrontierMethod> hashedMethodsMap = new HashMap(); // // private String className; // private String simpleName; // private Object object; // // public FrontierClass(String clazz,String simpleName){ // // this.className = clazz; // this.simpleName = simpleName; // //this.object = object; // // } // // public String getSimpleName(){ // // return simpleName; // // } // // public String getClassName() { // return className; // } // // public void addMethod(FrontierMethod method){ // // this.methodsMap.put(method.getName(),method); // // } // // public boolean hasMethod(String name){ // // return methodsMap.containsKey(name); // // // } // // public FrontierMethod getMethod(String name){ // // return methodsMap.get(name); // // } // // // public Object getObject() { // // try { // // return CDI.current().select(Class.forName(className)).get(); // // // }catch (Exception ex){ // // return null; // // } // } // // public Class getFrontierClazz(){ // // try { // // return Class.forName(className); // // } catch (ClassNotFoundException e) { // // return null; // // } // // } // // // // // public FrontierMethod[] getMethods(){ // // FrontierMethod methods[] = new FrontierMethod[methodsMap.size()]; // methodsMap.values().toArray(methods); // return methods; // // // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierMethod.java // public class FrontierMethod { // // private String name; // private HashMap<String,MethodParam> paramsMap = new HashMap(); // private List<MethodParam> paramList = new ArrayList<MethodParam>(); // private Method method; // // public FrontierMethod(String name, Method method){ // this.name = name; // this.method = method; // // } // // // public MethodParam[] getParams(){ // // MethodParam methodParam[] = new MethodParam[paramsMap.size()]; // paramList.toArray(methodParam); // return methodParam; // // } // // public void addParam(MethodParam param){ // // paramsMap.put(param.getName(),param); // paramList.add(param); // // } // // public boolean hasParam(String name){ // // return paramsMap.containsKey(name); // // } // // public MethodParam getParam(String name){ // // // return paramsMap.get(name); // // } // // public String getName() { // // return name; // // } // // public Method getMethod() { // return method; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/MethodParam.java // public class MethodParam { // // private String name; // private Class type; // private boolean nullable; // // public MethodParam(String name, Class type, boolean nullable){ // this.name = name; // this.type = type; // this.nullable = nullable; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Class getType() { // return type; // } // // public void setType(Class type) { // this.type = type; // } // // public boolean isNullable() { // return nullable; // } // // public void setNullable(boolean nullable) { // this.nullable = nullable; // } // } // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/FrontierInvoker.java import org.emerjoin.hi.web.frontier.model.FrontierClass; import org.emerjoin.hi.web.frontier.model.FrontierMethod; import org.emerjoin.hi.web.frontier.model.MethodParam; import javax.validation.ConstraintViolationException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; package org.emerjoin.hi.web.frontier; /** * Created by Mario Junior. */ public class FrontierInvoker { private FrontierClass frontier;
private FrontierMethod method;
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/frontier/FrontierInvoker.java
// Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierClass.java // public class FrontierClass { // // private HashMap<String,FrontierMethod> methodsMap = new HashMap(); // private HashMap<String,FrontierMethod> hashedMethodsMap = new HashMap(); // // private String className; // private String simpleName; // private Object object; // // public FrontierClass(String clazz,String simpleName){ // // this.className = clazz; // this.simpleName = simpleName; // //this.object = object; // // } // // public String getSimpleName(){ // // return simpleName; // // } // // public String getClassName() { // return className; // } // // public void addMethod(FrontierMethod method){ // // this.methodsMap.put(method.getName(),method); // // } // // public boolean hasMethod(String name){ // // return methodsMap.containsKey(name); // // // } // // public FrontierMethod getMethod(String name){ // // return methodsMap.get(name); // // } // // // public Object getObject() { // // try { // // return CDI.current().select(Class.forName(className)).get(); // // // }catch (Exception ex){ // // return null; // // } // } // // public Class getFrontierClazz(){ // // try { // // return Class.forName(className); // // } catch (ClassNotFoundException e) { // // return null; // // } // // } // // // // // public FrontierMethod[] getMethods(){ // // FrontierMethod methods[] = new FrontierMethod[methodsMap.size()]; // methodsMap.values().toArray(methods); // return methods; // // // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierMethod.java // public class FrontierMethod { // // private String name; // private HashMap<String,MethodParam> paramsMap = new HashMap(); // private List<MethodParam> paramList = new ArrayList<MethodParam>(); // private Method method; // // public FrontierMethod(String name, Method method){ // this.name = name; // this.method = method; // // } // // // public MethodParam[] getParams(){ // // MethodParam methodParam[] = new MethodParam[paramsMap.size()]; // paramList.toArray(methodParam); // return methodParam; // // } // // public void addParam(MethodParam param){ // // paramsMap.put(param.getName(),param); // paramList.add(param); // // } // // public boolean hasParam(String name){ // // return paramsMap.containsKey(name); // // } // // public MethodParam getParam(String name){ // // // return paramsMap.get(name); // // } // // public String getName() { // // return name; // // } // // public Method getMethod() { // return method; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/MethodParam.java // public class MethodParam { // // private String name; // private Class type; // private boolean nullable; // // public MethodParam(String name, Class type, boolean nullable){ // this.name = name; // this.type = type; // this.nullable = nullable; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Class getType() { // return type; // } // // public void setType(Class type) { // this.type = type; // } // // public boolean isNullable() { // return nullable; // } // // public void setNullable(boolean nullable) { // this.nullable = nullable; // } // }
import org.emerjoin.hi.web.frontier.model.FrontierClass; import org.emerjoin.hi.web.frontier.model.FrontierMethod; import org.emerjoin.hi.web.frontier.model.MethodParam; import javax.validation.ConstraintViolationException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map;
package org.emerjoin.hi.web.frontier; /** * Created by Mario Junior. */ public class FrontierInvoker { private FrontierClass frontier; private FrontierMethod method; private Map params; private Object returnedObject = new HashMap<>(); public FrontierInvoker(FrontierClass frontierClass, FrontierMethod method, Map params){ this.frontier = frontierClass; this.method = method; this.params = params; } public void setReturnedObject(Object value){ if(value==null) throw new IllegalArgumentException("Returned value must not be null"); this.returnedObject = value; } public Object[] getCallArguments(){
// Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierClass.java // public class FrontierClass { // // private HashMap<String,FrontierMethod> methodsMap = new HashMap(); // private HashMap<String,FrontierMethod> hashedMethodsMap = new HashMap(); // // private String className; // private String simpleName; // private Object object; // // public FrontierClass(String clazz,String simpleName){ // // this.className = clazz; // this.simpleName = simpleName; // //this.object = object; // // } // // public String getSimpleName(){ // // return simpleName; // // } // // public String getClassName() { // return className; // } // // public void addMethod(FrontierMethod method){ // // this.methodsMap.put(method.getName(),method); // // } // // public boolean hasMethod(String name){ // // return methodsMap.containsKey(name); // // // } // // public FrontierMethod getMethod(String name){ // // return methodsMap.get(name); // // } // // // public Object getObject() { // // try { // // return CDI.current().select(Class.forName(className)).get(); // // // }catch (Exception ex){ // // return null; // // } // } // // public Class getFrontierClazz(){ // // try { // // return Class.forName(className); // // } catch (ClassNotFoundException e) { // // return null; // // } // // } // // // // // public FrontierMethod[] getMethods(){ // // FrontierMethod methods[] = new FrontierMethod[methodsMap.size()]; // methodsMap.values().toArray(methods); // return methods; // // // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierMethod.java // public class FrontierMethod { // // private String name; // private HashMap<String,MethodParam> paramsMap = new HashMap(); // private List<MethodParam> paramList = new ArrayList<MethodParam>(); // private Method method; // // public FrontierMethod(String name, Method method){ // this.name = name; // this.method = method; // // } // // // public MethodParam[] getParams(){ // // MethodParam methodParam[] = new MethodParam[paramsMap.size()]; // paramList.toArray(methodParam); // return methodParam; // // } // // public void addParam(MethodParam param){ // // paramsMap.put(param.getName(),param); // paramList.add(param); // // } // // public boolean hasParam(String name){ // // return paramsMap.containsKey(name); // // } // // public MethodParam getParam(String name){ // // // return paramsMap.get(name); // // } // // public String getName() { // // return name; // // } // // public Method getMethod() { // return method; // } // } // // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/MethodParam.java // public class MethodParam { // // private String name; // private Class type; // private boolean nullable; // // public MethodParam(String name, Class type, boolean nullable){ // this.name = name; // this.type = type; // this.nullable = nullable; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public Class getType() { // return type; // } // // public void setType(Class type) { // this.type = type; // } // // public boolean isNullable() { // return nullable; // } // // public void setNullable(boolean nullable) { // this.nullable = nullable; // } // } // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/FrontierInvoker.java import org.emerjoin.hi.web.frontier.model.FrontierClass; import org.emerjoin.hi.web.frontier.model.FrontierMethod; import org.emerjoin.hi.web.frontier.model.MethodParam; import javax.validation.ConstraintViolationException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; package org.emerjoin.hi.web.frontier; /** * Created by Mario Junior. */ public class FrontierInvoker { private FrontierClass frontier; private FrontierMethod method; private Map params; private Object returnedObject = new HashMap<>(); public FrontierInvoker(FrontierClass frontierClass, FrontierMethod method, Map params){ this.frontier = frontierClass; this.method = method; this.params = params; } public void setReturnedObject(Object value){ if(value==null) throw new IllegalArgumentException("Returned value must not be null"); this.returnedObject = value; } public Object[] getCallArguments(){
MethodParam methodParams[] = method.getParams();
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/events/sse/WebEventsListener.java
// Path: Web/src/main/java/org/emerjoin/hi/web/AppContext.java // @ApplicationScoped // public class AppContext implements Serializable { // // private static GsonBuilder GSON_BUILDER = null; // // static { // // GSON_BUILDER =new GsonBuilder(); // // } // // private static String assetVersionPrefix = ".vd3p1d"; // private static final Logger LOGGER = LoggerFactory.getLogger(AppContext.class); // // public static void setAssetVersionPrefix(String prefix) { // // assetVersionPrefix = prefix; // // } // // // @Inject // private BootAgent bootAgent; // // @Inject // private Event<GsonInitEvent> gsonInitEvent; // // private String baseUrl; // // private String origin; // // private String domain; // // public String getAssetVersionToken(){ // // return assetVersionPrefix+String.valueOf(getDeployId()); // // } // // public String getDeployId(){ // // return bootAgent.getDeployId(); // // } // // public AppConfigurations.DeploymentMode getDeployMode(){ // // return AppConfigurations.get().getDeploymentMode(); // // } // // // @PostConstruct // public void setup(){ // if(AppContext.GSON_BUILDER==null) // AppContext.GSON_BUILDER = new GsonBuilder(); // //Fire the GsonInit event // LOGGER.info("Firing GSON initialization event..."); // gsonInitEvent.fire(new GsonInitEvent(AppContext.GSON_BUILDER)); // } // // // public Gson createGsonInstance(){ // // return AppContext.createGson(); // // // } // // public GsonBuilder getGsonBuilderInstance(){ // // return AppContext.getGsonBuilder(); // // } // // // public static GsonBuilder getGsonBuilder(){ // // return AppContext.GSON_BUILDER; // // } // // // public static Gson createGson(){ // // return AppContext.GSON_BUILDER.create(); // // } // // public static void setGsonBuilder(GsonBuilder builder){ // if(builder==null) // throw new IllegalArgumentException("builder reference must not be null"); // AppContext.GSON_BUILDER = builder; // // } // // public String getBaseURL() { // return baseUrl; // } // // public void setBaseURL(String baseUrl) { // this.baseUrl = baseUrl; // this.computeOrigin(); // this.computeDomain(); // } // // public boolean isBaseURLSet(){ // return this.baseUrl!=null; // } // // public String getOrigin() { // return this.origin; // } // // public String getDomain() { // return this.domain; // } // // private void computeDomain(){ // int doubleSlashIndex = origin.indexOf("//"); // String withoutDoubleSlash = origin.substring(doubleSlashIndex+2,origin.length()); // int semiColonIndex = withoutDoubleSlash.indexOf(':'); // if(semiColonIndex != -1){ // domain = withoutDoubleSlash.substring(0,semiColonIndex); // }else domain = withoutDoubleSlash; // } // // private void computeOrigin(){ // StringBuilder builder = new StringBuilder(); // builder.append(this.baseUrl.substring(0,baseUrl.indexOf("//")+2)); // int doubleSlashIndex = this.baseUrl.indexOf("//"); // String withoutDoubleSlash = this.baseUrl.substring(doubleSlashIndex+2,this.baseUrl.length()); // int nextForwardSlashIndex = withoutDoubleSlash.indexOf('/'); // if(nextForwardSlashIndex != -1) // builder.append(withoutDoubleSlash.substring(0,nextForwardSlashIndex)); // else builder.append(withoutDoubleSlash); // this.origin = builder.toString(); // } // // }
import org.emerjoin.hi.web.AppContext; import javax.servlet.AsyncContext; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.PrintWriter;
package org.emerjoin.hi.web.events.sse; /** * @author Mario Junior. */ class WebEventsListener { private AsyncContext context; private String name = "Unknown"; private String userId; WebEventsListener(AsyncContext context){ this(context,"Unknown"); } WebEventsListener(AsyncContext context, String userId){ HttpServletRequest request = (HttpServletRequest) context.getRequest(); String browser = request.getHeader("User-Agent"); if(browser!=null&&!browser.isEmpty()) this.name = browser; this.context = context; this.userId = userId; } void deliver(WebEvent event){ try {
// Path: Web/src/main/java/org/emerjoin/hi/web/AppContext.java // @ApplicationScoped // public class AppContext implements Serializable { // // private static GsonBuilder GSON_BUILDER = null; // // static { // // GSON_BUILDER =new GsonBuilder(); // // } // // private static String assetVersionPrefix = ".vd3p1d"; // private static final Logger LOGGER = LoggerFactory.getLogger(AppContext.class); // // public static void setAssetVersionPrefix(String prefix) { // // assetVersionPrefix = prefix; // // } // // // @Inject // private BootAgent bootAgent; // // @Inject // private Event<GsonInitEvent> gsonInitEvent; // // private String baseUrl; // // private String origin; // // private String domain; // // public String getAssetVersionToken(){ // // return assetVersionPrefix+String.valueOf(getDeployId()); // // } // // public String getDeployId(){ // // return bootAgent.getDeployId(); // // } // // public AppConfigurations.DeploymentMode getDeployMode(){ // // return AppConfigurations.get().getDeploymentMode(); // // } // // // @PostConstruct // public void setup(){ // if(AppContext.GSON_BUILDER==null) // AppContext.GSON_BUILDER = new GsonBuilder(); // //Fire the GsonInit event // LOGGER.info("Firing GSON initialization event..."); // gsonInitEvent.fire(new GsonInitEvent(AppContext.GSON_BUILDER)); // } // // // public Gson createGsonInstance(){ // // return AppContext.createGson(); // // // } // // public GsonBuilder getGsonBuilderInstance(){ // // return AppContext.getGsonBuilder(); // // } // // // public static GsonBuilder getGsonBuilder(){ // // return AppContext.GSON_BUILDER; // // } // // // public static Gson createGson(){ // // return AppContext.GSON_BUILDER.create(); // // } // // public static void setGsonBuilder(GsonBuilder builder){ // if(builder==null) // throw new IllegalArgumentException("builder reference must not be null"); // AppContext.GSON_BUILDER = builder; // // } // // public String getBaseURL() { // return baseUrl; // } // // public void setBaseURL(String baseUrl) { // this.baseUrl = baseUrl; // this.computeOrigin(); // this.computeDomain(); // } // // public boolean isBaseURLSet(){ // return this.baseUrl!=null; // } // // public String getOrigin() { // return this.origin; // } // // public String getDomain() { // return this.domain; // } // // private void computeDomain(){ // int doubleSlashIndex = origin.indexOf("//"); // String withoutDoubleSlash = origin.substring(doubleSlashIndex+2,origin.length()); // int semiColonIndex = withoutDoubleSlash.indexOf(':'); // if(semiColonIndex != -1){ // domain = withoutDoubleSlash.substring(0,semiColonIndex); // }else domain = withoutDoubleSlash; // } // // private void computeOrigin(){ // StringBuilder builder = new StringBuilder(); // builder.append(this.baseUrl.substring(0,baseUrl.indexOf("//")+2)); // int doubleSlashIndex = this.baseUrl.indexOf("//"); // String withoutDoubleSlash = this.baseUrl.substring(doubleSlashIndex+2,this.baseUrl.length()); // int nextForwardSlashIndex = withoutDoubleSlash.indexOf('/'); // if(nextForwardSlashIndex != -1) // builder.append(withoutDoubleSlash.substring(0,nextForwardSlashIndex)); // else builder.append(withoutDoubleSlash); // this.origin = builder.toString(); // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/WebEventsListener.java import org.emerjoin.hi.web.AppContext; import javax.servlet.AsyncContext; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.PrintWriter; package org.emerjoin.hi.web.events.sse; /** * @author Mario Junior. */ class WebEventsListener { private AsyncContext context; private String name = "Unknown"; private String userId; WebEventsListener(AsyncContext context){ this(context,"Unknown"); } WebEventsListener(AsyncContext context, String userId){ HttpServletRequest request = (HttpServletRequest) context.getRequest(); String browser = request.getHeader("User-Agent"); if(browser!=null&&!browser.isEmpty()) this.name = browser; this.context = context; this.userId = userId; } void deliver(WebEvent event){ try {
String eventJson = AppContext.createGson().toJson(event);
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/events/sse/WebEventsController.java
// Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java // @SessionScoped // public class ActiveUser implements Serializable { // // private String uniqueId = null; // private String webEventChannel = "default"; // private List<String> webEventSubscriptions = new ArrayList<>(); // private String csrfToken = ""; // private String eventsToken = ""; // private HashMap<String,Object> data = new HashMap<>(); // private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class); // private static final SecureTokenUtil csrfTokeUtil = new SecureTokenUtil(); // // @Inject // private transient Event<UserSubscriptionEvent> channelEvent; // // @PostConstruct // public void init(){ // this.csrfToken = csrfTokeUtil.makeJwtToken(); // this.eventsToken = csrfTokeUtil.makeJwtToken(); // this.uniqueId = UUID.randomUUID().toString(); // } // // public void expireTokens(){ // this.csrfToken = csrfTokeUtil.makeJwtToken(); // this.eventsToken = csrfTokeUtil.makeJwtToken(); // } // // public String getEventsToken() { // return eventsToken; // } // // public String getCsrfToken() { // return csrfToken; // } // // public HashMap<String, Object> getData() { // return data; // } // // public void setData(HashMap<String, Object> data) { // this.data = data; // } // // public Object getProperty(String name){ // // return data.get(name); // // } // // public Object getProperty(String name,Object defaultValue){ // Object value = data.get(name); // if(value==null) // return defaultValue; // return value; // } // // public void setProperty(String name, Object value){ // // data.put(name,value); // // } // // public List<String> getWebEventSubscriptions() { // return Collections.unmodifiableList( // webEventSubscriptions); // } // // public void subscribe(String webEventChannel) { // if (webEventChannel == null || webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // this.webEventSubscriptions.add(webEventChannel); // channelEvent.fire(new JoinChannel(this, // webEventChannel)); // } // // public void unsubscribe(String webEventChannel){ // if(webEventChannel==null||webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // if(this.webEventSubscriptions.remove(webEventChannel)) // channelEvent.fire(new QuitChannel(this, // webEventChannel)); // } // // public boolean isSubscribedTo(String webEventChannel){ // if(webEventChannel==null||webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // return this.webEventSubscriptions.contains( // webEventChannel); // } // // public String getWebEventChannel() { // return webEventChannel; // } // // public void setWebEventChannel(String webEventChannel) { // this.webEventChannel = webEventChannel; // } // // public String getUniqueId() { // return uniqueId; // } // }
import org.emerjoin.hi.web.ActiveUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.servlet.AsyncContext; import java.util.*; import java.util.concurrent.ConcurrentHashMap;
LOGGER.info("No Listeners found for user with Id="+userId); return; } LOGGER.info(String.format("Detaching %d listener(s) from channel",listenerList.size())); for(WebEventsListener listener: listenerList){ consumersPool.remove(listener); } } public void joinChannel(String userId, String channel){ if(userId==null||userId.isEmpty()) throw new IllegalArgumentException("userId reference must not be null nor empty"); if(channel==null||channel.isEmpty()) throw new IllegalArgumentException("channel reference must not be null nor empty"); LOGGER.info(String.format("User [%s] joining channel [%s]",userId,channel)); ListenersPool consumersPool = pools.get(channel); if(consumersPool==null){ consumersPool= new ListenersPool(channel); pools.put(channel,consumersPool); } List<WebEventsListener> listenerList = userListenersMap.get(userId); if(listenerList==null||listenerList.isEmpty()){ LOGGER.info("There are no listeners bound to user with Id="+userId); return; }else LOGGER.info(String.format("Adding %d listener(s) to channel",listenerList.size())); for(WebEventsListener listener: listenerList){ consumersPool.addListener(listener); } }
// Path: Web/src/main/java/org/emerjoin/hi/web/ActiveUser.java // @SessionScoped // public class ActiveUser implements Serializable { // // private String uniqueId = null; // private String webEventChannel = "default"; // private List<String> webEventSubscriptions = new ArrayList<>(); // private String csrfToken = ""; // private String eventsToken = ""; // private HashMap<String,Object> data = new HashMap<>(); // private static final Logger _log = LoggerFactory.getLogger(ActiveUser.class); // private static final SecureTokenUtil csrfTokeUtil = new SecureTokenUtil(); // // @Inject // private transient Event<UserSubscriptionEvent> channelEvent; // // @PostConstruct // public void init(){ // this.csrfToken = csrfTokeUtil.makeJwtToken(); // this.eventsToken = csrfTokeUtil.makeJwtToken(); // this.uniqueId = UUID.randomUUID().toString(); // } // // public void expireTokens(){ // this.csrfToken = csrfTokeUtil.makeJwtToken(); // this.eventsToken = csrfTokeUtil.makeJwtToken(); // } // // public String getEventsToken() { // return eventsToken; // } // // public String getCsrfToken() { // return csrfToken; // } // // public HashMap<String, Object> getData() { // return data; // } // // public void setData(HashMap<String, Object> data) { // this.data = data; // } // // public Object getProperty(String name){ // // return data.get(name); // // } // // public Object getProperty(String name,Object defaultValue){ // Object value = data.get(name); // if(value==null) // return defaultValue; // return value; // } // // public void setProperty(String name, Object value){ // // data.put(name,value); // // } // // public List<String> getWebEventSubscriptions() { // return Collections.unmodifiableList( // webEventSubscriptions); // } // // public void subscribe(String webEventChannel) { // if (webEventChannel == null || webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // this.webEventSubscriptions.add(webEventChannel); // channelEvent.fire(new JoinChannel(this, // webEventChannel)); // } // // public void unsubscribe(String webEventChannel){ // if(webEventChannel==null||webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // if(this.webEventSubscriptions.remove(webEventChannel)) // channelEvent.fire(new QuitChannel(this, // webEventChannel)); // } // // public boolean isSubscribedTo(String webEventChannel){ // if(webEventChannel==null||webEventChannel.isEmpty()) // throw new IllegalArgumentException("webEventChannel must not be null nor empty"); // return this.webEventSubscriptions.contains( // webEventChannel); // } // // public String getWebEventChannel() { // return webEventChannel; // } // // public void setWebEventChannel(String webEventChannel) { // this.webEventChannel = webEventChannel; // } // // public String getUniqueId() { // return uniqueId; // } // } // Path: Web/src/main/java/org/emerjoin/hi/web/events/sse/WebEventsController.java import org.emerjoin.hi.web.ActiveUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.servlet.AsyncContext; import java.util.*; import java.util.concurrent.ConcurrentHashMap; LOGGER.info("No Listeners found for user with Id="+userId); return; } LOGGER.info(String.format("Detaching %d listener(s) from channel",listenerList.size())); for(WebEventsListener listener: listenerList){ consumersPool.remove(listener); } } public void joinChannel(String userId, String channel){ if(userId==null||userId.isEmpty()) throw new IllegalArgumentException("userId reference must not be null nor empty"); if(channel==null||channel.isEmpty()) throw new IllegalArgumentException("channel reference must not be null nor empty"); LOGGER.info(String.format("User [%s] joining channel [%s]",userId,channel)); ListenersPool consumersPool = pools.get(channel); if(consumersPool==null){ consumersPool= new ListenersPool(channel); pools.put(channel,consumersPool); } List<WebEventsListener> listenerList = userListenersMap.get(userId); if(listenerList==null||listenerList.isEmpty()){ LOGGER.info("There are no listeners bound to user with Id="+userId); return; }else LOGGER.info(String.format("Adding %d listener(s) to channel",listenerList.size())); for(WebEventsListener listener: listenerList){ consumersPool.addListener(listener); } }
WebEventsListener addListener(ActiveUser activeUser, AsyncContext context){
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/boot/BootManager.java
// Path: Web/src/main/java/org/emerjoin/hi/web/exceptions/HiException.java // public class HiException extends ServletException { // // public HiException(String m){ // // super(m); // // } // // public HiException(String m, Throwable throwable){ // // super(m,throwable); // // } // // }
import org.emerjoin.hi.web.exceptions.HiException; import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader;
package org.emerjoin.hi.web.boot; /** * @author Mário Júnior */ public class BootManager { private static List<BootExtension> extensions = new ArrayList<>(); static { ServiceLoader<BootExtension> extensionsSPI = ServiceLoader.load(BootExtension.class); for(BootExtension e: extensionsSPI) extensions.add(e); }
// Path: Web/src/main/java/org/emerjoin/hi/web/exceptions/HiException.java // public class HiException extends ServletException { // // public HiException(String m){ // // super(m); // // } // // public HiException(String m, Throwable throwable){ // // super(m,throwable); // // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/boot/BootManager.java import org.emerjoin.hi.web.exceptions.HiException; import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader; package org.emerjoin.hi.web.boot; /** * @author Mário Júnior */ public class BootManager { private static List<BootExtension> extensions = new ArrayList<>(); static { ServiceLoader<BootExtension> extensionsSPI = ServiceLoader.load(BootExtension.class); for(BootExtension e: extensionsSPI) extensions.add(e); }
public static List<BootExtension> getExtensions() throws HiException {
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierBeansCrawler.java
// Path: Web/src/main/java/org/emerjoin/hi/web/HiCDI.java // public class HiCDI { // // public static void shouldHaveCDIScope(Class clazz) throws NoCDIScopeException{ // // //TODO: This shouldn't throw and exception because there might be custom scopes // Annotation scope1 = clazz.getAnnotation(RequestScoped.class); // Annotation scope2 = clazz.getAnnotation(ApplicationScoped.class); // Annotation scope3 = clazz.getAnnotation(SessionScoped.class); // Annotation scope4 = clazz.getAnnotation(ConversationScoped.class); // Annotation scope5 = clazz.getAnnotation(Dependent.class); // // if(scope1==null&&scope2==null&&scope3==null&&scope4==null&&scope5==null) // throw new NoCDIScopeException(clazz); // // } // // }
import org.emerjoin.hi.web.HiCDI; import org.emerjoin.hi.web.meta.Frontier; import org.emerjoin.hi.web.meta.Nullable; import javax.servlet.ServletException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
beanMethod.addParam(methodParam); i++; } bean.addMethod(beanMethod); } } public FrontierClass[] crawl(List<Class> beansList) throws ServletException{ FrontierClass[] beanClasses = null; try { List<FrontierClass> beanClassList = new ArrayList<FrontierClass>(); String simpleName = ""; for (Class beanClass : beansList) { if(beanClass.isInterface()) continue; String beanClassName = beanClass.getCanonicalName(); try { beanClass = Class.forName(beanClassName.toString()); simpleName = beanClass.getSimpleName();
// Path: Web/src/main/java/org/emerjoin/hi/web/HiCDI.java // public class HiCDI { // // public static void shouldHaveCDIScope(Class clazz) throws NoCDIScopeException{ // // //TODO: This shouldn't throw and exception because there might be custom scopes // Annotation scope1 = clazz.getAnnotation(RequestScoped.class); // Annotation scope2 = clazz.getAnnotation(ApplicationScoped.class); // Annotation scope3 = clazz.getAnnotation(SessionScoped.class); // Annotation scope4 = clazz.getAnnotation(ConversationScoped.class); // Annotation scope5 = clazz.getAnnotation(Dependent.class); // // if(scope1==null&&scope2==null&&scope3==null&&scope4==null&&scope5==null) // throw new NoCDIScopeException(clazz); // // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/frontier/model/FrontierBeansCrawler.java import org.emerjoin.hi.web.HiCDI; import org.emerjoin.hi.web.meta.Frontier; import org.emerjoin.hi.web.meta.Nullable; import javax.servlet.ServletException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; beanMethod.addParam(methodParam); i++; } bean.addMethod(beanMethod); } } public FrontierClass[] crawl(List<Class> beansList) throws ServletException{ FrontierClass[] beanClasses = null; try { List<FrontierClass> beanClassList = new ArrayList<FrontierClass>(); String simpleName = ""; for (Class beanClass : beansList) { if(beanClass.isInterface()) continue; String beanClassName = beanClass.getCanonicalName(); try { beanClass = Class.forName(beanClassName.toString()); simpleName = beanClass.getSimpleName();
HiCDI.shouldHaveCDIScope(beanClass);
Emerjoin/Hi-Framework
Web/src/main/java/org/emerjoin/hi/web/req/ReqHandler.java
// Path: Web/src/main/java/org/emerjoin/hi/web/AuthComponent.java // public interface AuthComponent { // // public boolean isUserInAnyOfThisRoles(String[] roles); // public boolean doesUserHavePermission(String permissionName); // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/RequestContext.java // @RequestScoped // public class RequestContext { // // public static String AJAX_HEADER_KEY = "AJAX_MVC"; // // @Inject // private AppContext appContext; // // @Inject // private HttpServletRequest request = null; // private HttpServletResponse response = null; // // @Inject // private Event<JSCommandSchedule> jsCommandScheduleEvent; // // @Inject // private ServletContext servletContext = null; // private Map<String,Object> data = new HashMap<String, Object>(); // private String url = null; // private String routeUrl; // // private OutputStream outputStream = null; // private Logger log = LoggerFactory.getLogger(RequestContext.class); // // @PostConstruct // private void getReady(){ // // this.url = request.getRequestURI(); // // } // // protected void setRouteUrl(String r){ // // this.routeUrl = r; // // } // // public void setUrl(String url) { // this.url = url; // } // // protected void setResponse(HttpServletResponse response){ // // this.response = response; // // } // // public void echo(String str){ // // Helper.echo(str,this); // // } // // public void echoln(String str){ // // Helper.echoln(str,this); // // } // // // public String readToEnd(InputStream inputStream){ // // return Helper.readLines(inputStream,this); // // } // // // public String getUsername(){ // // return request.getRemoteUser(); // // } // // public boolean isUserLogged(){ // // return request.getRemoteUser()!=null; // // } // // public OutputStream getOutputStream(){ // // if(outputStream ==null){ // try { // // outputStream = response.getOutputStream(); // // }catch (Throwable ex){ // log.error("Failed to get the HttpServletResponse OutputStream",ex); // } // } // // return outputStream; // // } // // public String getRouteUrl(){ // // return routeUrl; // // } // // public HttpServletRequest getRequest(){ // // return request; // // } // // public HttpServletResponse getResponse(){ // // return response; // // } // // public boolean hasAjaxHeader(){ // // if(request==null) // return false; // return request.getHeader(AJAX_HEADER_KEY)!=null; // // } // // // // public ServletContext getServletContext(){ // // return servletContext; // // } // // // public String getUrl() { // return url; // } // // public Map<String,Object> getData(){ // // return data; // // } // // public void sendRedirect(String route) throws IOException{ // if(hasAjaxHeader()){ // log.debug("Ajax Redirect: "+route); // this.ajaxRedirect(routeUrl); // return; // } // String path = appContext.getBaseURL() + route; // log.debug("HTTP Redirect: "+path); // getResponse().sendRedirect(path); // } // // private void ajaxRedirect(String url){ // JSCommandSchedule redirectCommand = new JSCommandSchedule(FrontEnd. // COMMAND_REDIRECT); // redirectCommand.getParameters().put(FrontEnd.COMMAND_URL_PARAM, url); // jsCommandScheduleEvent.fire( // redirectCommand); // } // // }
import org.emerjoin.hi.web.AuthComponent; import org.emerjoin.hi.web.RequestContext; import org.emerjoin.hi.web.meta.Denied; import org.emerjoin.hi.web.meta.Granted; import org.emerjoin.hi.web.meta.RequirePermission; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.inject.spi.CDI; import javax.servlet.ServletException; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern;
Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(url); return matcher.matches(); }catch (Exception ex){ throw new ReqMatchException(reqHandler.getCanonicalName(), "handler <"+reqHandler.getCanonicalName()+"> has an invalid match regular expression"); } } private static boolean checkPermission(Granted granted, RequestContext requestContext){ if(granted.value().length==0) return true; boolean allowed = false; for(String role : granted.value()){ if(requestContext.getRequest().isUserInRole(role)){ allowed = true; break; } } return allowed; } private static boolean validateAccess(Annotation grantedAnnotation, Annotation deniedAnnotation, Annotation requirePermissionAnnotation){ boolean accessGranted = true;
// Path: Web/src/main/java/org/emerjoin/hi/web/AuthComponent.java // public interface AuthComponent { // // public boolean isUserInAnyOfThisRoles(String[] roles); // public boolean doesUserHavePermission(String permissionName); // // } // // Path: Web/src/main/java/org/emerjoin/hi/web/RequestContext.java // @RequestScoped // public class RequestContext { // // public static String AJAX_HEADER_KEY = "AJAX_MVC"; // // @Inject // private AppContext appContext; // // @Inject // private HttpServletRequest request = null; // private HttpServletResponse response = null; // // @Inject // private Event<JSCommandSchedule> jsCommandScheduleEvent; // // @Inject // private ServletContext servletContext = null; // private Map<String,Object> data = new HashMap<String, Object>(); // private String url = null; // private String routeUrl; // // private OutputStream outputStream = null; // private Logger log = LoggerFactory.getLogger(RequestContext.class); // // @PostConstruct // private void getReady(){ // // this.url = request.getRequestURI(); // // } // // protected void setRouteUrl(String r){ // // this.routeUrl = r; // // } // // public void setUrl(String url) { // this.url = url; // } // // protected void setResponse(HttpServletResponse response){ // // this.response = response; // // } // // public void echo(String str){ // // Helper.echo(str,this); // // } // // public void echoln(String str){ // // Helper.echoln(str,this); // // } // // // public String readToEnd(InputStream inputStream){ // // return Helper.readLines(inputStream,this); // // } // // // public String getUsername(){ // // return request.getRemoteUser(); // // } // // public boolean isUserLogged(){ // // return request.getRemoteUser()!=null; // // } // // public OutputStream getOutputStream(){ // // if(outputStream ==null){ // try { // // outputStream = response.getOutputStream(); // // }catch (Throwable ex){ // log.error("Failed to get the HttpServletResponse OutputStream",ex); // } // } // // return outputStream; // // } // // public String getRouteUrl(){ // // return routeUrl; // // } // // public HttpServletRequest getRequest(){ // // return request; // // } // // public HttpServletResponse getResponse(){ // // return response; // // } // // public boolean hasAjaxHeader(){ // // if(request==null) // return false; // return request.getHeader(AJAX_HEADER_KEY)!=null; // // } // // // // public ServletContext getServletContext(){ // // return servletContext; // // } // // // public String getUrl() { // return url; // } // // public Map<String,Object> getData(){ // // return data; // // } // // public void sendRedirect(String route) throws IOException{ // if(hasAjaxHeader()){ // log.debug("Ajax Redirect: "+route); // this.ajaxRedirect(routeUrl); // return; // } // String path = appContext.getBaseURL() + route; // log.debug("HTTP Redirect: "+path); // getResponse().sendRedirect(path); // } // // private void ajaxRedirect(String url){ // JSCommandSchedule redirectCommand = new JSCommandSchedule(FrontEnd. // COMMAND_REDIRECT); // redirectCommand.getParameters().put(FrontEnd.COMMAND_URL_PARAM, url); // jsCommandScheduleEvent.fire( // redirectCommand); // } // // } // Path: Web/src/main/java/org/emerjoin/hi/web/req/ReqHandler.java import org.emerjoin.hi.web.AuthComponent; import org.emerjoin.hi.web.RequestContext; import org.emerjoin.hi.web.meta.Denied; import org.emerjoin.hi.web.meta.Granted; import org.emerjoin.hi.web.meta.RequirePermission; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.inject.spi.CDI; import javax.servlet.ServletException; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(url); return matcher.matches(); }catch (Exception ex){ throw new ReqMatchException(reqHandler.getCanonicalName(), "handler <"+reqHandler.getCanonicalName()+"> has an invalid match regular expression"); } } private static boolean checkPermission(Granted granted, RequestContext requestContext){ if(granted.value().length==0) return true; boolean allowed = false; for(String role : granted.value()){ if(requestContext.getRequest().isUserInRole(role)){ allowed = true; break; } } return allowed; } private static boolean validateAccess(Annotation grantedAnnotation, Annotation deniedAnnotation, Annotation requirePermissionAnnotation){ boolean accessGranted = true;
AuthComponent authComponent = null;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/CMaker.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java // public final class VariableDeclaration implements Writable // { // @NotNull private final StorageClass storageClass; // private final boolean isConst; // private final boolean isVolatile; // @NotNull private final String cTypeName; // @NotNull private final String name; // @NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes; // // // The cTypeName needs to include any 'pointer' attributes, eg restrict, volatile, const, * // public VariableDeclaration(@NotNull final StorageClass storageClass, final boolean isConst, final boolean isVolatile, @NotNull final String cTypeName, @NotNull final String name, @NotNull final GccAttributes<GccVariableAttributeName> gccAttributes) // { // this.storageClass = storageClass; // this.isConst = isConst; // this.isVolatile = isVolatile; // this.cTypeName = cTypeName; // this.name = name; // this.gccAttributes = gccAttributes; // } // // public void write(@NotNull final Writer writer) throws IOException // { // if (storageClass != auto) // { // writer.write(storageClass.storageClass); // writer.write(' '); // } // // if (isConst) // { // writer.write("const "); // } // // if (isVolatile) // { // writer.write("volatile "); // } // // writer.write(cTypeName); // writer.write(' '); // writer.write(name); // // gccAttributes.write(writer); // // writer.write(';'); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/CharsetHelper.java // @NotNull public static final Charset Utf8 = forName("UTF-8");
import com.stormmq.java2c.transpiler.conversion.c.VariableDeclaration; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Modifier; import javax.lang.model.element.QualifiedNameable; import java.io.*; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import static com.stormmq.java2c.transpiler.CharsetHelper.Utf8; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static java.util.regex.Pattern.compile; import static javax.lang.model.element.Modifier.STRICTFP;
package com.stormmq.java2c.transpiler.conversion; public class CMaker { @NotNull private static final Pattern DotMatch = compile("\\."); @NotNull private final CFileCreator cFileCreator; public CMaker(@NotNull final CFileCreator cFileCreator) { this.cFileCreator = cFileCreator; }
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java // public final class VariableDeclaration implements Writable // { // @NotNull private final StorageClass storageClass; // private final boolean isConst; // private final boolean isVolatile; // @NotNull private final String cTypeName; // @NotNull private final String name; // @NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes; // // // The cTypeName needs to include any 'pointer' attributes, eg restrict, volatile, const, * // public VariableDeclaration(@NotNull final StorageClass storageClass, final boolean isConst, final boolean isVolatile, @NotNull final String cTypeName, @NotNull final String name, @NotNull final GccAttributes<GccVariableAttributeName> gccAttributes) // { // this.storageClass = storageClass; // this.isConst = isConst; // this.isVolatile = isVolatile; // this.cTypeName = cTypeName; // this.name = name; // this.gccAttributes = gccAttributes; // } // // public void write(@NotNull final Writer writer) throws IOException // { // if (storageClass != auto) // { // writer.write(storageClass.storageClass); // writer.write(' '); // } // // if (isConst) // { // writer.write("const "); // } // // if (isVolatile) // { // writer.write("volatile "); // } // // writer.write(cTypeName); // writer.write(' '); // writer.write(name); // // gccAttributes.write(writer); // // writer.write(';'); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/CharsetHelper.java // @NotNull public static final Charset Utf8 = forName("UTF-8"); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/CMaker.java import com.stormmq.java2c.transpiler.conversion.c.VariableDeclaration; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Modifier; import javax.lang.model.element.QualifiedNameable; import java.io.*; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import static com.stormmq.java2c.transpiler.CharsetHelper.Utf8; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static java.util.regex.Pattern.compile; import static javax.lang.model.element.Modifier.STRICTFP; package com.stormmq.java2c.transpiler.conversion; public class CMaker { @NotNull private static final Pattern DotMatch = compile("\\."); @NotNull private final CFileCreator cFileCreator; public CMaker(@NotNull final CFileCreator cFileCreator) { this.cFileCreator = cFileCreator; }
public void makeFiles(@NotNull final QualifiedNameable qualifiedNameable, final boolean isPackage, @NotNull final List<String> libraryIncludes, @NotNull final List<String> localIncludes, @NotNull final List<VariableDeclaration> publicConstants) throws IOException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/CMaker.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java // public final class VariableDeclaration implements Writable // { // @NotNull private final StorageClass storageClass; // private final boolean isConst; // private final boolean isVolatile; // @NotNull private final String cTypeName; // @NotNull private final String name; // @NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes; // // // The cTypeName needs to include any 'pointer' attributes, eg restrict, volatile, const, * // public VariableDeclaration(@NotNull final StorageClass storageClass, final boolean isConst, final boolean isVolatile, @NotNull final String cTypeName, @NotNull final String name, @NotNull final GccAttributes<GccVariableAttributeName> gccAttributes) // { // this.storageClass = storageClass; // this.isConst = isConst; // this.isVolatile = isVolatile; // this.cTypeName = cTypeName; // this.name = name; // this.gccAttributes = gccAttributes; // } // // public void write(@NotNull final Writer writer) throws IOException // { // if (storageClass != auto) // { // writer.write(storageClass.storageClass); // writer.write(' '); // } // // if (isConst) // { // writer.write("const "); // } // // if (isVolatile) // { // writer.write("volatile "); // } // // writer.write(cTypeName); // writer.write(' '); // writer.write(name); // // gccAttributes.write(writer); // // writer.write(';'); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/CharsetHelper.java // @NotNull public static final Charset Utf8 = forName("UTF-8");
import com.stormmq.java2c.transpiler.conversion.c.VariableDeclaration; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Modifier; import javax.lang.model.element.QualifiedNameable; import java.io.*; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import static com.stormmq.java2c.transpiler.CharsetHelper.Utf8; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static java.util.regex.Pattern.compile; import static javax.lang.model.element.Modifier.STRICTFP;
package com.stormmq.java2c.transpiler.conversion; public class CMaker { @NotNull private static final Pattern DotMatch = compile("\\."); @NotNull private final CFileCreator cFileCreator; public CMaker(@NotNull final CFileCreator cFileCreator) { this.cFileCreator = cFileCreator; } public void makeFiles(@NotNull final QualifiedNameable qualifiedNameable, final boolean isPackage, @NotNull final List<String> libraryIncludes, @NotNull final List<String> localIncludes, @NotNull final List<VariableDeclaration> publicConstants) throws IOException { final Set<Modifier> modifiers = qualifiedNameable.getModifiers(); // strictfp in essence requires that we use float and double // w/o strictfp, we could use float_t and double_t, which are normally 80-bit long double // in practice, this is going to confuse the hell out of users if (modifiers.contains(STRICTFP)) { /* The effect of the strictfp modifier is to make all float or double expressions within the class declaration (including within variable initializers, instance initializers, static initializers, and constructors) be explicitly FP-strict (§15.4). This implies that all methods declared in the class, and all nested types declared in the class, are implicitly strictfp. In other words, use double_t / float_t types from math.h for local variables, if NOT using strictfp Generate a cast from double_t to double and float_t to float; need to check that the thing we're casting is, of course, actually a local variable of the relevant type... and cast order precedence is maintained (if the user then casts to something else */ /* On an interface, makes all implementations of all methods strict... */ } final String qualifiedName = qualifiedNameable.getQualifiedName().toString(); // Includes to other modules will need to use a relative path syntax... final File headerFile = cFileCreator.headerFilePath(qualifiedName, isPackage); try(final OutputStream outputStream = new FileOutputStream(headerFile, true)) {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java // public final class VariableDeclaration implements Writable // { // @NotNull private final StorageClass storageClass; // private final boolean isConst; // private final boolean isVolatile; // @NotNull private final String cTypeName; // @NotNull private final String name; // @NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes; // // // The cTypeName needs to include any 'pointer' attributes, eg restrict, volatile, const, * // public VariableDeclaration(@NotNull final StorageClass storageClass, final boolean isConst, final boolean isVolatile, @NotNull final String cTypeName, @NotNull final String name, @NotNull final GccAttributes<GccVariableAttributeName> gccAttributes) // { // this.storageClass = storageClass; // this.isConst = isConst; // this.isVolatile = isVolatile; // this.cTypeName = cTypeName; // this.name = name; // this.gccAttributes = gccAttributes; // } // // public void write(@NotNull final Writer writer) throws IOException // { // if (storageClass != auto) // { // writer.write(storageClass.storageClass); // writer.write(' '); // } // // if (isConst) // { // writer.write("const "); // } // // if (isVolatile) // { // writer.write("volatile "); // } // // writer.write(cTypeName); // writer.write(' '); // writer.write(name); // // gccAttributes.write(writer); // // writer.write(';'); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/CharsetHelper.java // @NotNull public static final Charset Utf8 = forName("UTF-8"); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/CMaker.java import com.stormmq.java2c.transpiler.conversion.c.VariableDeclaration; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Modifier; import javax.lang.model.element.QualifiedNameable; import java.io.*; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import static com.stormmq.java2c.transpiler.CharsetHelper.Utf8; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static java.util.regex.Pattern.compile; import static javax.lang.model.element.Modifier.STRICTFP; package com.stormmq.java2c.transpiler.conversion; public class CMaker { @NotNull private static final Pattern DotMatch = compile("\\."); @NotNull private final CFileCreator cFileCreator; public CMaker(@NotNull final CFileCreator cFileCreator) { this.cFileCreator = cFileCreator; } public void makeFiles(@NotNull final QualifiedNameable qualifiedNameable, final boolean isPackage, @NotNull final List<String> libraryIncludes, @NotNull final List<String> localIncludes, @NotNull final List<VariableDeclaration> publicConstants) throws IOException { final Set<Modifier> modifiers = qualifiedNameable.getModifiers(); // strictfp in essence requires that we use float and double // w/o strictfp, we could use float_t and double_t, which are normally 80-bit long double // in practice, this is going to confuse the hell out of users if (modifiers.contains(STRICTFP)) { /* The effect of the strictfp modifier is to make all float or double expressions within the class declaration (including within variable initializers, instance initializers, static initializers, and constructors) be explicitly FP-strict (§15.4). This implies that all methods declared in the class, and all nested types declared in the class, are implicitly strictfp. In other words, use double_t / float_t types from math.h for local variables, if NOT using strictfp Generate a cast from double_t to double and float_t to float; need to check that the thing we're casting is, of course, actually a local variable of the relevant type... and cast order precedence is maintained (if the user then casts to something else */ /* On an interface, makes all implementations of all methods strict... */ } final String qualifiedName = qualifiedNameable.getQualifiedName().toString(); // Includes to other modules will need to use a relative path syntax... final File headerFile = cFileCreator.headerFilePath(qualifiedName, isPackage); try(final OutputStream outputStream = new FileOutputStream(headerFile, true)) {
try (final Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, Utf8), 4096))
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // }
import com.stormmq.java2c.transpiler.warnings.Warnings; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Element; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import static java.lang.String.format; import static java.util.Locale.ENGLISH;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public interface ElementConverter<E extends Element> { @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() { @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java import com.stormmq.java2c.transpiler.warnings.Warnings; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Element; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import static java.lang.String.format; import static java.util.Locale.ENGLISH; package com.stormmq.java2c.transpiler.conversion.elementConverters; public interface ElementConverter<E extends Element> { @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() { @Override
public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException
raphaelcohn/java2c
source/samples/com/stormmq/java2c/samples/Comparable.java
// Path: source/model/com/stormmq/java2c/model/CObject.java // public abstract class CObject extends Root // { // protected CObject() // { // } // }
import com.stormmq.java2c.model.CObject; import com.stormmq.java2c.model.functions.pure; import org.jetbrains.annotations.Nullable; import java.util.concurrent.atomic.*;
package com.stormmq.java2c.samples; public interface Comparable { void horrid(AtomicInteger atomicInteger, AtomicBoolean atomicBoolean, AtomicLong a, AtomicLongArray aa, AtomicIntegerArray z, AtomicReference<?> ref); @pure
// Path: source/model/com/stormmq/java2c/model/CObject.java // public abstract class CObject extends Root // { // protected CObject() // { // } // } // Path: source/samples/com/stormmq/java2c/samples/Comparable.java import com.stormmq.java2c.model.CObject; import com.stormmq.java2c.model.functions.pure; import org.jetbrains.annotations.Nullable; import java.util.concurrent.atomic.*; package com.stormmq.java2c.samples; public interface Comparable { void horrid(AtomicInteger atomicInteger, AtomicBoolean atomicBoolean, AtomicLong a, AtomicLongArray aa, AtomicIntegerArray z, AtomicReference<?> ref); @pure
int compareTo(@Nullable final CObject that);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // );
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*;
(Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // ); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*; (Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
final List<GccAttribute<GccVariableAttributeName>> gccAttributes = StaticFieldAttributesProcessors.processFieldAttributes(staticField);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // );
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*;
(Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // ); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*; (Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
final List<GccAttribute<GccVariableAttributeName>> gccAttributes = StaticFieldAttributesProcessors.processFieldAttributes(staticField);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // );
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*;
(Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java // @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors // ( // NullCheck, // Deprecated, // Unused, // Alignment, // ThreadLocalModel, // Section, // Packed // ); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/CategorisedClassMembers.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.*; import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.FieldAttributesProcessors.StaticFieldAttributesProcessors; import static java.lang.String.format; import static java.util.Locale.ENGLISH; import static javax.lang.model.element.Modifier.*; (Same as that above) For public static & non-literal value, we can do: header: extern int fieldName; source: int fieldName; void static() { any_other_static_init1(); fieldName = NON-LITERAL any_other_static_init2(); } Ditto for protected and none For private, there is (a) no extern and (b) all variables are declared with storage class STATIC */ for (VariableElement staticField : staticFields) { processStaticField(staticField); } } private void processStaticField(@NotNull final VariableElement staticField) throws ConversionException { final TypeResolver typeResolver = new TypeResolver(); final String cType = typeResolver.resolveType(staticField); final String fieldName = classNameEscaped + '_' + staticField.getSimpleName().toString();
final List<GccAttribute<GccVariableAttributeName>> gccAttributes = StaticFieldAttributesProcessors.processFieldAttributes(staticField);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import org.jetbrains.annotations.NotNull; import javax.tools.Diagnostic; import javax.tools.JavaFileObject; import static java.lang.String.format; import static java.lang.System.err; import static java.util.Locale.ENGLISH;
package com.stormmq.java2c.transpiler.warnings; public final class StandardErrorWarnings implements Warnings { @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings(); private StandardErrorWarnings() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import org.jetbrains.annotations.NotNull; import javax.tools.Diagnostic; import javax.tools.JavaFileObject; import static java.lang.String.format; import static java.lang.System.err; import static java.util.Locale.ENGLISH; package com.stormmq.java2c.transpiler.warnings; public final class StandardErrorWarnings implements Warnings { @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings(); private StandardErrorWarnings() { } @Override
public void fatal(@NotNull final FatalCompilationException cause)
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class NullCheckFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); private NullCheckFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public interface FieldAttributesProcessor {
void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/JavaModules.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java // @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings();
import com.stormmq.java2c.transpiler.javaModules.*; import org.jetbrains.annotations.NotNull; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import static com.stormmq.java2c.transpiler.warnings.StandardErrorWarnings.StandardErrorWarningsInstance;
package com.stormmq.java2c.transpiler; public final class JavaModules { @NotNull private final List<JavaModule> javaModules; public JavaModules(@NotNull final List<ModuleName> moduleNames, @NotNull final RootPathAndExpression moduleRoot, @NotNull final RootPathAndExpression sourceOutput, @NotNull final RootPathAndExpression classOutput) throws IllegalRelativePathException { javaModules = new ArrayList<>(moduleNames.size()); for (final ModuleName moduleName : moduleNames) { javaModules.add(new JavaModule(moduleName, moduleRoot, sourceOutput, classOutput)); } } public void execute() throws IllegalRelativePathException, FatalCompilationException { // There will need to be a dependency order in the future... for (final JavaModule javaModule : javaModules) { final Path sourceOutputPath = javaModule.sourceOutputPath(); final Path classOutputPath = javaModule.classOutputPath(); final Path sourcePath = javaModule.sourcePath(); final Path[] classPaths = new Path[0];
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java // @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings(); // Path: source/transpiler/com/stormmq/java2c/transpiler/JavaModules.java import com.stormmq.java2c.transpiler.javaModules.*; import org.jetbrains.annotations.NotNull; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import static com.stormmq.java2c.transpiler.warnings.StandardErrorWarnings.StandardErrorWarningsInstance; package com.stormmq.java2c.transpiler; public final class JavaModules { @NotNull private final List<JavaModule> javaModules; public JavaModules(@NotNull final List<ModuleName> moduleNames, @NotNull final RootPathAndExpression moduleRoot, @NotNull final RootPathAndExpression sourceOutput, @NotNull final RootPathAndExpression classOutput) throws IllegalRelativePathException { javaModules = new ArrayList<>(moduleNames.size()); for (final ModuleName moduleName : moduleNames) { javaModules.add(new JavaModule(moduleName, moduleRoot, sourceOutput, classOutput)); } } public void execute() throws IllegalRelativePathException, FatalCompilationException { // There will need to be a dependency order in the future... for (final JavaModule javaModule : javaModules) { final Path sourceOutputPath = javaModule.sourceOutputPath(); final Path classOutputPath = javaModule.classOutputPath(); final Path sourcePath = javaModule.sourcePath(); final Path[] classPaths = new Path[0];
final JavaModuleCompiler javaModuleCompiler = new JavaModuleCompiler(StandardErrorWarningsInstance, sourceOutputPath, classOutputPath, sourcePath, classPaths);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/Application.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java // @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings();
import com.stormmq.java2c.transpiler.javaModules.*; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.nio.file.Path; import java.util.List; import static com.stormmq.java2c.transpiler.warnings.StandardErrorWarnings.StandardErrorWarningsInstance; import static java.lang.String.format; import static java.nio.file.Files.createTempDirectory; import static java.nio.file.Files.delete; import static java.util.Locale.ENGLISH;
package com.stormmq.java2c.transpiler; public final class Application { @NotNull private final List<ModuleName> moduleNames; @NotNull private final RootPathAndExpression moduleRoot; @NotNull private final RootPathAndExpression sourceOutput; public Application(@NotNull final List<ModuleName> moduleNames, @NotNull final RootPathAndExpression moduleRoot, @NotNull final RootPathAndExpression sourceOutput) { this.moduleNames = moduleNames; this.moduleRoot = moduleRoot; this.sourceOutput = sourceOutput; } public void execute() throws IllegalRelativePathExpressionException, IllegalRelativePathException { final Path classOutputRootPath; try { classOutputRootPath = createTempDirectory("java2c-"); } catch (IOException e) { throw new IllegalStateException(format(ENGLISH, "Could not create a temporary folder for java2c because of '%1$s'", e.getMessage()), e); } try { final RootPathAndExpression classOutput = new RootPathAndExpression(classOutputRootPath, new RelativePathExpression("%m")); new JavaModules(moduleNames, moduleRoot, sourceOutput, classOutput).execute(); } catch (FatalCompilationException e) {
// Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/StandardErrorWarnings.java // @NotNull public static final Warnings StandardErrorWarningsInstance = new StandardErrorWarnings(); // Path: source/transpiler/com/stormmq/java2c/transpiler/Application.java import com.stormmq.java2c.transpiler.javaModules.*; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.nio.file.Path; import java.util.List; import static com.stormmq.java2c.transpiler.warnings.StandardErrorWarnings.StandardErrorWarningsInstance; import static java.lang.String.format; import static java.nio.file.Files.createTempDirectory; import static java.nio.file.Files.delete; import static java.util.Locale.ENGLISH; package com.stormmq.java2c.transpiler; public final class Application { @NotNull private final List<ModuleName> moduleNames; @NotNull private final RootPathAndExpression moduleRoot; @NotNull private final RootPathAndExpression sourceOutput; public Application(@NotNull final List<ModuleName> moduleNames, @NotNull final RootPathAndExpression moduleRoot, @NotNull final RootPathAndExpression sourceOutput) { this.moduleNames = moduleNames; this.moduleRoot = moduleRoot; this.sourceOutput = sourceOutput; } public void execute() throws IllegalRelativePathExpressionException, IllegalRelativePathException { final Path classOutputRootPath; try { classOutputRootPath = createTempDirectory("java2c-"); } catch (IOException e) { throw new IllegalStateException(format(ENGLISH, "Could not create a temporary folder for java2c because of '%1$s'", e.getMessage()), e); } try { final RootPathAndExpression classOutput = new RootPathAndExpression(classOutputRootPath, new RelativePathExpression("%m")); new JavaModules(moduleNames, moduleRoot, sourceOutput, classOutput).execute(); } catch (FatalCompilationException e) {
StandardErrorWarningsInstance.fatal(e);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributes.java // public final class GccAttributes<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final List<GccAttribute<N>> gccAttributes; // // public GccAttributes(@NotNull final List<GccAttribute<N>> gccAttributes) // { // this.gccAttributes = gccAttributes; // } // // @Override // public void write(@NotNull final Writer writer) throws IOException // { // if (gccAttributes.isEmpty()) // { // return; // } // // writer.write(" __attribute__ (("); // boolean afterFirst = false; // for (GccAttribute<N> gccAttribute : gccAttributes) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttribute.write(writer); // } // writer.write("))"); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/Writable.java // public interface Writable // { // void write(@NotNull final Writer writer) throws IOException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributes; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.Writable; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.Writer; import static com.stormmq.java2c.transpiler.conversion.c.StorageClass.auto;
package com.stormmq.java2c.transpiler.conversion.c; public final class VariableDeclaration implements Writable { @NotNull private final StorageClass storageClass; private final boolean isConst; private final boolean isVolatile; @NotNull private final String cTypeName; @NotNull private final String name;
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributes.java // public final class GccAttributes<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final List<GccAttribute<N>> gccAttributes; // // public GccAttributes(@NotNull final List<GccAttribute<N>> gccAttributes) // { // this.gccAttributes = gccAttributes; // } // // @Override // public void write(@NotNull final Writer writer) throws IOException // { // if (gccAttributes.isEmpty()) // { // return; // } // // writer.write(" __attribute__ (("); // boolean afterFirst = false; // for (GccAttribute<N> gccAttribute : gccAttributes) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttribute.write(writer); // } // writer.write("))"); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/Writable.java // public interface Writable // { // void write(@NotNull final Writer writer) throws IOException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributes; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.Writable; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.Writer; import static com.stormmq.java2c.transpiler.conversion.c.StorageClass.auto; package com.stormmq.java2c.transpiler.conversion.c; public final class VariableDeclaration implements Writable { @NotNull private final StorageClass storageClass; private final boolean isConst; private final boolean isVolatile; @NotNull private final String cTypeName; @NotNull private final String name;
@NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributes.java // public final class GccAttributes<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final List<GccAttribute<N>> gccAttributes; // // public GccAttributes(@NotNull final List<GccAttribute<N>> gccAttributes) // { // this.gccAttributes = gccAttributes; // } // // @Override // public void write(@NotNull final Writer writer) throws IOException // { // if (gccAttributes.isEmpty()) // { // return; // } // // writer.write(" __attribute__ (("); // boolean afterFirst = false; // for (GccAttribute<N> gccAttribute : gccAttributes) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttribute.write(writer); // } // writer.write("))"); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/Writable.java // public interface Writable // { // void write(@NotNull final Writer writer) throws IOException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // }
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributes; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.Writable; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.Writer; import static com.stormmq.java2c.transpiler.conversion.c.StorageClass.auto;
package com.stormmq.java2c.transpiler.conversion.c; public final class VariableDeclaration implements Writable { @NotNull private final StorageClass storageClass; private final boolean isConst; private final boolean isVolatile; @NotNull private final String cTypeName; @NotNull private final String name;
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributes.java // public final class GccAttributes<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final List<GccAttribute<N>> gccAttributes; // // public GccAttributes(@NotNull final List<GccAttribute<N>> gccAttributes) // { // this.gccAttributes = gccAttributes; // } // // @Override // public void write(@NotNull final Writer writer) throws IOException // { // if (gccAttributes.isEmpty()) // { // return; // } // // writer.write(" __attribute__ (("); // boolean afterFirst = false; // for (GccAttribute<N> gccAttribute : gccAttributes) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttribute.write(writer); // } // writer.write("))"); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/Writable.java // public interface Writable // { // void write(@NotNull final Writer writer) throws IOException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/VariableDeclaration.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributes; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.Writable; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.Writer; import static com.stormmq.java2c.transpiler.conversion.c.StorageClass.auto; package com.stormmq.java2c.transpiler.conversion.c; public final class VariableDeclaration implements Writable { @NotNull private final StorageClass storageClass; private final boolean isConst; private final boolean isVolatile; @NotNull private final String cTypeName; @NotNull private final String name;
@NotNull private final GccAttributes<GccVariableAttributeName> gccAttributes;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
@NotNull private static final GccAttribute<GccVariableAttributeName> PackedAttribute = new GccAttribute<>(packed);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
@NotNull private static final GccAttribute<GccVariableAttributeName> PackedAttribute = new GccAttribute<>(packed);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttribute<GccVariableAttributeName> PackedAttribute = new GccAttribute<>(packed); @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); private PackedFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.packed; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName.packed; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class PackedFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttribute<GccVariableAttributeName> PackedAttribute = new GccAttribute<>(packed); @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); private PackedFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/samples/com/stormmq/java2c/samples/stdlib/Stdlib.java
// Path: source/model/com/stormmq/java2c/model/C.java // public abstract class C // { // protected C() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // }
import com.stormmq.java2c.model.C; import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.primitives.char_; import org.jetbrains.annotations.NotNull;
package com.stormmq.java2c.samples.stdlib; /* Should have no instance methods Should have a private constructor Should have only public static methods, ideally we'd like to make these native. It would be nice to be able to marshal using primitives - ultimately, we want to be able to write dynamic glue code to support this API, so we can test from Java! - very similar to the BridJ code, but written by us Pointers are interesting - Structs are passed as references; we'll need special syntax to pass-by-value - the only times passing a struct by value makes sense are:- - when it's less than 8-bytes (4-bytes on 32-bit systems) [some might argue that 16 bytes makes sense] - when we want an explicit copy (not likely) - when a library requires it */ public final class Stdlib extends C { private Stdlib() { } // var-args handling is going to be a barrel of laughs! /* This translates as:- The annoying thing is that restrict could be used, but we have to know the object we're passing is immutable... void printf(const char *format, ...) { ... } */
// Path: source/model/com/stormmq/java2c/model/C.java // public abstract class C // { // protected C() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // } // Path: source/samples/com/stormmq/java2c/samples/stdlib/Stdlib.java import com.stormmq.java2c.model.C; import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.primitives.char_; import org.jetbrains.annotations.NotNull; package com.stormmq.java2c.samples.stdlib; /* Should have no instance methods Should have a private constructor Should have only public static methods, ideally we'd like to make these native. It would be nice to be able to marshal using primitives - ultimately, we want to be able to write dynamic glue code to support this API, so we can test from Java! - very similar to the BridJ code, but written by us Pointers are interesting - Structs are passed as references; we'll need special syntax to pass-by-value - the only times passing a struct by value makes sense are:- - when it's less than 8-bytes (4-bytes on 32-bit systems) [some might argue that 16 bytes makes sense] - when we want an explicit copy (not likely) - when a library requires it */ public final class Stdlib extends C { private Stdlib() { } // var-args handling is going to be a barrel of laughs! /* This translates as:- The annoying thing is that restrict could be used, but we have to know the object we're passing is immutable... void printf(const char *format, ...) { ... } */
public static native void printf(@NotNull final Pointer<char_> format, @NotNull final Object... varargs);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // }
import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*;
package com.stormmq.java2c.transpiler.annotationProcessors; // https://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html#accessing-the-abstract-syntax-tree-the-compiler-tree-api public final class CodeTreeAnalyzerProcessor extends AbstractTreeAnalyzerProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // } // Path: source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*; package com.stormmq.java2c.transpiler.annotationProcessors; // https://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html#accessing-the-abstract-syntax-tree-the-compiler-tree-api public final class CodeTreeAnalyzerProcessor extends AbstractTreeAnalyzerProcessor {
@NotNull private final Warnings warnings;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // }
import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*;
package com.stormmq.java2c.transpiler.annotationProcessors; // https://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html#accessing-the-abstract-syntax-tree-the-compiler-tree-api public final class CodeTreeAnalyzerProcessor extends AbstractTreeAnalyzerProcessor { @NotNull private final Warnings warnings;
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // } // Path: source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*; package com.stormmq.java2c.transpiler.annotationProcessors; // https://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html#accessing-the-abstract-syntax-tree-the-compiler-tree-api public final class CodeTreeAnalyzerProcessor extends AbstractTreeAnalyzerProcessor { @NotNull private final Warnings warnings;
@NotNull private final Map<ElementKind, ElementConverter<?>> topLevelConverters;
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // }
import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*;
topLevelConverters = new HashMap<ElementKind, ElementConverter<?>>(5) {{ put(PACKAGE, packageConverter); put(ENUM, enumConverter); put(CLASS, classConverter); put(ANNOTATION_TYPE, annotationConverter); put(INTERFACE, interfaceConverter); }}; } @Override public void init(@NotNull final ProcessingEnvironment pe) { super.init(pe); trees = Trees.instance(pe); } @Override public boolean process(@NotNull final Set<? extends TypeElement> annotations, @NotNull final RoundEnvironment roundEnv) { assert trees != null; for (final Element rootElement : roundEnv.getRootElements()) { @SuppressWarnings("unchecked") @Nullable final ElementConverter<Element> elementConverter = (ElementConverter<Element>) topLevelConverters.get(rootElement.getKind()); @NotNull final ElementConverter<Element> actualElementConverter = elementConverter == null ? UnknownElementConverterInstance : elementConverter; try { actualElementConverter.convert(warnings, rootElement); }
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // } // Path: source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*; topLevelConverters = new HashMap<ElementKind, ElementConverter<?>>(5) {{ put(PACKAGE, packageConverter); put(ENUM, enumConverter); put(CLASS, classConverter); put(ANNOTATION_TYPE, annotationConverter); put(INTERFACE, interfaceConverter); }}; } @Override public void init(@NotNull final ProcessingEnvironment pe) { super.init(pe); trees = Trees.instance(pe); } @Override public boolean process(@NotNull final Set<? extends TypeElement> annotations, @NotNull final RoundEnvironment roundEnv) { assert trees != null; for (final Element rootElement : roundEnv.getRootElements()) { @SuppressWarnings("unchecked") @Nullable final ElementConverter<Element> elementConverter = (ElementConverter<Element>) topLevelConverters.get(rootElement.getKind()); @NotNull final ElementConverter<Element> actualElementConverter = elementConverter == null ? UnknownElementConverterInstance : elementConverter; try { actualElementConverter.convert(warnings, rootElement); }
catch (ConversionException e)
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // }
import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*;
put(PACKAGE, packageConverter); put(ENUM, enumConverter); put(CLASS, classConverter); put(ANNOTATION_TYPE, annotationConverter); put(INTERFACE, interfaceConverter); }}; } @Override public void init(@NotNull final ProcessingEnvironment pe) { super.init(pe); trees = Trees.instance(pe); } @Override public boolean process(@NotNull final Set<? extends TypeElement> annotations, @NotNull final RoundEnvironment roundEnv) { assert trees != null; for (final Element rootElement : roundEnv.getRootElements()) { @SuppressWarnings("unchecked") @Nullable final ElementConverter<Element> elementConverter = (ElementConverter<Element>) topLevelConverters.get(rootElement.getKind()); @NotNull final ElementConverter<Element> actualElementConverter = elementConverter == null ? UnknownElementConverterInstance : elementConverter; try { actualElementConverter.convert(warnings, rootElement); } catch (ConversionException e) {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ElementConverter.java // public interface ElementConverter<E extends Element> // { // @NotNull ElementConverter<Element> UnknownElementConverterInstance = new ElementConverter<Element>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final Element element) throws ConversionException // { // throw new ConversionException(format(ENGLISH, "Do not know how to convert elements like '%1$s'", element)); // } // }; // // @NotNull ElementConverter<PackageElement> PackageElementIgnoredElementConverterInstance = new ElementConverter<PackageElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final PackageElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // @NotNull ElementConverter<TypeElement> TypeElementIgnoredElementConverterInstance = new ElementConverter<TypeElement>() // { // @Override // public void convert(@NotNull final Warnings warnings, @NotNull final TypeElement element) // { // warnings.warn(format(ENGLISH, "Ignoring elements of kind %1$s", element.getKind().name())); // } // }; // // void convert(@NotNull final Warnings warnings, @NotNull final E element) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java // public interface Warnings extends DiagnosticListener<JavaFileObject> // { // void fatal(@NotNull final FatalCompilationException cause); // // void warn(@NotNull final String warning); // // void information(@NotNull final String information); // } // Path: source/transpiler/com/stormmq/java2c/transpiler/annotationProcessors/CodeTreeAnalyzerProcessor.java import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter; import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import com.stormmq.java2c.transpiler.warnings.Warnings; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import java.util.HashMap; import java.util.Map; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.ElementConverter.UnknownElementConverterInstance; import static javax.lang.model.element.ElementKind.*; put(PACKAGE, packageConverter); put(ENUM, enumConverter); put(CLASS, classConverter); put(ANNOTATION_TYPE, annotationConverter); put(INTERFACE, interfaceConverter); }}; } @Override public void init(@NotNull final ProcessingEnvironment pe) { super.init(pe); trees = Trees.instance(pe); } @Override public boolean process(@NotNull final Set<? extends TypeElement> annotations, @NotNull final RoundEnvironment roundEnv) { assert trees != null; for (final Element rootElement : roundEnv.getRootElements()) { @SuppressWarnings("unchecked") @Nullable final ElementConverter<Element> elementConverter = (ElementConverter<Element>) topLevelConverters.get(rootElement.getKind()); @NotNull final ElementConverter<Element> actualElementConverter = elementConverter == null ? UnknownElementConverterInstance : elementConverter; try { actualElementConverter.convert(warnings, rootElement); } catch (ConversionException e) {
warnings.fatal(new FatalCompilationException(e.getMessage(), e));
raphaelcohn/java2c
source/samples/com/stormmq/java2c/samples/Single.java
// Path: source/model/com/stormmq/java2c/model/Struct.java // public abstract class Struct extends Root // { // protected Struct() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/signed_int.java // @PrimitiveConversion("signed int") // public class signed_int extends Primitive // { // private final short value; // // // Technically, can be 16-bit, but in practice this is no longer true; it's 32-bit on 32-bit and 64-bit Linux // public signed_int(final short value) // { // this.value = value; // } // // @NotNull // public static signed_int literal(final short literal) // { // return new signed_int(literal); // } // }
import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.Struct; import com.stormmq.java2c.model.functions.*; import com.stormmq.java2c.model.primitives.char_; import com.stormmq.java2c.model.primitives.signed_int; import com.stormmq.java2c.model.variables.unsigned; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static com.stormmq.java2c.model.functions.FormatArgArchetype.printf; import static com.stormmq.java2c.model.functions.Inlining.Force; import static com.stormmq.java2c.model.functions.Purity.Constant;
@Override @inline(Force) @flatten @hot public int hashCode() { return index; } @pure(Constant) @cold public static int divideByTwo(final int value) { return value / 2; } @Deprecated private void printHello() { } @SuppressWarnings("UnusedDeclaration") private static void notUsed(@NotNull @sentinel final Object... varargs) { } // In this case, because c_signed_int is a primitive, we do not generate an __attribute__((returns_nonnull)) // Nor do we generate __attribute__((nonnull(varargs))) for varargs @NotNull
// Path: source/model/com/stormmq/java2c/model/Struct.java // public abstract class Struct extends Root // { // protected Struct() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/signed_int.java // @PrimitiveConversion("signed int") // public class signed_int extends Primitive // { // private final short value; // // // Technically, can be 16-bit, but in practice this is no longer true; it's 32-bit on 32-bit and 64-bit Linux // public signed_int(final short value) // { // this.value = value; // } // // @NotNull // public static signed_int literal(final short literal) // { // return new signed_int(literal); // } // } // Path: source/samples/com/stormmq/java2c/samples/Single.java import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.Struct; import com.stormmq.java2c.model.functions.*; import com.stormmq.java2c.model.primitives.char_; import com.stormmq.java2c.model.primitives.signed_int; import com.stormmq.java2c.model.variables.unsigned; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static com.stormmq.java2c.model.functions.FormatArgArchetype.printf; import static com.stormmq.java2c.model.functions.Inlining.Force; import static com.stormmq.java2c.model.functions.Purity.Constant; @Override @inline(Force) @flatten @hot public int hashCode() { return index; } @pure(Constant) @cold public static int divideByTwo(final int value) { return value / 2; } @Deprecated private void printHello() { } @SuppressWarnings("UnusedDeclaration") private static void notUsed(@NotNull @sentinel final Object... varargs) { } // In this case, because c_signed_int is a primitive, we do not generate an __attribute__((returns_nonnull)) // Nor do we generate __attribute__((nonnull(varargs))) for varargs @NotNull
private static signed_int myPrintf(@NotNull final Pointer<signed_int> something, @NotNull @format_arg final Pointer<char_> my_format, @NotNull @format(printf) Object... varargs)
raphaelcohn/java2c
source/samples/com/stormmq/java2c/samples/Single.java
// Path: source/model/com/stormmq/java2c/model/Struct.java // public abstract class Struct extends Root // { // protected Struct() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/signed_int.java // @PrimitiveConversion("signed int") // public class signed_int extends Primitive // { // private final short value; // // // Technically, can be 16-bit, but in practice this is no longer true; it's 32-bit on 32-bit and 64-bit Linux // public signed_int(final short value) // { // this.value = value; // } // // @NotNull // public static signed_int literal(final short literal) // { // return new signed_int(literal); // } // }
import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.Struct; import com.stormmq.java2c.model.functions.*; import com.stormmq.java2c.model.primitives.char_; import com.stormmq.java2c.model.primitives.signed_int; import com.stormmq.java2c.model.variables.unsigned; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static com.stormmq.java2c.model.functions.FormatArgArchetype.printf; import static com.stormmq.java2c.model.functions.Inlining.Force; import static com.stormmq.java2c.model.functions.Purity.Constant;
@Override @inline(Force) @flatten @hot public int hashCode() { return index; } @pure(Constant) @cold public static int divideByTwo(final int value) { return value / 2; } @Deprecated private void printHello() { } @SuppressWarnings("UnusedDeclaration") private static void notUsed(@NotNull @sentinel final Object... varargs) { } // In this case, because c_signed_int is a primitive, we do not generate an __attribute__((returns_nonnull)) // Nor do we generate __attribute__((nonnull(varargs))) for varargs @NotNull
// Path: source/model/com/stormmq/java2c/model/Struct.java // public abstract class Struct extends Root // { // protected Struct() // { // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/char_.java // @PrimitiveConversion("char") // public class char_ extends Primitive // { // private final byte value; // // // In practice, this is a a signed char on Linux for x86, and unsigned for PowerPC and ARM // // Determined by ABI. The options -funsigned-char and -fsigned-char change the default. // // It is probably most sensible to only use char for strings, and avoid its use everywhere else. // // And, in using this value, to go 'the Java way' and treat it as signed (certainly, we're less likely to screw up). // public char_(final byte value) // { // this.value = value; // } // } // // Path: source/model/com/stormmq/java2c/model/primitives/signed_int.java // @PrimitiveConversion("signed int") // public class signed_int extends Primitive // { // private final short value; // // // Technically, can be 16-bit, but in practice this is no longer true; it's 32-bit on 32-bit and 64-bit Linux // public signed_int(final short value) // { // this.value = value; // } // // @NotNull // public static signed_int literal(final short literal) // { // return new signed_int(literal); // } // } // Path: source/samples/com/stormmq/java2c/samples/Single.java import com.stormmq.java2c.model.primitives.Pointer; import com.stormmq.java2c.model.Struct; import com.stormmq.java2c.model.functions.*; import com.stormmq.java2c.model.primitives.char_; import com.stormmq.java2c.model.primitives.signed_int; import com.stormmq.java2c.model.variables.unsigned; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static com.stormmq.java2c.model.functions.FormatArgArchetype.printf; import static com.stormmq.java2c.model.functions.Inlining.Force; import static com.stormmq.java2c.model.functions.Purity.Constant; @Override @inline(Force) @flatten @hot public int hashCode() { return index; } @pure(Constant) @cold public static int divideByTwo(final int value) { return value / 2; } @Deprecated private void printHello() { } @SuppressWarnings("UnusedDeclaration") private static void notUsed(@NotNull @sentinel final Object... varargs) { } // In this case, because c_signed_int is a primitive, we do not generate an __attribute__((returns_nonnull)) // Nor do we generate __attribute__((nonnull(varargs))) for varargs @NotNull
private static signed_int myPrintf(@NotNull final Pointer<signed_int> something, @NotNull @format_arg final Pointer<char_> my_format, @NotNull @format(printf) Object... varargs)
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor {
@NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")};
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttributeParameter.java // public final class GccAttributeParameter implements Writable // { // @NotNull private final String value; // // public GccAttributeParameter(@NotNull final String value) // { // this.value = '"' + value + '"'; // } // // public GccAttributeParameter(final int value) // { // assert value >= 0; // this.value = Integer.toString(value); // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(value); // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java import com.stormmq.java2c.model.variables.aligned; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttributeParameter; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.lang.model.element.VariableElement; import java.util.Collection; import static com.stormmq.java2c.model.variables.aligned.BiggestAlignment; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public final class AlignmentFieldAttributesProcessor extends AbstractFieldAttributesProcessor { @NotNull private static final GccAttributeParameter[] BiggestAlignmentParameters = new GccAttributeParameter[]{new GccAttributeParameter("__BIGGEST_ALIGNMENT__")}; @NotNull private static final GccAttributeParameter[] NoAttributeParameters = new GccAttributeParameter[0]; @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); private AlignmentFieldAttributesProcessor() { } @Override
public void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AbstractFieldAttributesProcessor.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import java.lang.annotation.Annotation; import static java.lang.String.format; import static java.util.Locale.ENGLISH;
package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public abstract class AbstractFieldAttributesProcessor implements FieldAttributesProcessor { protected AbstractFieldAttributesProcessor() { } protected static <A extends Annotation> boolean hasAnnotation(@NotNull final Element element, @NotNull final Class<A> annotation) { return element.getAnnotation(annotation) != null; } @NotNull
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/ConversionException.java // public final class ConversionException extends Exception // { // public ConversionException(@NotNull final String message) // { // super(message); // } // // public ConversionException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AbstractFieldAttributesProcessor.java import com.stormmq.java2c.transpiler.conversion.elementConverters.ConversionException; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import java.lang.annotation.Annotation; import static java.lang.String.format; import static java.util.Locale.ENGLISH; package com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors; public abstract class AbstractFieldAttributesProcessor implements FieldAttributesProcessor { protected AbstractFieldAttributesProcessor() { } protected static <A extends Annotation> boolean hasAnnotation(@NotNull final Element element, @NotNull final Class<A> annotation) { return element.getAnnotation(annotation) != null; } @NotNull
protected final ConversionException newConversionException(@NotNull final VariableElement field, @NotNull final String message)
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // }
import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import org.jetbrains.annotations.NotNull; import javax.tools.DiagnosticListener; import javax.tools.JavaFileObject;
package com.stormmq.java2c.transpiler.warnings; public interface Warnings extends DiagnosticListener<JavaFileObject> {
// Path: source/transpiler/com/stormmq/java2c/transpiler/javaModules/FatalCompilationException.java // public final class FatalCompilationException extends Exception // { // public FatalCompilationException(@NotNull final String message) // { // super(message); // } // // public FatalCompilationException(@NotNull final String message, @NotNull final Exception cause) // { // super(message, cause); // } // } // Path: source/transpiler/com/stormmq/java2c/transpiler/warnings/Warnings.java import com.stormmq.java2c.transpiler.javaModules.FatalCompilationException; import org.jetbrains.annotations.NotNull; import javax.tools.DiagnosticListener; import javax.tools.JavaFileObject; package com.stormmq.java2c.transpiler.warnings; public interface Warnings extends DiagnosticListener<JavaFileObject> {
void fatal(@NotNull final FatalCompilationException cause);
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors (
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors (
NullCheck,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck,
Deprecated,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated,
Unused,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused,
Alignment,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment,
ThreadLocalModel,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment, ThreadLocalModel,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment, ThreadLocalModel,
Section,
raphaelcohn/java2c
source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor();
import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList;
package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment, ThreadLocalModel, Section,
// Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/GccAttribute.java // public final class GccAttribute<N extends Enum<N> & AttributeName> implements Writable // { // @NotNull private final N name; // @NotNull private final GccAttributeParameter[] gccAttributeParameters; // // public GccAttribute(@NotNull final N name, @NotNull GccAttributeParameter... gccAttributeParameters) // { // this.name = name; // this.gccAttributeParameters = gccAttributeParameters; // } // // public void write(@NotNull final Writer writer) throws IOException // { // writer.write(name.name()); // if (gccAttributeParameters.length != 0) // { // writer.write(" ("); // boolean afterFirst = false; // for (GccAttributeParameter gccAttributeParameter : gccAttributeParameters) // { // if (afterFirst) // { // writer.write(", "); // } // else // { // afterFirst = true; // } // gccAttributeParameter.write(writer); // } // writer.write(')'); // } // } // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/c/gccAttributes/variable/GccVariableAttributeName.java // public enum GccVariableAttributeName implements AttributeName // { // aligned, // cleanup, // common, // nocommon, // deprecated, // mode, // packed, // section, // tls_model, // unused, // used, // vector_size, // weak, // ; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/FieldAttributesProcessor.java // public interface FieldAttributesProcessor // { // void processField(@NotNull final Collection<GccAttribute<GccVariableAttributeName>> gccAttributes, @NotNull final VariableElement field) throws ConversionException; // } // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/AlignmentFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Alignment = new AlignmentFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/DeprecatedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Deprecated = new DeprecatedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/NullCheckFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor NullCheck = new NullCheckFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/PackedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Packed = new PackedFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/SectionFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Section = new SectionFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/ThreadLocalModelFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor ThreadLocalModel = new ThreadLocalModelFieldAttributesProcessor(); // // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/fieldAttributesProcessors/UnusedFieldAttributesProcessor.java // @NotNull public static final FieldAttributesProcessor Unused = new UnusedFieldAttributesProcessor(); // Path: source/transpiler/com/stormmq/java2c/transpiler/conversion/elementConverters/FieldAttributesProcessors.java import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.GccAttribute; import com.stormmq.java2c.transpiler.conversion.c.gccAttributes.variable.GccVariableAttributeName; import com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.FieldAttributesProcessor; import org.jetbrains.annotations.NotNull; import javax.lang.model.element.VariableElement; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.AlignmentFieldAttributesProcessor.Alignment; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.DeprecatedFieldAttributesProcessor.Deprecated; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.NullCheckFieldAttributesProcessor.NullCheck; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.PackedFieldAttributesProcessor.Packed; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.SectionFieldAttributesProcessor.Section; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.ThreadLocalModelFieldAttributesProcessor.ThreadLocalModel; import static com.stormmq.java2c.transpiler.conversion.elementConverters.fieldAttributesProcessors.UnusedFieldAttributesProcessor.Unused; import static java.util.Arrays.asList; package com.stormmq.java2c.transpiler.conversion.elementConverters; public final class FieldAttributesProcessors { @NotNull public static final FieldAttributesProcessors StaticFieldAttributesProcessors = new FieldAttributesProcessors ( NullCheck, Deprecated, Unused, Alignment, ThreadLocalModel, Section,
Packed