text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void keyPressed(KeyEvent e)
{
// 37 venstre
// 39 højre
// 38 op
// 40 ned
if(e.getKeyCode() == 37 || e.getKeyCode() == 38) // positive
ClientApp.getClientApp().movePlayerPositive();
if(e.getKeyCode() == 39 || e.getKeyCode() == 40) // negative
ClientApp.getClientApp().movePlayerNega... | 4 |
@Override
public void onEvent(Event event) {
// If this event happens to be a ScannedRobotEvent...
if (event instanceof ScannedRobotEvent) {
onScannedRobot((ScannedRobotEvent) event);
}
} | 1 |
public int buscaBinaria (String fragmento) {
Node<Contact> nodo = this.sortList.getHead();
List<Contact> lista = new ArrayList<Contact>();
Contact encontrou = null;
int comparacoes = 0;
while (nodo != null) {
lista.add(nodo.getData());
nodo = nodo... | 9 |
public Object get_swizzler(final int vn) {
final Iterator iter = IndStore.values().iterator();
while (iter.hasNext()) {
final Swizzler swz = (Swizzler) iter.next();
if ((swz.target().valueNumber() == vn)
|| (swz.ind_var().valueNumber() == vn)) {
return swz;
}
}
return null;
} | 3 |
public static void main(String[] args) {
int ran=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el rango del vector"));
int[] arreglo=new int[ran];
for (int i = 0; i < arreglo.length; i++) {
int numero=Integer.parseInt(JOptionPane.showInputDialog(... | 9 |
public boolean isValid() {
boolean okay = true;
// System.out.println("Horizontal? : " + horizontal);
int checkIter = shipSize;
if (shipSize == 1) {
checkIter = 3;
}
// System.out.println("checkIter: " + checkIter);
if (horizontal == false) {
int yCoor = ship.getY();
// System.out.println("Chec... | 7 |
public boolean filter(Reaction R, int option, int arg ){
boolean result = false;
switch(option){
case 0:
if(R.getCount() > arg){
result = true;
}
break;
}
return result;
} | 2 |
public void setInterpolatorModel(InterpolatorModel interpolatorModel) {
this.interpolatorModel = interpolatorModel;
} | 0 |
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... | 7 |
public double getMarkerWidth()
{
return markerRect.getWidthCoordinates();
} | 0 |
public void setState(State s) {
switch (s) {
case COVERED:
setIcon(Icon.COVERED.image);
break;
case FLAGGED:
setIcon(Icon.FLAG.image);
break;
case QUESTIONED:
setIcon(Icon.QUESTION.image);
... | 6 |
public static List<Class<?>> getAllInterfaces(Class<?> c)
{
ArrayList<Class<?>> res = new ArrayList<Class<?>>();
if (c != null)
{
if (c.isInterface())
{
res.add(c);
}
Class<?>[] interfaces = c.getInterfaces();
for (Class<?> intf : interfaces)
{
res.addAll(getAllInterfaces(intf));
}
... | 9 |
public void drawRoute(Graphics g) {
Graphics2D routeUI = (Graphics2D) g;
//routeUI.setBackground(Color.WHITE);
boolean first = true;
int counter = 0;
int test = r.size()-1;
for (Knooppunt eenKnooppunt : this.r) {
if (first == true) {
routeUI.... | 3 |
public void disconnected(Connection con){
if(client_connected && con.getID() == conID){
//start broadcasting
if(bcast_enabled){
bcast = new Broadcaster();
new Thread(bcast).start();
}
client_ip = "---.---.---.---";
client_connected = false;
conID = 0;
changedStatus();
c... | 3 |
private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) {
if(transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for(int i = 1, n = curLine.length; i < n; i ... | 6 |
public String print() {
switch(type) {
case REGISTER:
case VREGISTER:
return value_register.name();
case IMMEDIATE4:
case IMMEDIATE8:
return "" + value_immediate;
case LABEL:
return value_label;
... | 6 |
public String getTitel() {
return titel;
} | 0 |
@Override
public void run() {
DisconnectCause disconnectCause = DisconnectCause.OTHER;
try {
while (true) {
Object msg = null;
try {
msg = queue.take();... | 8 |
public void setDisciplina(String sigla, String designacao, Tempo horasteoricas, Tempo horaspraticas) {
setSigla(sigla);
setDesignacao(designacao);
setHorasteoricas(horasteoricas);
setHoraspraticas(horaspraticas);
} | 0 |
private HashSet<String> getStopwords(HashSet<String> stopHash, String file){
try{
FileReader fReader = new FileReader(file);
BufferedReader bReader = new BufferedReader(fReader);
String line = null;
while((line = bReader.readLine().trim()) == null){
if(stopHash.contains(line)){
continue;
}
... | 3 |
public boolean go(String loginUser, String loginPass)
{
try {
st = con.createStatement();
prepState = con.prepareStatement("SELECT * FROM register WHERE Username = ? AND Password = ?");
prepState.setString(1,loginUser);
prepState.setString(2,loginPass);
ResultSet rs = prepState.executeQuery();
... | 4 |
public void addLload(int n) {
if (n < 4)
addOpcode(30 + n); // lload_<n>
else if (n < 0x100) {
addOpcode(LLOAD); // lload
add(n);
}
else {
addOpcode(WIDE);
addOpcode(LLOAD);
addIndex(n);
}
... | 2 |
public void addPattern(String pattern) {
for (int i = 0; i < pattern.length(); i++) {
if (pattern.charAt(i) == '*') {
restarts.add(true);
} else if (pattern.charAt(i) == '.') {
restarts.add(false);
}
}
} | 3 |
@EventHandler
public void SnowmanSlow(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Snowman.Slow.... | 6 |
public static void town(Character character, Scanner console) throws FileNotFoundException{
System.out.print("Where would you like to go? Shop, Inn, or Quest: ");
String location = console.nextLine();
if(location.toLowerCase().equals("shop")) {
shop(character, console);
} else if(location.toLowerCase().equal... | 3 |
public ModelAndView PostURIParser(HttpServletRequest request, HttpServletResponse response)
{
String URI = request.getRequestURI();
ModelAndView MAV = null;
Matcher match = this.P.matcher(URI);//threads
Matcher match2 = this.P2.matcher(URI);//create
Matcher match3 = this.P3.m... | 8 |
public void setup(boolean isCallDuringRun) throws Exception {
System.out.println("Simulation setup started");
Vector<Installation> insts = setupScenario();
if (insts == null)
throw new Exception("No installations defined for the current scenario.");
if (simulationWorld == null)
throw new Exception... | 7 |
private void refresh(){
if (win){
bg = draw;
draw.setColor (Color.BLACK);
draw.fill();
draw.setFont (new Font ("Times New Roman", 1, 70));
draw.setColor (Color.WHITE);
draw.drawString ("Congratulations", 270, 200);
... | 6 |
public void doGet(HttpServletRequest request, HttpServletResponse response) {
logger.finest("get request: " + request.toString());
/**
* Sanity checking -- does this request have a key?
*/
if (request.getParameter(CommunityConstants.BASE64_PUBLIC_KEY) == null) {
logger.warning("GET request with no key... | 3 |
@Override
public void doCharacterCollision(ArrayList<Collision> collisions, StageObject stageObject) {
if (stageObject instanceof Tube || stageObject instanceof Enemy || stageObject instanceof Cube) {
setAlive(false);
}
} | 3 |
public int getDepartment() {
return department;
} | 0 |
@Test
public void addingEdgeBetweenVerticesOnlyAddsOneEdge() {
Vertex a = new Vertex(0);
Vertex b = new Vertex(1);
Edge e = new Edge(a, b);
g.addVertex(a);
g.addVertex(b);
g.addEdge(a, b, 1);
assertEquals(1, g.getEdges().getSize());
} | 0 |
@SuppressWarnings("rawtypes")
public Validator getValidator() {
return validator;
} | 0 |
private void parseStyleSheets() {
if (config.has("stylesheets"))
{
for(JsonElement el: config.get("stylesheets").getAsJsonArray()) {
try {
styleSheets.add(new URL(base, el.getAsString()).toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
} | 3 |
@Override
public void keyTyped(final KeyEvent event) {
if (event.getSource().equals(myName)) {
myNameChanged = true;
}
if (event.getSource().equals(tfAddress)) {
tfAddressChanged = true;
}
if (event.getSource().equals(tfPort)) {
tfPortChanged = true;
}
if (myNameChanged && !connected) {
bCo... | 5 |
public void initClinicalsSurvival(){
//have a "load (String/Double) Column" method?
allPatients = new String[this.clinicalValues.size()];
for (int k=0; k<this.clinicalValues.size(); k++){
allPatients[k]=this.clinicalValues.get(k)[0];
}
status = new boolean[this.clinicalValues.size()];
for (int k=0; k... | 9 |
public void saveData() {
log.debug("Saving ControllerBlock data");
String dump = "# v4";
for (Iterator<CBlock> i = blocks.iterator(); i.hasNext(); ) {
CBlock cblock = i.next();
dump += "\n" + cblock.serialize();
}
try {
Writer out = new OutputStreamWriter(new FileOutputStream(this.getDataFolder() + "... | 7 |
public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... | 4 |
public void analyze() {
String type = getType();
int index = type.indexOf('L');
if (index != -1) {
int end = type.indexOf(';', index);
Main.getClassBundle().reachableClass(
type.substring(index + 1, end).replace('/', '.'));
}
} | 1 |
private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalculateActionPerformed
// TODO add your handling code here:
//Declare variables
double length = 0;
double width = 0;
double height = 0;
double radius = 0;
doubl... | 4 |
public int cdlEveningStarLookback( double optInPenetration )
{
if( optInPenetration == (-4e+37) )
optInPenetration = 3.000000e-1;
else if( (optInPenetration < 0.000000e+0) || (optInPenetration > 3.000000e+37) )
return -1;
return ((( (this.candleSettings[CandleSettingType.BodyShort... | 4 |
public static void main(String args[]) {
Counter counter = new Counter();
for (int i = 0; i < 100; i++) {
Increaser increaserTask = new Increaser(counter);
Thread t = new Thread(increaserTask);
t.start();
synchronized(t){
try{
... | 2 |
public void loadPokemonImages()
{
for (int i = 0; i < 6; i++)
{
if (partyPokemon[i] != null)
{
String pokemonType = partyPokemon[i].species.toString();
char a;
if(pokemonType.equalsIgnoreCase("Mr_Mime"))
pokemonType="Mr_Mime";
else if(pokemonType.equalsIgnoreCase("Nidoran_M"))
... | 5 |
public boolean exists(String value) {
if (!isEmpty()) {
ListElement current = head;
while (current != tail.next()) {
if (current.getValue().equals(value)) {
return true;
}
current = current.next();
}
... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Encaminhamento other = (Encaminhamento) obj;
if (!Objects.equals(this.idEncaminhamento, other.idEncaminha... | 3 |
private void runTasks() {
final Iterator<BlockData> it = blockUpdates.iterator();
final BukkitRunnable t = this;
while(it.hasNext()) {
new BukkitRunnable() {
public void run() {
synchronized(t) {
for(int i = 0; i < 4096; ++i... | 4 |
public void testPlus_int() {
Hours test2 = Hours.hours(2);
Hours result = test2.plus(3);
assertEquals(2, test2.getHours());
assertEquals(5, result.getHours());
assertEquals(1, Hours.ONE.plus(0).getHours());
try {
Hours.MAX_VALUE.plus(1);
... | 1 |
public String toString()
{
String s = new String();
s += V() + " vertices " + E() + " edges\n";
for (int v = 0; v < V(); v++)
{
s += v + ": ";
for (WeightedDirectedEdge e : adj[v])
s += e + ", ";
s += "\n";
}
return s;
} | 2 |
private void initData() {
if (DataFlowControler.getCurrentEvent().getArrangement() != null) {
HallArrangement hallarr;
if(DataFlowControler.getCurrentEvent().getArrangement().getBannersType() != null) {
styles.setSelectedItem(DataFlowControler.getCurrentEvent().getArrangement().getType());
ArrayList<St... | 6 |
boolean bounding_box_collision(int b1_x, int b1_y, int b1_w, int b1_h, int b2_x, int b2_y, int b2_w, int b2_h)
{
if ((b1_x > b2_x + b2_w - 1) || // is b1 on the right side of b2?
(b1_y > b2_y + b2_h - 1) || // is b1 under b2?
(b2_x > b1_x + b1_w - 1) || // is b2 on the right side of b1?
... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public MealyStepByStateSimulator(Automaton automaton)
{
super(automaton);
} | 0 |
public static double chiVal(double [][] matrix, boolean useYates) {
int df, nrows, ncols, row, col;
double[] rtotal, ctotal;
double expect = 0, chival = 0, n = 0;
boolean yates = true;
nrows = matrix.length;
ncols = matrix[0].length;
rtotal = new double [nrows];
ctotal = new do... | 9 |
private void actualizarTabla()
{
actualizarPagina();
List<Sesion> list = new HibernateTransaction<List<Sesion>>() {
@Override
public List<Sesion> run()
{
Criteria query = session.createCriteria(Sesion.class)
... | 5 |
private void doInit() throws Exception {
//..
//..here may be execute remoteServerCall.setMaxCallCount(???);
//..
remoteServerCall.setIdleTimeout(idleTimeout);
remoteServerCall.init();
remoteServerCall.addServerExceptionListener(new IExceptionListener() {
@Override
public boole... | 0 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... | 7 |
@Override
public int hashCounter(String line, int hashLength) {
int currentHash = line.charAt(0);
for (int i = 1; i < line.length(); i++) {
currentHash = currentHash * simpleNumber + line.charAt(i);
}
return Math.abs(currentHash % hashLength);
} | 1 |
public static byte[] mapleEncrypt(byte[] data) {
for (int j = 0; j < 6; j++) {
byte remember = 0;
byte dataLength = (byte) (data.length & 0xFF);
if (j % 2 == 0) {
for (int i = 0; i < data.length; i++) {
byte cur = data[i];
cur = ByteTool.rollLeft(cur, 3);
cur += dataLength;
cur ^= rem... | 4 |
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (category != null ? category.hashCode() : 0);
result = 31 * result + (key != null ? key.hashCode() : 0);
result = 31 * result + (value != null ? value.hashCode() : 0);
result... | 5 |
public Membre rechercherMembrePseudo(String pseudo){
for(Membre m : listeMembres){
if(pseudo.trim().equalsIgnoreCase((m.getPseudo())))
return m;
}
return null;
} | 2 |
@Override
public void draw(Mesh mesh) {
if (mesh.isLoaded()) {
if (mesh.hasShader() && settings.r_useshader)
glUseProgram(mesh.getShader().getShaderProgram());
glCallList(mesh.getId());
if (mesh.hasShader() && settings.r_useshader)
glUseProgram(0);
}
} | 5 |
public static Point addition(Point p, Point q){
Point r = new Point();
BigInteger lambda = BigInteger.ZERO;
if(!(p.getX().equals(q.getX()))){
lambda = (p.getY().subtract(q.getY()).mod(Main.ellipticCurve.getP())).multiply((p.getX().subtract(q.getX()).mod(Main.ellipticCurve.getP())).modInverse(Main.elliptic... | 9 |
public static int randomSlot(int slot,int max,int min){
max = max+1;
if(slot==0){
return (int)(Math.random()*(max-min));
}
int randomMax = (slot*(slot+1))/2;
int rand = (int)(Math.random()*randomMax);
int check = 0;
int i=0;
for(i=1;i<=slot;i++){
check+=i;
if(check>rand){
break;
}
}
... | 5 |
public TreeNode sortedListToBST(ListNode head) {
if(head ==null)
return null;
//convet to a array;
Vector<Integer> v = new Vector<Integer>();
while(head != null){
v.add(head.val);
head = head.next;
}
return buildTree(v ,0, v.size()-1);
... | 2 |
@Override
public void actionPerformed(ActionEvent e) {
BmTestManager bmTestManager = BmTestManager.getInstance();
String userKey = bmTestManager.getUserKey();
if (userKey == null || userKey.isEmpty()) {
JMeterUtils.reportErrorToUser("Please enter user key", "No user key");
... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public CE_Frame(String choose) {
this.choose = choose;
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* ... | 6 |
public static void writeToFile( String fileName, String content ) {
File file = new File( fileName );
file = new File( file.getParent() );
if ( !file.exists() )
file.mkdirs();
try {
PrintWriter pw = new PrintWriter( fileName );
pw.write( content );
... | 2 |
public void CommandExecute() throws Exception {
// TODO Remove popups.
try {
_fileOps = new File_Ops(_clientSaveDirectory, _zipSaveDir);
int cmd = _db.GetCommand(_devID);
System.out.println("Command #" + cmd);
switch (cmd) {
case 1:
// Back up
_fileOps.GenerateFileList(new File(_clientSaveDi... | 4 |
private void updatePlatterQuantities(int[] platter, int round) {
for (int i=0; i < platter.length; i++) {
if (round == FIRST) {
platter[i] -= r0_seen_fruit[i];
}
else {
platter[i] -= r1_seen_fruit[i];
}
if (platter[i] < ... | 3 |
private List<Class<?>> getAllInterfaceFromClassList(List<Class<?>> classes) {
List<Class<?>> list = new ArrayList<Class<?>>();
for(Class<?> cl: classes){
list.addAll(Arrays.asList(cl.getInterfaces()));
}
return list;
} | 6 |
@SuppressWarnings("unchecked")
public SumResult<T> extendedDensity(double p) {
T emptyTarget = (T) _bins.first().getTarget().init();
double countDensity;
T targetDensity;
Bin<T> exact = _bins.get(p);
if (p < _minimum || p > _maximum) {
countDensity = 0;
targetDensity = (T) emptyTarget... | 7 |
public void extractFeatures(InputStream in, String name, Updater updater)
throws Exception {
// Pre-process the recording and extract the samples from the audio
this.updater = updater;
double[] samples = preProcessRecording(in, name);
if(cancel.isCancel()){
throw new ExplicitCancel("Killed after loading d... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 7 |
public void run()
{
while (true)
{
if (++ticket >= setMax)
{
ticket = 1;
}
DSSUpdater.setHighLight(ticket);
if(++ticket == 4 ||ticket == 5 ||ticket == 6 ||ticket == 7 ||ticket == 8 ||ticket == 9)
{
DSSUpdater.setHighPath(ticket);
}
repaint();
... | 8 |
public HashMap<String, ArrayList<String>> getCities(String code) throws IOException{
countryCities = new HashMap<String, ArrayList<String>>();
BufferedReader reader = new BufferedReader(new FileReader("src/cities15000.txt"));
String line = null;
String cityName;
String countCode;
while ((line = reader.readL... | 5 |
private boolean versionCheck(String title)
{
if (this.type != UpdateType.NO_VERSION_CHECK)
{
if (title.split(delimiter).length == 2)
{
final String localVersion = this.plugin.getDescription().getVersion();
final String remoteVe... | 5 |
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
try
{
UserBean prueba= new UserBean();
UserBean user;
String rutForm =request.getParameter("rut");
rutForm.replaceAll("\\.", "");
int rut = Integer.... | 8 |
public static void precal() {
int root, child, lim = (1 << 19);
a = new int[lim + 1];
v = new boolean[lim + 1];
lim *= 2;
for (int i = 1; i < a.length; i++) {
root = child = 1;
while (child * 2 < lim) {
child *= 2;
if (v[root])
child++;
v[root] = !v[root];
root = child;
}
a[i]... | 3 |
public Class<?> getColumnClass(int columnIndex) {
if (temporaryColumnClass != null)
return temporaryColumnClass;
else
return getColumn(columnIndex).getClass();
} | 2 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Cart)) {
return false;
}
Cart other = (Cart) object;
if ((this.recordid == null && other.recordid != null) || (... | 5 |
public void obliviousSend(int sendTo, BigInteger M_0, BigInteger M_1) {
System.out.println("Oblivious Transfer");
// Hard coded messages M_0 and M_1
BigInteger[] M = new BigInteger[2];
M[0] = M_0;
M[1] = M_1;
if (betray) {
M[1] = M[0];
}
// Hard coded ElGamal
BigInteger p_A ... | 6 |
public void addButtons()
{
b3.setPreferredSize(new Dimension(500,100));
b3.setText(months[monthTracker]);
b3.setBackground(Color.white);
b3.addActionListener(this);
b3.setToolTipText("Month Summary");
int cr=0;
for(int r=0;r<6;r++)
{
for(int l=0;l<7;l++)
{
int k=0;
if(dateDay[dateDayIndex]==1 &&... | 8 |
public void testFactory_fromCalendarFields_null() throws Exception {
try {
LocalDate.fromCalendarFields((Calendar) null);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public static int floodFill(int r, int c) {
int area = 1;
for (int i = 0; i < dir.length; i++)
if (r + dir[i][0] >= 0 && r + dir[i][0] < size
&& c + dir[i][1] >= 0 && c + dir[i][1] < size
&& !used[r + dir[i][0]][c + dir[i][1]]
&& map[r + dir[i][0]][c + dir[i][1]] == 'W') {
used[r + dir[i][0]][... | 7 |
@Override
public String getDesc() {
return "MagicCrasher";
} | 0 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ManagerOperator frame = new ManagerOperator();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
private double dotProduct(double[] a, double[] b)
throws ClusterException {
int size = a.length;
if(size != b.length)
throw new ClusterException("Can't compute dot product on different size matrices!");
double result= 0;
for (int i=0; i<size; ++i)
result += (a[i]*b[i]);
return result;
} | 2 |
protected Set<String> filterRawInput(String rawInput) {
Set<String> outputList = new HashSet<String>();
List<String> inputList = new RawInputExtractor().extractWordList(rawInput);
for (String s : inputList)
{
if (this.validFoodFilter.isValidFood(s))
{
outputList.add(s);
}
}
return outputList;
... | 2 |
public void visit_ret(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 1 > maxLocals) {
maxLocals = index + 1;
}
if (index < 256) {
addOpcode(Opcode.opc_ret);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
addByte(Opcode.opc_ret);
addS... | 2 |
public ListNode add(ListNode l1, ListNode l2)
{
ListNode c1 = l1;
ListNode c2 = l2;
ListNode dummy = new ListNode(-1);
ListNode c3 = dummy;
int carry = 0;
while(c1!=null || c2!=null || carry>0)
{
int x = (c1==null?0:c1.val) + (c2==null?0:c2.val) + carry;
ListNode t = new ListNode(x%10);
carr... | 7 |
@Override
public void onApplicationEvent(MyCustomEventApplicationEvent myCustomEventApplicationEvent) {
listener.receive(myCustomEventApplicationEvent.getMyCustomEvent());
} | 0 |
private boolean wincheck4() {
for (int column = THREE; column < gv.getColSize(); column++) {
for (int row = 0; row < (gv.getRowSize()-THREE); row++) {
if (cells[row][column].getValue() != 0
&& cells[row][column].getValue() == cells[row + 1][column - 1]
... | 6 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static boolean WritePrefix(String hostname, String prefix)
{
Prefixes.add(hostname + " " + prefix);
try
{
BufferedWriter writer = new BufferedWriter(new FileWriter(PrefixesFile, true));
writer.write(hostname + " " + prefix + "\r\n");
writer.close();... | 1 |
void print(Node t, int n, boolean p)
{
if (p)
{
t.getCar().print(n, true);
if (t.getCdr().isPair() && (t.getCdr().getCdr() != null))
{
System.out.print(" ");
t.getCdr().getCar().print(n, true);
t.getCdr().getCdr().p... | 6 |
public static String arrayToString(Object array) {
String result;
int dimensions;
int i;
result = "";
dimensions = getArrayDimensions(array);
if (dimensions == 0) {
result = "null";
} else if (dimensions == 1) {
for (i = 0; i < Array.getL... | 7 |
public static final void remove(Path path, boolean includeRootDir) {
try {
Files.walkFileTree(path, new RecursiveDirectoryRemover(includeRootDir ? null : path));
} catch (IOException exception) {
Log.error(exception);
}
} | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Score other = (Score) obj;
if (!Objects.equals(this._pseudo, other._pseudo)) {
return false;
... | 6 |
private void createSpelprojekt() {
String sid = "";
Anstalld a = (Anstalld) cbProjektledare.getSelectedItem(); // fetch Anstalld object from combobox
int aid = a.getAid();
try {
sid = DB.getAutoIncrement("spelprojekt", "sid");
newsid = Integer.parseInt(sid);
... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.