text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void readNumber() {
boolean hex = false;
int start = column - 1;
/* special case for hex numbers */
if (line.charAt(start) == '0' && line.charAt(column) == 'x') {
column++;
hex = true;
}
while (column < line.length()) {
char c = line.charAt(column);
if (!Character.isDigit(c)) {
... | 9 |
public void EliminaFinal ()
{
if ( VaciaLista())
System.out.println ("No hay elementos");
else
{
if (PrimerNodo == PrimerNodo.siguiente)
PrimerNodo = null;
else
{
NodosProcesos Actual =PrimerNodo;
while (Actual.siguiente.siguiente != PrimerNodo)
Actual = Actual.siguiente;
Actua... | 3 |
public int get(final int index) {
final int i0 = index >>> 23;
final int[][] map1;
if (i0 != 0) {
if (map == null)
return NOT_FOUND;
map1 = map[i0];
if (map1 == null)
return NOT_FOUND;
} else
map1 = map10;
final int[] map2 = map1[(index >>> 12) & 0x7ff];
if (map2 == null)
return NO... | 4 |
public static void main(String[] args) {
if(args.length < 1){
System.err.println("Usage: java SudokuSolver intput-file.txt");
System.exit(0);
}
Puzzle sudoku = new Puzzle(3);
try {
sudoku.populatePuzzle(args[0]);
System.out.println(sudoku.toString());
... | 3 |
private void jTextField6FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField6FocusLost
boolean es_componente=false;
int i=0;
Component[] components = jPanel3.getComponents();
while ((!es_componente)&&(i<components.length)){
if (components[i]=... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof Tuple<?, ?>)) {
return false;
}
Tuple<?, ?> other = (Tuple<?, ?>) obj;
return equal(first, other.getFirst())
&& equal(second, other.getSecond());
} | 9 |
private static void deal() {
deck.shuffle();
System.out.println("Shuffled");
for (int i = 0; i < 26; i++) {
for (int j = 0; j < hands.length; j++) {
hands[j].put(deck.getCard());
}
}
} | 2 |
public void iniciarCarga()
{ //Utilizando Hilos
new Thread()
{
@Override
public void run()
{
int i = 0;
while (i <= 100)
{
i+=2;
Progreso.setValue(i);
t... | 2 |
private boolean checkMouse(GenericNode depart) {
if (!graph.poPornoT(depart)) {
listVarInt.put("actuel", listVarInt.get("actuel") + 1);
if (listVarInt.get("actuel") == listSouris.size()) {
listVarInt.put("actuel", 0);
}
return true;
}
... | 2 |
@Override
public void run()
{
// Synchronise on thread counter
synchronized( AsyncTransmitter.threadCount )
{
// If no other threads exist, change receiver
if( AsyncTransmitter.threadCount < 1 )
... | 7 |
@Override
public void paint(Graphics gr)
{
initDraw(gr);
switch(serverMode)
{
case graphic:
setGraphicMode();
DrawGraphicMode(gr);
break;
case text:
setTextMode();
DrawTextMode(gr);
break;
default:
break;
}
} | 2 |
public boolean canBlockSeeTheSky(int x, int y)
{
if(chunkID < 0)
{
x = 15-x;
}
if(x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length)
return false;
return y >= heightMap[x];
} | 5 |
private PublicKey loadPublicKey(Object publicKeyObject, boolean isCert)
throws IOException, GeneralSecurityException {
PublicKey publicKey;
if (publicKeyObject instanceof PublicKey) {
publicKey = (PublicKey)publicKeyObject;
} else if (publicKeyObject instanceof X509Certificate... | 8 |
private void loadPanel() {
Vector<String> settings = new Vector<>();
for (BaseSetting bs : BaseSetting.SETTINGS) {
settings.add(bs.getName());
}
Vector<String> generators = new Vector<>();
for (BaseGenerator bg : _setting.getGenerators()) {
generators.add(... | 4 |
public void setFields(Materie m, Node node) {
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node cNode = childNodes.item(i);
if (cNode instanceof Element) {
String content = cNode.getLastChild().getTextContent().trim();
switch (cNode.getNodeName()) {
... | 6 |
public ValueType top() throws NotExistException {
if (amount != 0) {
return head.value;
} else {
throw new NotExistException("Stack is empty!");
}
} | 1 |
private void addAllUniforms(String shaderText) {
HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText);
final String UNIFORM_KEYWORD = "uniform";
int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD);
while (uniformStartLocation != -1) {
if... | 5 |
@Override
protected void processGraph()
{
theLevels = new ArrayList<Map<Node, Graph>>(levelNodes.size());
for(Map<Node, Node> level : levelNodes)
{
// create the level
Map<Node, Graph> graphs = new HashMap<Node, Graph>();
theLevels.add(graphs);
// put the nodes in corresponding graphs
for(Map... | 7 |
protected Behaviour nextBrowsing() {
final float range = Nest.forageRange(species) * 2 ;
Target centre = mind.home() ;
if (centre == null) centre = this ;
final Batch <Flora> sampled = new Batch <Flora> () ;
world.presences.sampleFromKey(centre, world, 5, sampled, Flora.class) ;
/*
fina... | 6 |
private void rotate_nearest_y(final Image image, final Image rotated) {
// Initialization:
messenger.log("Nearest-neighbor sampling in x-z");
progressor.status("Rotating"+component+"...");
progressor.steps(odims.c*odims.t*odims.z*odims.y);
// Rotate using the inverse of the rotation matrix:
final Coor... | 9 |
public void buildTAFFile(ArrayList<String> names,
ArrayList<String> numbers,
ArrayList<String> courses) throws IOException {
File workAreaFile = new File(directory + WORK);
HashMap<String, String> workAreas = loadWorkAreas(workAreaFile);
HashMap<String, ArrayList<String>... | 9 |
@Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if((mob.isInCombat())&&(mob.fetchWieldedItem()==null))
{
final Room R=mob.location();
if((R!=null)
&&(R.findItem(null,"club")==null)
&&((R.domainType()==Room.DOMAIN_OUTDOORS_WOODS)
||((R.myResource()&RawMater... | 8 |
public PingjiaoResultVO getTeacherPjResult(CourseVO course) {
String sql =
"select "
+ "tchstatus,"
+ "sturesult "
+ "from "
+ "class "
+ "where "
+ "course_grade=? and "
+ "course_semester=? and "
+ "course_name=? and "
+ "class=? and "
+ "teacher_id=?;";
String[] paramete... | 8 |
private void updateOffsets() {
if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) {
this.xOffset = 0.0;
this.yOffset = 0.0;
}
else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) {
this.xOffset = -this.blockWidth / 2.0;
this.yOffset = 0... | 9 |
public void deleteNode(T deleteItem){
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
boolean found;
if ( first == null) //the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else{
i... | 8 |
public Object get(String key) {
return datas.get(key);
} | 0 |
void register_cont(IFCModel __model) throws Exception {
JButton[] buttons;
int _MAX;
_model = __model;
_toolbar.removeAll();
buttons = _model.exportTools();
if (buttons != null) {
_MAX = buttons.length;
for (int i=0; i... | 6 |
public int withdrawAmount(int amount){
if(amount > 0 && (bal-amount >500))
{
bal -= amount;
}
else
System.out.println("You Have Low Balance\n So You Cannot able Withdraw from your Account");
return bal;
} | 2 |
public int destinationNum()
{
if (locationEnd == null || locationEnd.length == 0)
{
return 0;
} else
{
return locationEnd.length;
}
} | 2 |
public int nextIndex() {
if (next == null) {
return size();
}
if (cache == null) {
cache = toArray();
}
return next.index;
} | 2 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == startStop){
if(playing){
playing = false;
startStop.setText("Start playing");
backButton.setEnabled(true);
stopMelody();
} else if(!playing) {
playing = true;
startStop.setText("Stop playing");
backButton.... | 4 |
protected void streamCopy (InputStream in, OutputStream out)
throws IOException {
logger.entering(getClass().getName(), "streamCopy");
byte[] buf = new byte[8192];
int bytesRead;
do {
bytesRead = in.read(buf);
if (bytesRead > 0)
out.wr... | 2 |
public String cadastrar() {
if (!nome.isEmpty() && !crm.isEmpty()) {
MedicoDAO medico = new MedicoDAO(null, nome, crm);
FacesContext contexto = FacesContext.getCurrentInstance();
if (medico.cadastrar()) {
FacesMessage mensagem = new FacesMessage("Cadastro real... | 3 |
public double standardizedPersonMinimum(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.va... | 4 |
protected void func_75208_c(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(thePlayer.worldObj, thePlayer, field_75228_b);
if (!thePlayer.worldObj.isRemote)
{
int i = field_75228_b;
float f = FurnaceRecipes.smelting().func_77601_c(par1ItemStack.itemID);
... | 8 |
private Application() {
try {
System.out.println("Wachtwoord:");
Scanner sc = new Scanner(System.in);
pw = sc.nextLine();
swt = new Thread(new Runnable() {
@Override
public void run() {
try {
... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Book other = (Book) obj;
if (!Objects.equals(this.book_ID, other.book_ID)) {
return false;
... | 7 |
public void saveShieldsBaseToFile() {
if (plugin.getListener() == null || plugin.getListener().getShields() == null) {
return;
}
if (!shieldbaseFile.exists())
{
try {
shieldbaseFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
HashMap<Block, ShieldBase> map = p... | 5 |
protected static int partition(double[] arrayToSort, double[] linkedArray, int l, int r) {
double pivot = arrayToSort[(l + r) / 2];
double help;
while (l < r) {
while ((arrayToSort[l] < pivot) && (l < r)) {
l++;
}
while ((arrayToSort[r] > pivot) && (l < r)) {
r--;
}
... | 8 |
public String getNamesOfBoxes(){
if(!checkConsolidate)this.consolidate();
String names = "";
for(int i=0; i<this.nBoxes; i++){
BlackBox bb = openPath.get(i);
names = names + i +": "+bb.getName() + " ";
}
return names;
} | 2 |
public void draw(Graphics g) {
if (first == null)
return;
java.awt.Graphics2D g2 = (java.awt.Graphics2D) g;
Stroke s = g2.getStroke();
g2.setStroke(STROKE);
g2.setColor(COLOR);
g2.drawLine(first.getPoint().x, first.getPoint().y, hover.x, hover.y);
g2.setStroke(s);
} | 1 |
private void fillField() {
LinkedList<ICard> listCardarenoteinfieldCards = new LinkedList<ICard>();
listCardarenoteinfieldCards.addAll(getUnusedCards());
for (int index = 0; index < sizeOfField; index++) {
if (this.getCardInFieldGame().get(index) == null
&& !(listCardarenoteinfieldCards.isEmpty())) {
... | 7 |
private void tokenize() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
verifyValidParenStructuring();
if(!hasBeenEvaluated) {
this.expressionList = tokenizeImpl(removeWhiteSpace(this.expressionString.toCharArray()));
}
} | 1 |
public ComputerPlayer(Game game) {
this.game = game;
} | 0 |
protected void init() throws IOException {
if (internalIn2 != null)
return;
String encoding;
byte bom[] = new byte[BOM_SIZE];
int n, unread;
n = internalIn.read(bom, 0, bom.length);
if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) ... | 9 |
private static final void drawCircleArcs(Graphics g, int x, int y, int xc,
int yc, int octant) {
switch (octant) {
// 1st Octant
case 1:
g.drawLine(y + xc, x + yc,
y + xc, x + yc);
break;
// 2nd Octant
... | 8 |
public Token getLastNonCommentNonWhitespaceToken() {
Token last = null;
for (Token t=this; t!=null && t.isPaintable(); t=t.nextToken) {
switch (t.type) {
case COMMENT_DOCUMENTATION:
case COMMENT_EOL:
case COMMENT_MULTILINE:
case WHITESPACE:
break;
default:
last = t;
break;
... | 6 |
private static void add(List<Point> points, List<Point> available, int x, int y)
{
Point p = new Point(x, y);
if (!points.contains(p) && !available.contains(p))
{
available.add(p);
}
} | 2 |
public boolean stillRoom() {
for (int i = 0; i < _board.length; i++ ) {
for (int n = 0; n < _board.length; n++) {
if (_board[i][n] == 0) {
return true;
}
}
}
return false;
} | 3 |
private void onInsertImageMenuItemClick(ActionEvent evt){
if(this.getJFileChooser().showOpenDialog(this) == JFileChooser.APPROVE_OPTION){
try {
String fullFilePath = this.getJFileChooser().getSelectedFile().getAbsolutePath();
InsertImageEventArgs args = new InsertImageEventArgs(this.getGraphics(), this.get... | 2 |
public static void fillWithExampleData(TFacade ap) {
String t1[] = { "1", "Author1", "Title1", "ISBN1", "Publisher1" };
String t2[] = { "1", "Author2", "Title2", "ISBN2", "Publisher2" };
String t3[] = { "1", "Author3", "Title3", "ISBN3", "Publisher3" };
String t4[] = { "3", "Author1", "T... | 9 |
public String row(int i)
throws Exception
{
// Gather some basic information
int th = this.top.height();
int bh = this.bottom.height();
int tw = this.top.width();
int bw = this.bottom.width();
int h = th + bh;
// Determine padding
String padtop = "";
String padbot = "";
if... | 4 |
public void onEnable() {
instance = this;
saveDefaultConfig();
tableManager = new TableManager();
if(FileIO.checkFileCreate("/FancyRoulette/", "tileslocations.bin")) {
FileIO.checkFileCreate("/FancyRoulette/", "spinnerslocations.bin");
tableManager.loadData();
}
if(! getConfig().getBoolean("opt ... | 4 |
public static void setPublicKeys(Value publicKeyValues)
{
// Checks whether the value object has the required fields.
if(!publicKeyValues.hasChildren(ValueIdentifiers.getElGamalPublicKey()) ||
!publicKeyValues.hasChildren(ValueIdentifiers.getRsaPublicKey()) ||
!publicKeyValues.getFirstChild(ValueIdentifiers.... | 6 |
@Override
public void update(int delta) {
if(currentBehaviour!= null)
this.currentBehaviour.update(delta);
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
addY(-getMoveSpeed());
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
addX(-getMoveSpeed());
}
... | 5 |
@Test
public void testQuiz1() {
Quiz quiz = Quiz.getQuizByQuizName("Bunny Quiz");
int quizID = quiz.quizID;
// General info
assertEquals(quiz.category, "Animals");
assertEquals(quiz.creator.username, "stanford");
// Update
quiz.raterNumber = 100;
quiz.totalRating = 356;
quiz.updateCurrentQuiz(); ... | 1 |
private static final int getNextMatchPosImpl(String searchFor,
String searchIn, boolean goForward,
boolean matchCase, boolean wholeWord) {
if (wholeWord) {
int len = searchFor.length();
int temp = goForward ? 0 : searchIn.length();
int tempChange = goForward ? 1 : -1;
while (true) {
i... | 8 |
public Items getHead() {
return head;
} | 0 |
public void removeBinarization(Operation op) {
for (int i = 0; i < operations.size(); i++) {
if (operations.get(i) == op) {
JCheckBox deleted = allImages.get(i);
// stergem din hashtable-uri
labelList.remove(deleted);
imageList.remove(deleted);
// stergem din panelul mare din dreapta
/... | 4 |
private double[][] computeDistanceMatrix() {
int nIntersections = 0;
double[][] s = new double[nCircles][nCircles];
for (int i = 0; i < nPolygons; i++) {
char[] c = encode(i);
for (int j = 0; j < c.length; j++) {
if (c[j] == '0')
continue;
for (int k = j + 1; k < c.length; k++) {
if (c[k] ... | 8 |
public ComplexMatrix add(ComplexMatrix b) throws Exception {
checkConsistenceAndThrowException(b);
int rowSize = getRowSize();
int colSize = getColSize();
ComplexMatrix mx = emptyMatrix(rowSize, colSize);
for (int ri = 0; ri < rowSize; ri++) {
for (int ci = 0; ci < ... | 2 |
public static Person createNewPerson(String email, String firstName, String lastName) {
if (email != null && !email.isEmpty() && firstName != null &&
!firstName.isEmpty() &&
lastName != null && !lastName.isEmpty()) {
return new Person(email, firstName, lastName);
... | 6 |
public static int sum(int a, int b) {
int carry = 0;
int sum = 0;
for( int bit = 0 ; bit < 32; bit++) {
int x = ((1<< bit) & a) != 0 ? 1: 0 ;
int y = ((1 << bit) & b) != 0 ? 1: 0;
int z = x^y;
if(z == 0) {
z = carry;
... | 7 |
public WumpusPerceptionOntology() {
super(ONTOLOGY_NAME, BasicOntology.getInstance());
try
{
add(new PredicateSchema(TYPE_NAME), WumpusPerception.class);
PredicateSchema ps = (PredicateSchema)getSchema(TYPE_NAME);
ps.add(PERCEPTION_STENCH, (Primitive... | 1 |
@Override
public void learnNetworkRules(List<Pair> learningDataset, int startRuleNum,
int endRuleNum, int epochPerRule) {
double smallestError = 0;
int bestRuleCount = 0;
for (int r = startRuleNum; r <= endRuleNum; r++) {
createRules(r);
double iterError = 0;
System.out.println("==========");
... | 4 |
public void setData(ItemCaract caract, Numeric value) {
if (caract.getNumericType() != value.getNumericType()) {
throw new IllegalArgumentException();
}
if (data.containsKey(caract.getNumericType())) {
throw new IllegalStateException();
}
data.put(caract, value);
boolean change = false;
do {
chan... | 9 |
*/
public void setPositions(Point position) {
int count = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant plant = it.next();
int x = (int) position.getX() + (count + 20);
int y = (int) position.getY() + (count + 20);
if (x > Grid.BOUND_MAX_X - 10) {
x = Grid.BOUND_MA... | 3 |
public static void Stop() {
if (Thread.currentThread() instanceof JSThread) {
JSThread current = (JSThread) Thread.currentThread();
current.jsContext.Stop();
}
} | 1 |
public Instrument next() {
Random rand = new Random();
switch(rand.nextInt(6)) {
case 0:
return new Wind();
case 1:
return new Percussion();
case 2:
return new Stringed();
case 3:
return new Brass();
case 4:
... | 6 |
public static Map<String, Field> getPreferenceFields(Object o) {
Class<?> c = o.getClass();
Field[] prefFields = c.getDeclaredFields();
Map<String, Field> fields = new HashMap<String, Field>();
for (Field field : prefFields) {
int mod = field.getModifiers();
String name = field.getName();
Class<?> typ... | 9 |
public List<Edge> getDirections(Node to)
{
directionKeys.clear();
Node[] route = calculateRoute(to).toArray(new Node[calculateRoute(to).size()]);
//HashMap<String, Double> directions = new HashMap<>();
List<Edge> listToReturn = new ArrayList<>();
for (int i = 0; i < route.length; i++)
{
int next = 0;
... | 5 |
public void setMessage(String text) {
listModel.addElement(text);
this.invalidate();
this.validate();
} | 0 |
@Override
protected void process_pipe_term_ack ()
{
// Notify the user that all the references to the pipe should be dropped.
assert (sink!=null);
sink.terminated (this);
// In terminating and double_terminated states there's nothing to do.
// Simply deallocate the pi... | 3 |
public boolean saveChunks(boolean var1, IProgressUpdate var2) {
int var3 = 0;
for(int var4 = 0; var4 < this.chunkList.size(); ++var4) {
Chunk var5 = (Chunk)this.chunkList.get(var4);
if(var1 && !var5.neverSave) {
this.func_28063_a(var5);
}
if(var5.needsSaving... | 8 |
public Berechtigung getBerechtigungzuMitarbeiter(String Benutzername) {
ResultSet resultSet;
Berechtigung rueckgabe = null;
try {
resultSet = db
.executeQueryStatement("SELECT b.* FROM Berechtigungen b, OrgaEinheiten c, Benutzer a WHERE b.idBerechtigung = c.idMitarbeiterBerechtigung AND c.idOrgaEinheit = ... | 2 |
public static <E extends ConcurrentEntry<E>> ListReport reportDeadNodes(E e) {
ListReport report = new ListReport();
for (;;) {
final E next = e.getNext();
if (next == null) {
break;
}
if (!EntryUtils.isHead(e)) {
if (EntryU... | 9 |
public void saveBlockData() {
try {
if (!isOnStart) {
if (!this.fileX.exists()) {
this.invManager.createNewFile(this.fileX, this.worldDir);
}
save(blockX, this.blockFileX);
if (!this.fileY.exists()) {
... | 5 |
private void algorithmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_algorithmButtonActionPerformed
try{
double crossChance = Float.parseFloat(crossover.getText());
double mutationChance = Float.parseFloat(mutation.getText());
int populationNum = Int... | 8 |
private String getParsedText(String lineSeperator) {
StringBuilder parsedText = new StringBuilder();
if (jtpOutputTabs.getSelectedIndex() == TEXT_TAB_INDEX) {
return jtaOutputText.getText();
} else if (jtpOutputTabs.getSelectedIndex() == LIST_TAB_INDEX) {
DefaultListModel... | 6 |
public void testForFields_datetime_YH() {
DateTimeFieldType[] fields = new DateTimeFieldType[] {
DateTimeFieldType.year(),
DateTimeFieldType.hourOfDay(),
};
int[] values = new int[] {2005, 12};
List types = new ArrayList(Arrays.asList(fields));
Dat... | 2 |
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 Collection<Quaternion> generateSymmetryGroup3D(
final List<Quaternion> generators) {
int newElems = 0;
Set <Quaternion> group = new HashSet<Quaternion>(generators);
Set<Quaternion> newGroupelem = new HashSet<>();
Quaternion z;
do {
newElems = 0;
for (Quaternion x : gr... | 6 |
private void playCard(TurnContext state) {
putCard(state);
if (state.currentPlayable.isEmpty())
if (state.g.canDraw())
state.selection = null; //end the turn
else if (state.currentPlayable == getHand())
if (!getFaceUp().isEmpty())
switchToFaceUp(state);
else if (!getFaceDown().isEmpty())
... | 7 |
@Override
protected Object decode(ChannelHandlerContext Handler, Channel Channel, ChannelBuffer Buffer)
{
try
{
if (Buffer.readableBytes() < 5)
{
return null;
}
int BufferIndex = Buffer.readerIndex();
Session Habbo = Grizzly.GrabHabboHotel().GrabSessionHandler().GrabSession(Channel);
... | 4 |
public static void demote(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
if (tree.getYoungestInSelection().isFirstChild()) {
return;
}
// Put the Undoable onto the UndoQueue
Node targetNode = tree.getYoungestInSelection().prevSibling();
CompoundUndoableMove undoable = new CompoundUndoabl... | 5 |
public boolean canAttackCell(Unit attackingUnit) {
// attackable unit
if (getUnit() != null) {
// check not on friendly teams
if (!Teams.getTeamFriends(
Teams.getTeamOfPlayer(attackingUnit.getOwner())).contains(
getUnit().getOwner(... | 4 |
@SuppressWarnings("deprecation")
public void showMonitor(final User target, final User receiver) {
if (target == null)
return;
try {
final BankAccount acc = Economy.getInstance().getAccount(target);
final Player player = receiver.getPlayer();
if (acc == null) {
player.sendMessage(lang.ge... | 5 |
@Test
public void drawLineVertical(){
Whiteboard wb = new Whiteboard();
Color newColor = new Color(100, 2, 50);
Color white = new Color();
ArrayList<Point> expectedPoints = new ArrayList<Point>();
for (int i = 300; i < 301; i ++){
for (int j = 200; j < 501; j ++){... | 7 |
protected int widestDim(double[][] nodeRanges, double[][] universe) {
final int classIdx = m_Instances.classIndex();
double widest = 0.0;
int w = -1;
if (m_NormalizeNodeWidth) {
for (int i = 0; i < nodeRanges.length; i++) {
double newWidest = nodeRanges[i][WIDTH] / universe[i][WIDTH];
... | 7 |
public static int getPixelLength(){return lengthOfChunk*Building.lengthOfBuilding;} | 0 |
public static void main(String[] args) {
// switch - int, String or enum
System.out.println("Please add number of month");
Scanner sc = new Scanner(System.in);
int month = sc.nextInt();
switch (month) {
case 1:
case 2:
case 3:
System.out.println("This is the first quarter of the year");
break;
... | 6 |
public void visitVarExpr(final VarExpr expr) {
if (!expr.isDef()) {
if (expr.def() != null) {
prop(expr, expr.def());
}
}
} | 2 |
void resetButtonsToPanelRules()
{
// Reset the buttons to support the original panel rules,
// including whether the next or back buttons are enabled or
// disabled, or if the panel is finishable.
WizardModel model = wizard.getModel() ;
WizardPanelDescriptor descriptor = model.getCurrentPanel... | 6 |
@Override
public boolean isCommonSubexpression(Instruction i) {
if(i instanceof BinaryInstruction) {
BinaryInstruction b = (BinaryInstruction)i;
return this.getOpcode() == b.getOpcode()
&& this.arg1.equals(b.arg1)
&& this.arg2.equals(b.arg2);
}... | 3 |
public void initRegisterModel() {
for(int x=0; x< 32;x++){
for(int y=1; y<9; y++){
ramModel.setValueAt("00", x, y);
}
}
} | 2 |
@Override
public BufferedImage draw()
{
BufferedImage image = new BufferedImage(Building.lengthOfBuilding, Building.lengthOfBuilding, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.setColor(Color.orange);
g.fillRect(1, 1, lengthOfBuilding-2, lengthOfBuilding-2);
return image;
} | 0 |
public void tick() {
this.updateWeather();
long var2;
if (this.isAllPlayersFullyAsleep()) {
boolean var1 = false;
if (this.spawnHostileMobs && this.difficultySetting >= 1) {
var1 = SpawnerAnimals.performSleepSpawning(this, this.playerEntities);
... | 7 |
public ShouldCollideWithPowerFailureVisitor(PositionChangedObservable collider) {
if (collider == null)
throw new IllegalArgumentException("The given collider is invalid!");
this.collider = collider;
} | 1 |
@Override
protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context)
throws IOException, InterruptedException {
Iterator<VectorWritable> it = values.iterator();
if (!it.hasNext()) {
return;
}
Vector value = it.next().get();
Iterator<Vector.Element>... | 9 |
@Override
public ArrayList<String> getGoToList() {
// TODO Auto-generated method stub
return null;
} | 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.