text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static Set<Integer> kClosestElements(int[] items, int key, final int k) {
final int crossOverIndex = findCrossOverIndex(items, key, 0, items.length - 1);
System.out.println("Crossover index: " + crossOverIndex);
int left = crossOverIndex;
int right = crossOverIndex + 1;
... | 9 |
private void applyHeightScaling() {
double min = Double.MAX_VALUE, max = -Double.MIN_VALUE;
for(int x = 0; x < detail; x++) {
for(int y = 0; y < detail; y++) {
if(vert[x][y][1] < min) {
min = vert[x][y][1];
}
if(vert[x][y... | 8 |
public void music() {
File soundFile = new File("tada.wav");
AudioInputStream audioInputStream = null;
try
{
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
AudioFormat audioFormat = audioInputStream.getFormat();
... | 5 |
public void flagChildren(){
if(children!=null){
children.get(0).flag();
//System.out.println("\tChild flagged: "+children.get(0).toStringf());
children.get(1).flag();
//System.out.println("\tChild flagged: "+children.get(1).toStringf());
children.get(0).flagChildren();
child... | 1 |
@Override
@EventHandler
public void handleTeamPlayerDeath(PlayerDeathEvent e) {
if (inTeam( CTFPlugin.getTeamPlayer(e.getEntity()) )) {
System.out.println("Played died");
//set the respawn point
e.getEntity().setBedSpawnLocation(spawnLocations.get(rand.nextInt(spawnLocations.size())));
... | 4 |
public String makeMove(CardGame game, CardPanel panel) {
if (indexTo != -1) {
switch (moveTypeFrom) {
case FROM_ACE_PILES:
return makeAcePilesMove(game);
case FROM_KING_PILES:
return makeKingPilesMove(game);
c... | 5 |
public static String getFilename(String path) {
if (path == null) {
return null;
}
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path);
} | 2 |
@EventHandler
public void ZombieInvisibility(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.getZombieConfig().getDouble("Zombie.In... | 6 |
public final void method70(int i, int i_31_, byte i_32_, int i_33_,
int i_34_, int i_35_, int i_36_, byte[] is,
Class304 class304) {
if (((Class310_Sub2) this).aClass304_3896 != class304
|| ((Class310_Sub2) this).aClass68_3895 != Class68.aClass68_1183)
throw new RuntimeException();
if (i... | 7 |
public void transform(String romanNr) {
if (checkValidLetters(romanNr)) {
if (syntaxCheckToggle) {
if (!checkRomanNr(romanNr) || !checkThreeConsecLetters(romanNr)) {
System.out.println("Sintaxa incorecta");
System.exit(statusCode);
... | 7 |
public String getValue() {
return value;
} | 0 |
@Override
public void run() {
try {
if(!socket.isConnected()) return; //just for tests !!
setUserPublicFields();
synchronized (server) {
for (User user : server.userList){
if (user.userName.equals(userName)) {
... | 9 |
@Override
@XmlElement(name="id")
public int getId() {
return this.id;
} | 0 |
public static <K, V extends Comparable<? super V>> Map<K, V>
sortByValueDecending( Map<K, V> map )
{
List<Map.Entry<K, V>> list =
new LinkedList<Map.Entry<K, V>>( map.entrySet() );
Collections.sort( list, new Comparator<Map.Entry<K, V>>()
{
public int compare... | 2 |
private boolean isValidPath(String PathToFile){
if (PathToFile==null) return false;
if (PathToFile.length()<1) return false;
//if (File.isDirectory()) return false;
String FileName = getName();
if (FileName.length()<1) return false;
if (FileName.lengt... | 9 |
public static void main(String[] args)
{
try
{
// find out what pictures are stored inside your .mp3 file
MP3 mp3 = new MP3("c:\\music\\bon jovi\\livin on a prayer.mp3");
List<AttachedPicture> attachedPictures = mp3.getPictures();
// if ... | 3 |
private boolean checkDepository(String res) {
boolean flag = false;
if (formulaMap.containsKey(res)) {
//存在该目标物品的合成公式
ResourceFormula rf = formulaMap.get(res);
for (ResourceItem formulaItem : rf.getResourceFormula()) {
if (!res.equals(formulaItem.getRe... | 5 |
public confirmRemoval()
{
this.requireLogin = true;
this.addParamConstraint("id", ParamCons.INTEGER);
this.addRtnCode(405, "venue not found");
} | 0 |
@Override
protected void compute() {
Loader loader = new Loader();
try {
loader.setUrl(url);
loader.load();
} catch (Exception e) {
System.out.println(e);
}
System.out.println(i);
} | 1 |
public Object fail(NullParamFn<? extends Object> fn) {
return !this.suc ? fn.fn() : null;
} | 2 |
@Override
public void onChatComplete(Player player, String reason, Object... playerList) throws EssentialsCommandException {
// kick everyone on our list
@SuppressWarnings("unchecked")
ArrayList<Player> targetPlayers = (ArrayList<Player>)playerList[0];
String playerName = player.getName();
String playerLi... | 4 |
private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[... | 5 |
public List<String> parseXml(Text value) {
List<String> listAnchor = new ArrayList<String>();
String word=null;
String xmlString = value.toString();
String[] listTitle = xmlString.split("<anchor>");
for (int i = 1; i < listTitle.length; i++) {
int stop = listTitle[i].indexOf('<');
word=listTitle[i].sub... | 5 |
public static void main(String[] args) throws Exception{
SOP("==========Chapter 4 Trees and Graphs===");
SOP("To run: java c4 [function name] [function arguments]");
SOP("Example: java c4 q1");
SOP("");
SOP("Possible functions:");
SOP("q1\tQuestion 1");
SOP("q2\tQ... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == saveProblem) {
saveProblem();
} else if (source == saveDomain) {
saveDomain();
} else if (source == openProblem) {
openProblem();
} else if (source == exit) {
exit();
} else if (source == newProb... | 5 |
private boolean isBetterThanOptimal(ArrayList<Rod> list, int pointer) {
int currentOptimal = 0;
int currentLength = 0;
for(int i = 0; i < pointer; i++) {
currentOptimal += list.get(i).getPrice();
currentLength += list.get(i).getLength();
}
// TODO: Perform Greedy for the TEMP length
// for everything ... | 2 |
private Tela navegarTelaVisualizarDadosDocente(NavigationEvent event) {
if(dbController != null && event != null && event.getArg("Docente") != null){
Docente docente = (Docente) event.getArg("Docente");
TurmaDAO turmasDAO = new TurmaDAO(dbController);
Collection<? e... | 6 |
public boolean validateMethodCall(List<binaryExpression_AST> actualArgs) {
int argSize = 0;
if (actualArgs != null){
argSize = actualArgs.size();
}
int formalArgSize = 0;
if (formalArgs != null){
formalArgSize = formalArgs.size();
}
if (formalArgSize != argSize) {
return false;
}
if (formalAr... | 7 |
static TypeAdapter<?> getAnnotationTypeAdapter(Gson gson,
ConstructorConstructor constructorConstructor, JsonAdapter annotation) {
Class<? extends TypeAdapter<?>> adapterClass = annotation.value();
ObjectConstructor<? extends TypeAdapter<?>> constructor =
constructorConstructor.get(TypeToken.get(a... | 6 |
@Override
public String execute() throws Exception {
Member a = (Member)memberDAO.findByUsername(member.getUsername()).get(0);
if(a == null) return ERROR;
if(!a.getPassword().equals( member.getPassword()))
return ERROR;
return SUCCESS;
} | 2 |
public static Vector Reverse(Vector Vec, boolean X, boolean Y, boolean Z) {
if (X) {Vec.setX(Vec.getX()*-1);}
if (Y) {Vec.setY(Vec.getY()*-1);}
if (Z) {Vec.setZ(Vec.getZ()*-1);}
return Vec;
} | 3 |
private static String[] splitToTwoParams(String param) throws Exception{
String[] splits=param.split(",");
if(splits.length==2){//ֻ1šַûиϽṹ
return splits;
}else if(splits.length>2){//ж log(x,log(2,3)) , log(4,6)
int commaIndex=0; //ָŵ
int oddBracket=0; //ż1żһ
int spiltCommaCount=0; //ָ.
for(int i=... | 8 |
public static void printSpeed(){
DecimalFormat df = new DecimalFormat("#.000");
double calca = force/mass;
double a = calca;
distance = 0;
IO.println("> Speed Calculation for " + force + "n with " + oforce + " opposing force, at acel " + a + ", between " + itime + "s & " + ftime + "s");
IO.print("... | 5 |
public void buildMask(int width, int height)
{
fogMask = new int[width][height];
for(int i = 0;i <width;i++){
for(int j = 0; j < height;j++){
fogMask[i][j] = 0;
//ADD SOME CONVENTION
// 0 is unseen
// 1 is previously seen... | 2 |
public void mouse_released (MouseEvent evt) {
if ( (selectedCursor!=null) ) {
if (!stickyCursors.contains(selectedCursor.session_id)) {
selectedCursor.stop();
cursorMessage();
if (manager.verbose) System.out.println("del cur "+ selectedCursor.session_id);
if (jointCursors.contains(selectedCur... | 4 |
Type getRootComponent(Type type) {
while (type.isArray())
type = type.getComponent();
return type;
} | 1 |
private Point mousePosition()
{
try
{
Point mp = this.getMousePosition();
if(mp != null)
return this.getMousePosition();
else
return new Point(0, 0);
}
catch (Exception e)
{
return ne... | 2 |
public void beginPreviewMode(boolean copy) {
// !!!! awful awful hack !!! will break as soon as CPMultiUndo is used for other things
// FIXME: ASAP!
if (!copy && !undoList.isEmpty() && redoList.isEmpty() && (undoList.getFirst() instanceof CPMultiUndo)
&& (((CPMultiUndo) undoList.getFirst()).undoes[0] instance... | 6 |
private void sonificate() {
try {
if (outputFile.exists()) {
/*
* Check if chosen output file already exists. If so, we ask
* gently whether the user wants to overwrite
*/
int selected = JOptionPane.showOptionDialog(null,
String.format(props.getProperty("overwrite"),
outputFile... | 8 |
public byte[] read (Handle hdl, long offset, int count, AttributeHandler fmt) {
// check for auth data.
if (offset == 0) {
String dbUser = null, dbPassword = null;
if (dbAuth != null && dbAuth.length() > 0) {
int pos = dbAuth.indexOf (':');
if (pos != -1) {
dbUser = dbAuth.substring (0, pos);
... | 8 |
public static List<ShopInfo> getAllShops() throws HibernateException {
List<ShopInfo> shopList = null;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try {
// Begin unit of work
session.beginTransaction();
String hqlString = "select s from ShopInfo as s";
Query query = sess... | 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 |
@Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
int height = filteredImage.getHeight();
int width = filteredImag... | 6 |
@Override
public void processEntity(Entity entity) {
Spatial spatial = entity.getComponent(Spatial.class);
Velocity velocity = entity.getComponent(Velocity.class);
PlayerControlled playerControlled = entity.getComponent(PlayerControlled.class);
// Poll the event handelr and check if the key required for movin... | 6 |
public void ajErrorHiddenNode() {
double sumChildren = 0.0;
for (int t = 0; t < getOutgoingLinksNumber(); t++) { // for all neurons on next layer
sumChildren += this.getOutgoingLink(t).getOut_node().getMisalignment() * this.getOutgoingLink(t).getWeight();
}
this.setMisalignme... | 2 |
public final EsperParser.for__return for_() throws RecognitionException {
EsperParser.for__return retval = new EsperParser.for__return();
retval.start = input.LT(1);
Object root_0 = null;
Token FOR47=null;
EsperParser.forgap_return forgap48 =null;
EsperParser.statemen... | 1 |
public static void draw() {
for(Model2D m : tiles.values()) {
for(int x = 0; x<tilePos.get(m.textureNames[0]).size(); x++) {
m.drawAt((float) tilePos.get(m.textureNames[0]).get(x).getX(), (float) tilePos.get(m.textureNames[0]).get(x).getY());
}
}
} | 2 |
protected void initialize() {
String out = "addSequential(new ";
double left = Robot.driveTrain.getLeftDistance();
double right = Robot.driveTrain.getRightDistance();
double turn = Robot.driveTrain.getGyroAngle();
if ((left < 0) != (right < 0)){
out += "GyroT... | 2 |
public List<List<Integer>> subsetsWithDup(int[] num) {
if(num == null) return null;
Arrays.sort(num);
List<List<Integer>> result = new ArrayList<List<Integer>>();
result.add(new ArrayList<Integer>());
Integer pre = (Integer)null;
List<List<Integer>> preCopy = null;
for (int i = 0; i < num... | 7 |
public static void main(String[] args) throws IOException, ParserConfigurationException, SAXException {
if (args.length != 2) {
System.out.println("Usage: makedictionary [path-to-input-file] [path-to-pack-resource-folder]");
System.exit(1);
}
final File inputFile = new F... | 1 |
private void readyForTermination() {
addKeyListener(new KeyAdapter() {
// listen for esc, q, end, ctrl-c on the canvas to
// allow a convenient exit from the full screen configuration
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if ((keyCode == KeyEvent.VK_ESCAPE)
|| (keyC... | 5 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
if (action == Action.RIGHT_CLICK_BLOCK) {
if ((player.getItemInHand().getType() == Material.GOLD_AXE) && (player.isOp())) {
... | 6 |
public static boolean copyFile(String source, File destination) {
InputStream in = null;
OutputStream out = null;
try {
destination.createNewFile();
in = FileUtils.class.getResourceAsStream(source);
out = new FileOutputStream(destination);
byte[] buffer = new byte[8192];
int bytesRead;
while ((... | 6 |
public ImageIcon changeColor(BufferedImage image, Color toReplace, Color newColor, Color toReplace2, Color newColor2) {
BufferedImage destImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = destImage.createGraphics();
g.drawImage(image, nu... | 6 |
public Object nextEntity(char a) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
break;... | 5 |
public ListNode partition(ListNode head, int x) {
ListNode small = new ListNode(-1); // 添加辅助链表头 减少代码复杂度。
ListNode smallStep = small;
ListNode big = new ListNode(-1);
ListNode bigStep =big;
while(head != null){
if(head.val < x){
smallStep.next = head;
... | 2 |
@Test
public void testMenu() throws Exception {
view.getImportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent);
assertEquals(propertyName, MainWindowController.IMPORT);
view.getExportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent);
assertEquals(... | 0 |
private void visitSymbol(Symbol _sym) {
Symbol sym = _sym;
if (sym.kind == VAR || sym.kind == MTH) {
while (sym != null && sym.owner != owner)
sym = proxies.lookup(proxyName(sym.name)).sym;
if (sym != null && sym.owner == owner) {
... | 9 |
public Node getWord(String argString) {
Node node = getNode(argString.toCharArray());
return node != null && node.isWord() ? node : null;
} | 2 |
public Boolean markerIsTaken(int markerID, String hostName){
try {
cs = con.prepareCall("{call returnMarkerOwner(?,?)}");
cs.setInt(1, markerID);
cs.setString(2, hostName);
ResultSet rs = cs.executeQuery();
if(rs.next()){
return true;
}
} catch (SQLException e) {
e.printStackTrace(... | 2 |
private static void test3(){
Player p = new Player(16);
System.out.println("Test 3");
System.out.println("This one adds some cards to a players hand and then shows the hand and the value.");
for (int i = 10; i<15;i++)
{
Card c = new Card(i);
p.addCardtoHand(c);
}
System.out.print(p.stringHand());... | 1 |
public static void main(String[] args) {
String number;
boolean valid = false;
System.out.println("This is a binary to hexadecimal converter.");
while(!valid){
System.out.print("Enter a binary or hexadecimal now: ");
number = s.nextLine(... | 2 |
@Override
public void run()
{
while(true)
{
try
{
Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 1000);
if (!Agent.getConflictExists())
{
Agent.setValue(agentId, agentType);
Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 2000);
}
el... | 3 |
void encodingError(String message, int value, int offset)
throws java.lang.Exception
{
String uri;
if (value >= 0) {
message = message + " (byte value: 0x" + Integer.toHexString(value)
+ ')';
}
if (externalEntity != null) {
uri... | 2 |
public void getAtendimento(Atendimento atendimento) {
try {
txt_cliente.setText(atendimento.getCodcliente().getNomeFantasia());
if (atendimento.getDataFim() != null) {
txt_dataFim.setText(Data.getDataByDate(atendimento.getDataFim(), "dd/MM/yyyy HH:mm"));
}
... | 8 |
public final void run() {
int optionCount = this.options.size();
if (optionCount < 1) {
System.out.println(
"No options for you to choose from.");
} else {
int input = -1;
ConsoleOption selected = null;
do {
System.out.println(
"Please select one of the following option.");
for (i... | 8 |
int count(int n, int digit) {
int res = 0;
int max = 0; // max counts per digits
int more = 1; // additional counts in current length
int pre = 0; // from lower digits to higher digits, the passed 'n'
while (n > 0) {
int x = n % 10;
res += x * max;
if (x > digit) {
res += more;
} else if (x ==... | 5 |
public boolean jsFunction_waitEndMoveGob(int gob, int timeout) {
deprecated();
int curr = 0; if(timeout == 0) timeout = 10000;
while(JSBotUtils.isMoving(gob))
{
if(curr > timeout)
return false;
Sleep(25);
curr += 25;
}
return true;
} | 3 |
@Override
public void tick() {
super.tick();
Button oldSelected = selected;
selected = buttons.get(pointer);
if (oldSelected == null) {
selected.hover();
} else if (!oldSelected.equals(selected)) {
oldSelected.unHover();
selected.hover();
}
buttons.forEach(Button::tick);
} | 2 |
@Override
public void startListening() {
if (this.state == ServerState.Running) return;
try
{
this.server.bind(this.serverAddress);
this.state = ServerState.Running;
}
catch (IOException ex)
{
ex.printStackTrace();
... | 5 |
private String[][] readScore() {
String tempg = null;
try {
File file = new File(SavePath.getHighScorePath());
if(file.exists()) {
FileReader fileReader = new FileReader(file.getAbsoluteFile());
BufferedReader bufferedReader = new BufferedReader(fileReader);
tempg=bufferedReader.readLine();... | 2 |
public final void import_stmt() throws RecognitionException {
try {
// Python.g:210:13: ( import_name | import_from )
int alt37=2;
int LA37_0 = input.LA(1);
if ( (LA37_0==86) ) {
alt37=1;
}
else if ( (LA37_0==83) ) {
alt37=2;
}
else {
if (state.backtracking>0) {state.failed=true; ... | 8 |
public static int getWordCount(String str)
{
int length = 0;
if (isEmpty(str) == true) {
return length;
}
int i = 0; for (int len = str.length(); i < len; i++) {
int ascii = Character.codePointAt(str, i);
if ((ascii >= 0) && (ascii <= 255))
length++;
else {
leng... | 4 |
public PositionBox (boolean isEnemy, SelectListener selectListener, HoverListener hoverListener) {
super (null);
if (HOVER == null) {
try {
OPEN = ImageIO.read (new File (imagePath + "select_open.png"));
OPEN_BG = ImageIO.read (new File (imagePath + "select_open.png"));
LOCKED = ImageIO.read (new ... | 2 |
public static int findClosingParenRecursively(String s, int startingParenLoc) {
// check for valid parens location
int returnVal = -1;
if (errorCheck(s, startingParenLoc))
return -1;
for (int i = startingParenLoc + 1; i < s.length(); i++) {
if (s.charAt(i) == '(') {
i = findClosingParenRecursively(... | 5 |
public void checkOutDir( Directory dir, String path, OnDirCollision onDirCollision, OnFileCollision onFileCollision, Run run )
throws Exception
{
FileMetadata md = filesystem.getMetadata(path);
if( md != null ) {
switch( onDirCollision ) {
case MERGE: break; // We'll make sure it's a directory in a bit.
... | 9 |
public static <T> T obtenirDeSession(HttpServletRequest requete, String nom, Class<T> classe)
throws InvalidObjectException {
Object obj = requete.getSession().getAttribute(nom);
if (obj == null || obj.getClass().equals(classe)) {
return (T)obj;
}
... | 2 |
public void handleEvent(Event event) {
assert event != null && event.item != null;
System.out.println("triggered TreeSelectionListener.handleEvent.Event = " + event.item);
Editor editor = vermilionCascadeNotebook.getEditor();
VCNTreeItem item = editor.getTreeItem();
System.out.println("editor item = " +... | 2 |
private void showTimeForm(TimeForm form){
int result = JOptionPane.showConfirmDialog(null, form, "Ny tävlande", JOptionPane.OK_CANCEL_OPTION, JOptionPane.NO_OPTION);
if(result == JOptionPane.OK_OPTION){
if(form.isValidForm()){
Runner runner = getRunnerByStartNumber(form.getStartNumber());
... | 3 |
@Override
public void paint(Graphics2D g) {
super.paint(g);
Image image = new ImageIcon("resources/sprites/zombie1.png").getImage();
if (getFace() == 1) {
image = new ImageIcon("resources/sprites/zombie1.png").getImage();
}
if (getFace() == 2) {
image = new ImageIcon("resources/sprites/zombie2... | 8 |
public void visit(Node node) {
node.colorGrey();
Transition[] transitions = myAutomaton.getTransitionsFromState(node
.getState());
for (int k = 0; k < transitions.length; k++) {
Transition transition = transitions[k];
State toState = transition.getToState();
Node v = getNodeForState(toState);
if (... | 2 |
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._exp_ == oldChild)
{
setExp((PExp) newChild);
return;
}
for(ListIterator<PCase> i = this._case_.listIterat... | 7 |
private Collection loadFromSpreadsheet(final InputStream excelFile)
throws IOException {
XSSFWorkbook workbook = new XSSFWorkbook(excelFile);
data = new ArrayList();
Sheet sheet = workbook.getSheetAt(0);
int numberOfColumns = countNonEmptyColumns(sheet);
List ... | 3 |
public long getIdConnection() {
return idConnection;
} | 0 |
@Override
public void move(Entity e) {
if (Collided) {
byte b = affected.getAmmoType();
switch (b) {
case 0:
case 1:
case 2:
Bullet.CoolDown = 1;
Bullet.cost = 1;
break;
case 3:
Bullet.CoolDown = 10;
Bullet.cost = 1;
break;
case 4:
Bullet.CoolDown = 0;
Bullet.cost... | 8 |
public void keyPressed (KeyEvent ke) {
switch(ke.getKeyCode()) {
case KeyEvent.VK_W:
W_KEY = true;
break;
case KeyEvent.VK_UP:
UP_KEY = true;
break;
case KeyEvent.VK_A:
A_KEY = true;
... | 8 |
@Override
public void interpretar(String input) {
if (input.contentEquals("roque")) {
roque();
}
if (input.contentEquals("roqueMenor") || input.contentEquals("roquemenor")) {
roqueMenor();
}
if (input.contentEquals("roqueMaior") || input.contentEquals("roquemaior")) {
roqueMaior();
} else {
jog... | 5 |
public static TokenType[] getTokens(Instruction i) {
switch (i) {
case SENSE:
return (new TokenType[] {TokenType.SENSEDIRECTION,TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE,TokenType.SENSECONDITION});
case MARK:
return (new TokenType[] {TokenType.MARKER,TokenType.NEXTSTATE});
case UNMARK:
return (n... | 8 |
private static int pref(String op) {
int prf = 99;
//if (op.equals("")) prf = 5;
if (op.equals("*") || op.equals("+")) {
prf = 5;
}
if (op.equals("-")) {
prf = 4;
}
if (op.equals("|")) {
prf = 3;
}
if (op.equals(... | 6 |
public boolean save(final boolean save_photo_data)
throws SDKException, APIException, SignInException{
final ArrayList<ArrayList> spreadSheet = new ArrayList<>();
final ArrayList<ArrayList> photoData = new ArrayList<>();
data.put(API_KEY_COMPUTER_ID, computer_id);
da... | 6 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
Connection con = null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.... | 7 |
public static void ensureCauseChainIsSet(Throwable thr) {
if (INIT_CAUSE_METHOD == null) {
return;
}
// Loop either until null or encountering exceptions that use this method.
while (thr != null && !(thr instanceof LocatedRuntimeException) && !(thr instanceof LocatedExceptio... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
UserMap other = (UserMap) obj;
if (map == null) {
if (other.map != null) {
return false;
}
} else if (!map.equals(o... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Marker other = (Marker) obj;
if (color != other.color) {
return false;
}
if (id != other.id) {
return false;
}
re... | 5 |
public Rank getPrimaryRank() {
return (ranks.size() == 0 ? Rank.Null : ranks.get(0));
} | 1 |
public static boolean addArtistByEntireName(boolean manually, String compName) {
ArrayList<String> nameList = new ArrayList<String>();
String[] spl = compName.split(",");
String[] names = spl[0].split("\\s");
String name = names[0];
if(spl.length == 1 && names.length > 1) {
return false;
}
if(... | 9 |
private static final int getTotalGroupsSizeParallel(ArrayList<LinkedDimGroup> groups, int sType, boolean countSpanning)
{
int size = sType == LayoutUtil.MAX ? LayoutUtil.INF : 0;
for (int i = 0, iSz = groups.size(); i < iSz; i++) {
LinkedDimGroup group = groups.get(i);
if (countSpanning || group.span == 1) {... | 7 |
private void resaveParamsShowCity(SessionRequestContent request) {
String validCityStatus = request.getParameter(JSP_CITY_VALID_STATUS);
if(validCityStatus != null) {
request.setSessionAttribute(JSP_CITY_VALID_STATUS, validCityStatus);
}
String invalidCityStatus = request.ge... | 4 |
public boolean GetConfig(ConsoleCommandSender sender, String[] args) {
if (args.length < 2) {
sendMessage(sender, ChatColor.RED, "Specify setting");
return true;
}
String settingName = args[1];
ConfigManager cm = Citadel.getConfigManager();
if (settingName... | 8 |
private boolean func_46116_a(EntityAITaskEntry par1EntityAITaskEntry)
{
Iterator var2 = this.tasksToDo.iterator();
while (var2.hasNext())
{
EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next();
if (var3 != par1EntityAITaskEntry)
{
if (... | 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.