text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void mouseDrag(int x, int y){
if(movingInputTime){
node.setPosition(x);
}
} | 1 |
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
HttpSession session = ((HttpServletRequest)request).getSession(true);
Locale locale = (Locale) session.getAttribute(JSP_LOCALE);
... | 2 |
protected void addNewAciton() {
// Action type
Object typeValueItem = typeNAJcbx.getSelectedItem();
String typeValue = null;
if (typeValueItem != null ) {
typeValue = typeValueItem.toString();
}
// Claims", "Counter Claims", "Evidene", "Counter Evidence",
// "Bi-polar Questions", "Response to Bi-pol... | 9 |
@Override
public void onFirstUpdate(){
if (sound.Manager.enabled) {
sound.Event effect = new sound.Event(getPosition(), getVelocity(),sound.Library.findByName(SHOOT_EFFECT));
effect.gain = EFFECT_VOLUME;
sound.Manager.addEvent(effect);
}
if(ParticleSystem... | 2 |
protected void attachToHost() {
if (host == null)
return;
if (host instanceof Particle || host instanceof RectangularObstacle) {
switch (getAttachmentPosition()) {
case CENTER:
setLocation(host.getRx(), host.getRy());
break;
case ENDPOINT1:
float length = (float) getLength();
float invLe... | 7 |
public static void load(){
BufferedReader reader = null;
try{
if(USER_DATA_FILE.exists() == false){
//System.out.println("USER DATA DOES NOT EXIST");
USER_DATA_FILE.createNewFile();
makeAllDefault();
... | 8 |
public static String sendPost(String url, String contents,HashMap<String, String> propertyMap){
InputStreamReader inr = null;
try{
System.out.println("post>>>"+url);
URL serverUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) serverUrl.openConn... | 9 |
public void render() {
clear();
Graphics g = graphics();
if (isPushed)// modified by Kerrigan
{
if (a)
g.drawImage(up, 0, 0, null);
else if (isHovered)
g.drawImage(hover, 0, 0, null);
else
g.drawImage(dow... | 5 |
public static byte[] handshake(byte[] info_hash, byte[] peer_id){
byte[] hand_shake = new byte[68];
//<19><BitTorrent protocol><00000000>
//copy the handshake_header into the handshake message
for(int i = 0; i<handshake_header.length; i++)
hand_shake[i] = handshake_header[i];
//fill 28 - 47 with the SHA1 ... | 3 |
public boolean isSymmetricItr(TreeNode root){
ArrayDeque<TreeNode> queue1 = new ArrayDeque<TreeNode>();
ArrayDeque<TreeNode> queue2 = new ArrayDeque<TreeNode>();
queue1.offerLast(root);
queue2.offerLast(root);
while(!queue1.isEmpty() && !queue2.isEmpty()){
TreeNode n... | 8 |
public String searchTagAttributeValue(Document doc, String rootNodeName, String tag, String attributeName, boolean strict)
throws TagNotFoundException,
AttributeNotFoundException
{
NodeList nodes = doc.getElementsByTagName(rootNodeName);
try
{
DOMW... | 9 |
public boolean choqueObstaculo(int posicionX, int posicionY){
for (int i = 0; i < listaObjetos.size(); i++){
//Si es de tipo Roca y la posicion esta dentro de su perimetro no permite el movimiento
if( (listaObjetos.get(i).getTipoObjeto().getClass() == (new ObjetoRoca().getClass())) && ( (listaObjetos.get(i).ge... | 6 |
public void updateList(String remoteMachineID, MemberList incomingMemberList) {
int localIndex=-1,otherIndex=0;
String currentIP;
int localMemberListsize = this.memList.size();
int incomingMemberListsize = incomingMemberList.memList.size();
for ( otherIndex = 0; otherIndex < incomingMemberListsize; oth... | 9 |
@Override
public void update(Observable o, Object arg) {
if (!this.gm.getBoard().getWinner().equals(GameResult.GameRunning)){
endGame();
}
if (this.gm.canDraw() && (!isDrawVisable)) {
isDrawVisable = true;
int wantsDraw = JOptionPane.showConfirmDialog(
myCheckmate,
"It is possible to declare thi... | 7 |
public void run() {
long current = 0, size = totalSize();
for (Pair<File,File> pair : pairs) {
File src = pair.get1();
File dst = pair.get2();
if (src.exists() && src.isFile()) {
if (!dst.exists() || dst.isFile()) {
try {
if (dst.exists()) dst.delete();
dst.createNewFile();
pr... | 8 |
private void handleUpdate() {
if (pref instanceof PreferenceString) {
((PreferenceString) pref).setTmp((String) box.getSelectedItem());
} else if (pref instanceof PreferenceLineEnding) {
((PreferenceLineEnding) pref).setTmp((String) box.getSelectedItem());
}
} | 2 |
public List<Produto> listarTodos() throws ErroValidacaoException, Exception{
List<Produto> produtos = new LinkedList<>();
try{
PreparedStatement comando = bd.getConexao()
.prepareStatement("SELECT p.id,nome,descricao,valor_uni_Venda, "
... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person1 = (Person) o;
if (age != person1.age) return false;
if (firstName != null ? !firstName.equals(person1.firstName) : person1.first... | 8 |
public static void splitLabel(Transition transition, Automaton automaton){
FSATransition trans = (FSATransition) transition;
State from = transition.getFromState(), f = from, to = transition
.getToState();
automaton.removeTransition(trans);
String label = trans.getLabel();
for(int i=label.charAt(label.index... | 1 |
@Override
public void sort(int[] array) {
for( int i = array.length-1; i > 0; --i ) {
for( int j = 0; j < i; ++j ) {
if( array[j] > array[j+1] ) {
int swap = array[j+1];
array[j+1] = array[j];
array[j] = swap;
}
}
}
} | 3 |
protected void constBranchEliminate(Block root) {
Queue<Entry<Block, HashMap<Integer, SSAorConst>>> queue = new LinkedList<Entry<Block, HashMap<Integer, SSAorConst>>>();
HashMap<Integer, SSAorConst> propagator = new HashMap<Integer, SSAorConst>();
queue.add(new AbstractMap.SimpleEntry<Block, HashMap<Integer, SSAo... | 8 |
public static Window getWindowForComponent(Component comp) {
while (true) {
if (comp == null) {
return JOptionPane.getRootFrame();
}
if (comp instanceof Frame || comp instanceof Dialog) {
return (Window) comp;
}
comp = comp.getParent();
}
} | 4 |
public Server() {
// Show server view
serverView = new ServerView(this);
serverView.getFrame().setVisible(true);
// Start server and listen from port 1099
Rmi rmiService = null;
try {
rmiService = new RmiImpl();
Registry registry = LocateRegistry.createRegistry(1099);
registry.rebind("pcs", rmiSer... | 1 |
public void mouseClicked(MouseEvent pEvent) {
mLastMouseClickedPosition = pEvent.getPoint();
Point p = pEvent.getComponent().getLocationOnScreen();
mLastMouseClickedPosition.x += p.getX();
mLastMouseClickedPosition.y += p.getY();
TableViewAdapter adapter = (Ta... | 9 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == buttonPlay) {
wait = !wait;
}
else if (e.getSource() == buttonPrev) {
wait = true;
view.controller().prev();
view.flush();
repaint();
}
else if (e.getSource() == buttonNext) {
wait = true;
view.controller().next();
view... | 6 |
public TileMap() {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 10; y++) {
putTile(Tile.GRASS_1, x, y);
}
}
} | 2 |
protected static Instances getMiningSchemaAsInstances(Element model,
Instances dataDictionary)
throws Exception {
FastVector attInfo = new FastVector();
NodeList fieldList = model.getElementsByTagName("MiningField");
int classIndex = -1;
int a... | 8 |
private boolean jj_2_61(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_61(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(60, xla); }
} | 1 |
public boolean saveSmfUser(String user) throws ClassNotFoundException,
SQLException {
// SMF activation
sqlClass();
sqlCon();
if (!customField.isEmpty()) {
query = "SELECT id_member FROM " + tablePref
+ "themes WHERE variable='" + smfFieldValue()
+ "' AND value='" + user + "'";
ResultSet rs =... | 4 |
@Override
public Void call() {
final String timestamp = this.writer.timestamp.format(new Date());
this.markers.clear();
for (final World world : this.writer.plugin.getServer().getWorlds()) {
for (final Wolf wolf : world.getEntitiesByClass(Wolf.class)) {
if (!wolf... | 4 |
public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) {
String theId = JsfUtil.getRequestParameter(requestParameterName);
return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId);
} | 0 |
private void checkMagicChar(char expected, String position)
throws IOException {
int magic = this.in.read();
if (magic != expected) {
throw new IOException("Stream is not BZip2 formatted: expected '"
+ expected + "' as " + position + " byte but got '... | 1 |
protected void createReaderWriter() throws JoeException {
// try to create an appropriate reader-writer
ourReaderWriter = new PdbReaderWriter() ;
// if we fail ...
if (ourReaderWriter == null) {
throw new JoeException(UNABLE_TO_CREATE_OBJECT) ;
} // end if
} // end protected method PdbReaderWriter | 1 |
private static boolean isInteger(String lexeme) {
try {
return Integer.signum(Integer.parseInt(lexeme)) != -1;
} catch (NumberFormatException e) {
return false;
}
} | 1 |
public final void setDistance(double distance) {
this.distance = distance;
parametersToNumbers.put("distance", new Double(distance));
} | 0 |
public BMPImage copyPart(int x, int y, int width, int height) {
BMPImage image = new BMPImage(this);
image.imageHeader.biHeight = height;
image.imageHeader.biWidth = width;
image.fileHeader.bfSize = FILE_HEADER_SIZE + IMAGE_HEADER_SIZE + height * width;
BMPColor[][] bitmap = new... | 6 |
public void setTelefon2(String telefon2) {
this.telefon2 = telefon2;
} | 0 |
@EventHandler(priority=EventPriority.NORMAL)
public void exploded(EntityExplodeEvent event) {
Iterator<Block> i = event.blockList().iterator();
List<Block> blockToHandleList= new LinkedList<Block> ();
while(i.hasNext())
{
Block block = (Block)i.next();
CustomBlock cblock = this.plugin.getCustomBlock(blo... | 4 |
private void createReferenceFile(final ObjectStreamClass osc) {
final File referenceDir = context.getReferenceBaseDir();
final File referenceFile = new File(new File(referenceDir, osc.getName()), Long
.toString(osc.getSerialVersionUID())
+ ".ser");
... | 8 |
public void print(List<String> IdsToStrings,String pad) {
Iterator<T> biIter=BigramCounts.keySet().iterator();
T myValue;
UnigramCountsModel<K> model;
int getVal;
if (pad==null) {
pad="";
}
while (biIter.hasNext()) {
myValue=biIter.next();
model=BigramCounts.get(myValue);... | 5 |
public void removeTray(Tray tray) {
if (this.trays.contains(tray)) {
this.trays.remove(tray);
tray.setStorageUnit(null);
}
} | 1 |
private Object[] readIndexTenor(XMLStreamReader2 streamReader) throws XMLStreamException {
Integer periodMultiplier = null;
PeriodEnum period = null;
int startingDepth = streamReader.getDepth();
while(streamReader.hasNext()) {
switch(streamReader.next()) {
case XMLEvent.START_ELEMENT:
... | 7 |
void decorate(AbstractAxisChart chart) {
chart.setTitle(title);
chart.setSize(plotSizeX, plotSizeY);
int gridx = (maxX - minX) / 10;
int gridy = (maxY - minY) / 10;
if( (gridx > 0) && (gridy > 0) ) chart.setGrid((maxX - minX) / 10, (maxY - minY) / 10, 3, 2);
// Adding axis info to chart.
chart.addXAxisL... | 2 |
public long getDaysOlder(String personA, String personB) throws Exception {
String[] personDataA = getPersonData(personA);
String[] personDataB = getPersonData(personB);
long agePersonA = getDaysFromSeconds(getAgeInSeconds(personDataA[DOB_INDEX]));
long agePersonB = getDaysFromSeconds(ge... | 0 |
public void showItem(Item item)
{
//when messing with craft book selector w/o item first loaded
if (item == null)
{
return;
}
currentItem = item;
//CraftIntoPanel treats all Items equally.
guiCraftIntoPanel.craftTable.setData(item);
//Casting for CraftComponentPanel and ItemInfoPanel.
switc... | 5 |
@Override
public boolean replicaAll(Hashtable<String, Integer> objects, String server) throws RemoteException
{
//Interface to access other server to get all objects
InterfaceAcesso ia = null;
//Was replicaAll a success?
boolean success = true;
//Looking for the server
try
{
ia = (InterfaceAcesso... | 4 |
void updateHitboxes(Element frame)
{
blue_hitboxes.clear();
red_hitboxes.clear();
boolean empty_red = false;
boolean empty_blue = false;
for(Node hitbox=frame.getFirstChild();hitbox!=null;hitbox=hitbox.getNextSibling())//Hitbox loop
{
if(hitbox.getNodeName().equals("Hitboxes"))... | 8 |
public String bitrate_string()
{
if (h_vbr == true)
{
return Integer.toString(bitrate()/1000)+" kb/s";
}
else return bitrate_str[h_version][h_layer - 1][h_bitrate_index];
} | 1 |
public static<X> X getMiddle(X[] a) {
return a[a.length / 2];
} | 0 |
public static DBQueryUserResult getUser(String username, String password) {
preQueryConnect();
Actions.addAction(new Action(ActionType.INFO, "User query requested for input: " + username + "."));
DBQueryUserResult userQueryResult = null;
if(username.contains("'") || username.contains("\"") || username.contains(... | 5 |
public void setCombinacion(int combinacion) {
this.combinacion = combinacion;
} | 0 |
public boolean isInitial(int c){
return Character.isLetter(c) || c == '*' || c == '/' || c == '>'||
c == '<' || c == '=' || c == '?' || c == '!' || c == '.';
} | 8 |
private static String convertNumber(String number) {
if (number.length() > 3)
throw new NumberFormatException(
"La longitud maxima debe ser 3 digitos");
// Caso especial con el 100
if (number.equals("100")) {
return "CIEN";
}
StringB... | 6 |
@Override
public void publish(LogRecord record) {
if (painted.get()) {
synchronized (lock) {
final LogEntry peek = logEntries.peekLast();
if (peek == null || !peek.text.equals(record.getMessage())) {
logEntries.offer(new LogEntry(record));
} else if (peek.text.equals(record.getMessage())) {
... | 5 |
@Override
public void setValues(Component target, int tweenType, float[] newValues) {
switch (tweenType) {
case X:
target.setLocation(Math.round(newValues[0]), target.getY());
break;
case Y:
target.setLocation(target.getX(), Math.round(newValues[0]));
break;
case XY:
target.set... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LadoSe other = (LadoSe) obj;
if (cabecalho == null) {
if (other.cabecalho != null)
return false;
} else if (!cabecalho.equals(other.cabe... | 9 |
private void processMoveFromBoard(MouseEvent e) {
int col = findCol(e.getX());
List<Card> possibleCards = game.getBoard().get(col);
int index = findCardIndex(possibleCards, e.getY(), col == 0);
if (index == -1) {
//Indicates none found.
return;
}
... | 3 |
public void mainAction()
{
ship s = getShipToPerformAction();
if(getTurnDecay() == 0)
{
s.addHardpoints(h);
}
else
{
modifyTurnDecay(-1);
}
} | 1 |
public BufMgr( int numbufs, String replacerArg ) {
numBuffers = numbufs;
frmeTable = new FrameDesc[numBuffers];
bufPool = new byte[numBuffers][MAX_SPACE];
frmeTable = new FrameDesc[numBuffers];
// Initialize the Buffer Table with empty frame descriptions
for (int i = 0; i < numBuffer... | 1 |
@Override
public void run() {
setStopped(false);
try {
while ((!Thread.currentThread().isInterrupted()) && (!isStopped())) {
Thread.sleep(IDLE_TIMEOUT / 2);
try {
if (!isStopped()) {
send(ISession.KEEPALIVE_MESSAGE, null);
}
}... | 5 |
private long readLong_slow (boolean optimizePositive) {
// The buffer is guaranteed to have at least 1 byte.
int b = buffer[position++];
long result = b & 0x7F;
if ((b & 0x80) != 0) {
require(1);
byte[] buffer = this.buffer;
b = buffer[position++];
result |= (b & 0x7F) << 7;
if ((b & 0x80) != 0) ... | 9 |
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String start(ModelMap modelMap, HttpSession session) {
List<Content> restrictedContentList = new ArrayList<>();
Integer numberOfElementsToDisplay = (contentService.getAll().size() >= 5) ? 5 : contentService.getAll().size();
... | 5 |
public boolean add(T t) {
boolean result = false;
if(array.length <= index)
{
T[] newArray = (T[])Array.newInstance(type, array.length * 2);
for(int i = 0; i < array.length; i++){
newArray[i] = array[i];
}
array = newArray;
}
array[index] = t;
index++;
result = true;
return result;
} | 2 |
public boolean equalsXMLElement(IXMLElement elt) {
if (! this.name.equals(elt.getName())) {
return false;
}
if (this.attributes.size() != elt.getAttributeCount()) {
return false;
}
Enumeration en = this.attributes.elements();
while (en.hasMoreEleme... | 9 |
public CallType getCallType() {
return callType;
} | 0 |
public static SeqDist getClosestInFile(int[] u, File file) throws IOException {
/*
* ///!!!\\\ all the sequences in the file must have the same size
*/
DnaFileReader reader = new DnaFileReader(file);
int nSeq = reader.totalNumberofSeq();
int[] bestSeq = null, curSeq = null;
int bestDist = Integer.MA... | 8 |
private String getNameforNum(int n) {
//SWAP 1 TEAM 5.
/*
* QUALITY CHANGES
* Looked things up and found an easier way to do days of the week; a lot easier to understand
* while compressing 20 lines of useless duplicate code.
*/
if(n == 1) {
return "Sunday";
} else if (n > 1 && n <= 7){
retur... | 3 |
private void calculateGreatMargin(Double fieldA, Double factor) {
if((ourProportion.compareTo(fieldA) <= 0) && ((purchaseCost.compareTo(0.0) != 0) ? minMarginOnPosition.compareTo((minCostOnAll - 0.02) / purchaseCost * 100.0 - 100.0) < 0 : minMarginOnPosition.compareTo(0.0) < 0)) {
if(settlementCost.... | 8 |
private void notifyListeners(AccessToken token) {
for (TokenRetrievedListener listener : mListeners)
if (listener != null)
listener.notify(token);
} | 2 |
@Deprecated
public static final Object getMethodValue(OgnlContext context, Object target, String propertyName)
throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
{
return getMethodValue(context, target, propertyName, false);
} | 9 |
public double rawAllResponsesStandardDeviation(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawAllResponsesStandardDeviation;
} | 2 |
public static void saveAs(ArrayList<String> lines) throws IOException {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Save file as? ");
int result = chooser.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
File file = chooser.ge... | 2 |
private final void calcGaps(ComponentWrapper before, CC befCC, ComponentWrapper after, CC aftCC, String tag, boolean flowX, boolean isLTR)
{
ContainerWrapper par = comp.getParent();
int parW = par.getWidth();
int parH = par.getHeight();
BoundSize befGap = before != null ? (flowX ? befCC.getHorizontal() :... | 8 |
public void setModel(Model model) {
setSimulation(false);
if (this.model != null) {
this.model.unregisterListener(this);
}
this.model = model;
final boolean isModelPresent = model != null;
fileSave.setEnabled(isModelPresent && model.hasBackingFile());
... | 4 |
private char escapedStringChar(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException {
char var3 = (char)var1.read();
char var2;
switch(var3) {
case 34:
var2 = 34;
break;
case 47:
var2 = 47;
break;
case 92:
va... | 9 |
private void loginSuccess() {
if (user != null) {
System.out.println("username: " + user.getUsername());
this.setVisible(false);
if (user.getRole().equals("Tutor")) {
TutorGUI tutorGUI = new TutorGUI(user);
tutorGUI.setSize(880, 500);
tutorGUI.setLocation(250, 100);
tutorGUI.setTitle("Debate"... | 4 |
@Test
public void testGetInstruction() throws IOException {
System.out.println("getInstruction");
String antBrainFile = "cleverbrain1.brain";
AntBrain instance = new AntBrain(antBrainFile);
int currState = 0;
Sense expResult = new Sense(Sense.dirFromString("here"),32, 1,Sense... | 0 |
static private DamageCause getType(String str) {
// Renamed
if (str.equalsIgnoreCase("burning")) {
return DamageCause.FIRE_TICK;
}
// By Name
DamageCause[] types = getTypes();
for (int i = 0; i < types.length; i++) {
if (types[i].name().equalsIgnoreCase(str)) return types[i];
}
for (int i = ... | 7 |
public static InformationStatusEnum fromString(String v) {
if (v != null) {
for (InformationStatusEnum c : InformationStatusEnum.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
public FloodWorld(Player.PlayerType playerType) {
super(80, 80, 10);
backgroundMusic.playLoop();
setPaintOrder(MuteButton.class, Overlay.class, Counter.class, Coins.class, MenuBar.class, Player.class, Bag.class, Coin.class, Water.class, Floodbank.class);
for(int i=0; i<=80; i++) {
... | 6 |
public Element parseElement(Scanner in) throws IOException {
in.read();
if (in.isSymbol("%")) {
return parseReference(in, new IntegerElement());
} else if (in.isSymbol("$")) {
return parseReference(in, new StringElement());
} else if (in.isSymbol("*")) {
... | 8 |
@Override
public String toString() {
return describeNode();
} | 0 |
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
switch(key) {
case KeyEvent.VK_F2 :
if(!this.live) {
this.live = true;
this.life = 100;
}
break;
case KeyEvent.VK_LEFT :
bL = true;
break;
case KeyEvent.VK_UP :
bU = true;
break;
case KeyEvent.VK_RIGHT :
bR = true... | 6 |
private int[] maxOneTimeShortProfit(int[] prices, int start, int end) {
int bestBuy = -1, bestSell = -1, bestProfit = 0;
int currentHigh = start;
for (int i = start; i < end; i++) {
int price = prices[i];
if (i < end - 1 && price > prices[i + 1]) {
if (p... | 7 |
private static void unmarshal() throws JAXBException, FileNotFoundException {
JAXBContext context = JAXBContext.newInstance(AtomicValidator.class, UnaryLogicalNotOperator.class,
BinaryLogicalAndOperator.class, BinaryLogicalOrOperator.class, BinaryEqualsOperator.class, BinaryValidator.class);
System.out.println(... | 0 |
public void setId(int id)
{
this.id = id;
} | 0 |
@Override
protected void processMouseMotionEvent(MouseEvent event) {
mInAutoscroll = getAutoscrolls() && event.getID() == MouseEvent.MOUSE_DRAGGED;
super.processMouseMotionEvent(event);
mInAutoscroll = false;
} | 1 |
private void playNight() {
doVoice(false);
if (firstNight) {
firstNight = false;
bot.sendMessage(gameChan, getFromFile("FIRSTNIGHT", NARRATION));
} else {
bot.sendMessage(gameChan, Colors.DARK_BLUE + getFromFile("NIGHTTIME", NARRATION));
}
if (players2.numWolves() == 1) {
bot.sendMessage(gameChan... | 3 |
public void processMouseMotionEvent(MouseEvent event) {
transformMouseEvent(event);
super.processMouseMotionEvent(event);
} | 0 |
public int removeDuplicates(int[] A) {
if (A == null || A.length == 0)
return 0;
int current = A[0];
int step = 0;
for (int i = 1; i < A.length; i++) {
if(A[i] == current)
step ++ ;
else{
A[i -step] = A[i];
... | 4 |
public int getStrength(){
int value = 0;
for (Armor armor : armorList) {
if(armor != null) value += armor.getStats().getStrength();
}
return value;
} | 2 |
@Override
public void onCollision(Player player) {
if(canPickUp()){
pickup();
player.energy += amount;
player.points += 5;
player.energy = Math.min(player.energy, Constants.MAX_ENERGY);
}
} | 1 |
public static int getScaledX(int xPosition, float tileX) {
float dist = Math.abs(xPosition - tileX);
float pos = dist - TILE_SCALE_FACTOR * dist * (dist - 1) / 2f;
if (dist > SCALE_LIMIT_DIST)
if (xPosition < tileX)
return scaledXDistRight + ((int) dist - SCALE_LIMIT_DIST);
else
return scaledXDistL... | 3 |
public static void main(String[] args) {
//配置一些用到的东西
ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
ByteBuffer buffer = ByteBuffer.wrap("hello world chiand".getBytes());
ByteBuffer randomBuffer;
CharsetDecoder charsetDecoder = Charset.defaultCharset().newDecoder();
//... | 9 |
@Override
public void processNPC() {
super.processNPC();
List<WorldObject> objects = World.getRegion(getRegionId()).getSpawnedObjects();
if (objects != null) {
final HunterNPC info = HunterNPC.forId(getId());
int objectId = info.getEquipment().getObjectId();
for (final WorldObject object : objects) {
... | 7 |
public TableauState (Tableau t) {
dungeon = new Card[t.dungeon.length - 1];
for (int i=0; i < dungeon.length; i++) {
dungeon[i] = t.dungeon[i].top();
}
dungeonDeck = t.dungeon[t.dungeon.length - 1].size();
for (CardPile p : t.heroes) {
if (p == null)
continue;
if (p.size() == 0)
con... | 9 |
private String Complement(String binaryString)
{
StringBuilder complementBuilder = new StringBuilder(binaryString);
for(int i = 0; i < binaryString.length(); ++i)
{
char flip = binaryString.charAt(i) == '0' ? '1' : '0';
complementBuilder.setCharAt(i, flip);
}
return complementBuilder.toString();
... | 2 |
private void getColor() {
color = new int[] { 0xFF111111, 0xFF000000, 0xFFC2FEFF };
switch (random.nextInt(8)) {
case 0: {
// red color
color[1] = 0xFFFF0000;
break;
}
case 1: {
// gold color
color[1] = 0xFFCFB53B;
break;
}
case 2: {
// blue color
color[1] = 0xFF005AFF;
break;
... | 7 |
public void rightMultiplyBy(Matrix that) {
double[][] values = new double[3][3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
values[i][j] = this.m[i][0] * that.m[0][j] + this.m[i][1]
* that.m[1][j] + this.m[i][2] * that.m[2][j];
setComponents(values);
} | 2 |
public MonsterAttributes() {
// TODO Auto-generated constructor stub
} | 0 |
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.