text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public boolean isBuffered() {
//if(gcode==null) return false;
if (Constants.GCDEF.G0.equals(gcode) || Constants.GCDEF.G1.equals(gcode) || Constants.GCDEF.G2.equals(gcode) || Constants.GCDEF.M106.equals(gcode) || Constants.GCDEF.M107.equals(gcode) ||Constants.GCDEF.G29.equals(gcode) || Constants.GCDEF.... | 9 |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length == 0) {
if (player == null) {
sender.sendMessage(ChatColor.RED+"This command can o... | 9 |
public void run(){
try {
while(true){
Thread.sleep(1000); //TEST STUB: change to 1000
synchronized(this.doc){
//Decrement all active game times by 1 second:
NodeList activeList = this.doc.getElementsByTagName("games_active");
if(((Element)activeList.item(0)).getChildNodes() == null){
c... | 8 |
protected boolean decodeFrame() throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out==null)
return false;
Header h = bitstream.readFrame();
if (h==null)
return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer)decoder.decod... | 4 |
public void verify(String expected, Flag... flags) {
List<String> lines = component.out.reset();
while (lines.isEmpty()) {
lines = component.out.reset();
}
if (contains(Flag.LAST, (Object[]) flags)) {
lines = Collections.singletonList(lines.isEmpty() ? "" : lines.get(lines.size() - 1));
}
String actua... | 8 |
private boolean isPrime(int n) {
boolean result = true; // assume true and try to prove otherwise
int i=2;
while ((i<n) && (result == true)) {
if ((n%i) == 0) {
result = false;
}
i++;
}
return result;
} | 3 |
void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out) {
if (!(childNodes.isEmpty() && tag.isSelfClosing())) {
if (out.prettyPrint() && (!childNodes.isEmpty() && (
tag.formatAsBlock() || (out.outline() && (childNodes.size()>1 || (childNodes.size()==1 && !... | 9 |
public T findOneByField(String campo, String condicao, String valor) {
T result = null;
try {
Query query = manager.createQuery("select x from " + entityClass.getSimpleName() + " x " + "where x." + campo + " " + condicao + ":value");
query.setParameter(campo, valor);
result = (T) query.getSingleResult(... | 2 |
public static void start(){
List<String> mapsToExclude = new ArrayList<String>();
mapsToExclude.add(previousMapName);
final Map mA = MapData.getRandomMapExcluding(mapsToExclude);
mapsToExclude.add(mA.getName());
final Map mB = MapData.getRandomMapExcluding(mapsToExclude);
mapsToExclude.add(mB.getName());
... | 3 |
private boolean compare(Block testBlock, int row, int column, int rowOffset, int columnOffset)
{
for(int i = 0; i < BLOCK_SIZE; i++)
{
for(int j = 0; j < BLOCK_SIZE; j++)
{
try
{
if (testBlock.getValue(i, j) == ACTIVE_BLOCK)
{
if(gameBoard[i + row + rowOffset][j + column + columnOffs... | 6 |
public static Facade getFacade(boolean reset) {
if (true) {
instance = new Facade();
}
return instance;
} | 1 |
public static void main(String args[]) {
try{
ServerSocket server=null;
try{
server=new ServerSocket(6888);
//创建一个ServerSocket在端口6888监听客户请求
}catch(Exception e) {
System.out.println("can not listen to:"+e);
//出错,打印出错信息
}
... | 4 |
public static String wrapVariableBinding(String command, CycSymbol variable, Object value) {
try {
// @todo consider setting *ke-purpose*
return "(clet ((" + DefaultCycObject.cyclifyWithEscapeChars(variable, true) + " " + getAPIString(value) + ")) " + command + ")";
} catch (Exception e) {
ret... | 1 |
private boolean checkBorders()
{
boolean check = false;
int width = gameInst.container.getWidth();
int height = gameInst.container.getHeight();
if (location[0] >= width)
{
check = true;
if (velocity[0] > 0)
velocity[0] *= -.5f;
}
if (location[0] <= 0)
{
check = true;
if (velocity[0] ... | 8 |
private void printCell(String s)
{
System.out.print(s);
for (int i = s.length(); i <= 16; i++)
{
System.out.print(" ");
}
} | 1 |
@BeforeClass
public static void setUpBeforeClass() {
try { new MySQLConnection(); }
catch (InstantiationException e) { e.printStackTrace(); }
catch (IllegalAccessException e) { e.printStackTrace(); }
catch (ClassNotFoundException e) { e.printStackTrace(); }
catch (SQLException e) { e... | 5 |
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
int writtenKeyCount = keyCount;
if (writtenKeyCount != 0) {
keyCount = 0;
boolean hasIntValues = in.readBoolean();
boolean hasObject... | 7 |
public static boolean tryRepairingSomethingIfNeeded(Unit worker) {
// If we're out of minerals, don't repair
if (!xvr.canAfford(10)) {
return false;
}
// Disallow wounded workers to repair; this way we can save many lives
if (worker.getHP() < 45) {
return false;
}
// =============================... | 7 |
public static Balancer getInstance() {
if (balancer == null) {
balancer = new Balancer();
}
return balancer;
} | 1 |
public Piece[] getSuivantes() {
return suivantes;
} | 0 |
public List<ExtensionsType> getExtensions() {
if (extensions == null) {
extensions = new ArrayList<ExtensionsType>();
}
return this.extensions;
} | 1 |
private void initilizeComponents (){
//Create User Options Panel
userOptionsPanel = new JPanel();
userOptionsPanel.setLayout(new GridLayout(15,2));
userOptionsPanel.setBorder(BorderFactory.createEtchedBorder());
//Create Bottom Buttons
bottomButtons = new JPanel();
bottomButtons.setLayout(new FlowLa... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (obj instanceof SentenceSpan) {
SentenceSpan a = (SentenceSpan) obj;
return getSentence().equals(a.getSentence())
&& section.equals(a.section)
&& Arrays.equals(getWords(), a.getWord... | 4 |
public JSONArray getJSONArray(String key) throws JSONException {
Object object = this.get(key);
if (object instanceof JSONArray) {
return (JSONArray)object;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONArray.");
} | 1 |
private void normal(Key key) {
if (limitReached()) {
return;
}
// If delete comes through don't print it out!
if (key.getCharacter() == 127) {
return;
}
TextGrid.DataGridCel cel = grid.getCel(currentRow + rowOffset,
currentCol + c... | 5 |
public URLFileDownloader(String s) throws MalformedURLException {
this.url = new URL("http://oberien.bplaced.net/Oberien/" + s);
s = s.replace("%20", " ");
if (s.contains("natives")) {
s = "Game/" + s.substring(s.lastIndexOf("/"));
}
file = new File(s);
} | 1 |
public GrammarTestAction(GrammarEnvironment environment) {
super("Grammar Test", null);
this.environment = environment;
this.frame = Universe.frameForEnvironment(environment);
} | 0 |
public void retrieveEvent(String[] arguments) throws RemoteException {
final String retrieveUsage = "Usage: retrieve [user] xxxx-xx-xx xx:xx:xx xxxx-xx-xx xx:xx:xx.\n";
if((arguments.length != 5) && (arguments.length != 6)) {
System.out.println(retrieveUsage);
return;
}
ArrayList<E... | 9 |
public void loadGraphFromSXGFString(String graphXML) {
//System.out.println(graphXML);
try {
Document document = builder.parse(new InputSource(new StringReader(graphXML)));
// Graph
NodeList graphroots = document.getElementsByTagName("Graph");
Node graph... | 7 |
public void replace(String statement) throws CannotCompileException {
thisClass.getClassFile(); // to call checkModify().
ConstPool constPool = getConstPool();
int pos = currentPos;
int index = iterator.u16bitAt(pos + 1);
Javac jc = new Javac(thisClass);
ClassPool cp =... | 3 |
public List<JsonIngredient> getParentIngredients(){
if(parent == null){
return null;
}
if(parent.getInternal() == null){
return null;
}
return parent.getInternal().getParent();
} | 2 |
private String fetchFormatFromQuery( URI requestedURI,
String defaultFormat ) {
if( requestedURI.getQuery() == null )
return defaultFormat;
String encoding = java.nio.charset.StandardCharsets.UTF_8.name(); // "UTF-8";
String key = "format";
try {
ikrs.httpd.datatype.Query query = new ikrs.h... | 4 |
public void minimumParentheses(){
Pattern pattern = Pattern.compile("[(][0-9¥+¥-¥*/]+[)]");
Matcher matcher = pattern.matcher(expression);
if (matcher.find()) {
for(int i = 0; i < matcher.groupCount(); i++) {
//add matched expression into list and replace it to %s
... | 2 |
public boolean isPathSelected(TreePath path, boolean dig) {
if (!dig) {
return super.isPathSelected(path);
}
while (path != null && !super.isPathSelected(path)) {
path = path.getParentPath();
}
return path != null;
} | 3 |
@Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.size() < 2)
throw new Exception("DIV: faltan operandos");
Valor op1 = st.pop();
Valor op2 = st.pop();
if (op1 instanceof Entero && op2 instanceof Entero) {
st.push(new Entero(((int) op1.getValor()) / (... | 3 |
public Integer getId() {
return this.id;
} | 0 |
protected synchronized void ensureOpened(){
if (this.dialogState == DialogState.CLOSED) {
throw new IllegalStateException("对话已经关闭");
} else if (this.dialogState == DialogState.OPENNING) {
throw new IllegalStateException("对话正在建立");
} else if (this.dialogState == DialogState.CREATED) {
throw new IllegalSig... | 4 |
public boolean login(){
String Username = jTextField1.getText();
String Password = String.valueOf(jPasswordField1.getPassword());
String reply = "";
try
{
Soutput.writeObject("login " + Username + " " + Password);
Soutput.flush ();
}
catch (IOException e)
{
System.ou... | 3 |
static boolean check(int r, int c) {
return r >= 0 && r < m && c >= 0 && c < n;
} | 3 |
public void show() {
if (mazeFilled) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (maze[j][i].equals(ETile.WALL)) {
System.out.print(ETile.WALL.getSymbol());
} else if (maze[j][i].equals(ETil... | 7 |
private void setNameGameWorld(String name) {
nameGameWorld = name.substring(name.lastIndexOf(".") + 1, name.indexOf("Loc"));
} | 0 |
public void putByte(byte newByte) {
byte[] ar = new byte[1];
ar[0] = newByte;
msg = new String(ar);
if (newByte == '$') {
// new Message Start detected
// reset Msg String and add Start-delimiter
outmsg = msg;
startDetected = true;
} else if (newByte == '\n' && startDetected == true) {
// En... | 5 |
public void displayTieOrWinMessage() {
if(this.isInCheck()&&!this.canGetOutOfCheck())
{
this.displayGameOverMessage();
}
else
{
this.displayTieMessage();
}
} | 2 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.unban
+ " (PlayerName)");
return;
}
St... | 5 |
public boolean fletching2(int Status, int Amount1, int Amount2) {
if (playerLevel[playerFletching] >= fletching[1]) {
addSkillXP((fletching[2] * fletching[3]), playerFletching);
deleteItem(useitems[0], useitems[3], Amount1);
deleteItem(useitems[1], useitems[2], Amount2);
addItem(fletching[4], Amount2);
... | 8 |
public boolean adicionarPromocao(Promocao p, String nomeOUcodigo) throws ExceptionGerenteEstoque {
if (getProduto(nomeOUcodigo)== null){
throw new ExceptionGerenteEstoque("Produto n��o exite");
}
if (p.getId() == 0){
throw new ExceptionGerenteEstoque(" Promocao n��o exite");... | 3 |
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
final Player player = event.getPlayer();
if (!player.hasPermission("lifemc.lives.lose"))
return;
int lives = plugin.getDataHandler().getLives(player);
if (lives <= 1) {
plugin.getDataHandler().setLives(player, 0);
//player.getI... | 4 |
private String convertXXX(int n) {
if(n==0)
return "";
int first = n % 10;
int second = ((n - first) /10)%10;
int third = ((n - 10 * second - first) / 100)%10;
String result = "";
if (third != 0) {
result += getWord1(third);
result += " Hundred and ";
}
if (second != 0) {
if (second > 1) {
... | 7 |
public static void main(String[] argv) throws IOException, InterruptedException, LWJGLException {
Renderer r = new Renderer(1);
Sprite s = new Sprite("mask.dmi");
for(int x = 0; x<20; x++) for(int y=0;y<20;y++)
{
Atom a = new Atom();
a.direction = Directions.SOUTH;
a.frame = 0;
a.sprite_state ... | 6 |
public static Duration minDuration(Duration a, Duration b) {
if (a.isShorterThan(b)) {
return a;
} else {
return b;
}
} | 1 |
public static <VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>>
AbstractList<VertexType>
doSort(BaseGraph<VertexType, EdgeType> graph) {
ArrayList<VertexType> alv = new ArrayList<VertexType>();
ArrayList<VertexType> out = new ArrayList<VertexType>();
LibraryUtils.fa... | 9 |
public static void main(String[] args) {
// Build model
Model model = new CPModel();
// Declare every letter as a variable
IntegerVariable d = Choco.makeIntVar("d", 0, 9, Options.V_ENUM);
IntegerVariable o = Choco.makeIntVar("o", 0, 9, Options.V_ENUM);
IntegerVariable n = Choco.makeIntVar("n", 0, 9, Options... | 3 |
@EventHandler
public void onJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
try{
API api = Plugin.getAPI();
api.setPlayersJob(p, api.getDefaultJob());
if(api.checkForProperty(p) == null){
api.setMoney(p, api.getStartMoney());
}else{
}
}catch(Exception exception){
}... | 2 |
public String toString()
{
StringBuffer buf = new StringBuffer();
// line 1
buf.append(" ");
for (int i=1; i<=s.length(); i++) buf.append(" "+sAt(i)+" ");
buf.append("\n");
// line 2
buf.append(" ");
for (int i=1; i<=s.length(); i++) buf.append("-... | 5 |
public ArrayList<Pet> arrayList(int size) {
ArrayList<Pet> result = new ArrayList<Pet>();
Collections.addAll(result, createArray(size));
return result;
} | 0 |
public void presentMineralMap(World world, Terrain terrain) {
final int colourKey[][] = new int[mapSize][mapSize] ;
final int typeColours[] = {
0xff000000,
0xffff0000,
0xff0000ff,
0xff00ff00
} ;
final int degreeMasks[] = {
0xff000000,
0xff3f3f3f,
0xff7f7f7f,
... | 4 |
private final void method2590(byte[] is, int[] is_0_, int i, int i_1_,
int i_2_, int i_3_, int i_4_, int i_5_,
int i_6_) {
int i_7_ = -(i_3_ >> 2);
i_3_ = -(i_3_ & 0x3);
for (int i_8_ = -i_4_; i_8_ < 0; i_8_++) {
for (int i_9_ = i_7_; i_9_ < 0; i_9_++) {
if (is[i_1_++] != 0)
is_0_[i_2_++] = ... | 8 |
public boolean hasChild(Spatial spat) {
if (children.contains(spat))
return true;
for (Spatial child : children) {
if (child instanceof Node && ((Node)child).hasChild(spat))
return true;
}
return false;
} | 4 |
private boolean checkWin(){
boolean win = false;
int deads = 0;
for (SimulatorRobot robot : Board.robots) {
if (robot.getLives() <= 0) {
deads++;
if(deads == Board.robots.size() -1 ){
win = true;
}
... | 3 |
public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (thenBlock == oldBlock)
thenBlock = newBlock;
else if (elseBlock == oldBlock)
elseBlock = newBlock;
else
return false;
return true;
} | 2 |
public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException
{
if(!isGameOver)
{
if(!isPause)
{
}
else
{
}
}
else
{
}
} | 2 |
private void playEvents() {
try {
while(running.get()) {
// Lock the events and wait until we have unprocessed events
eventsLock.lock();
try {
while(eventsIsProcessed.get()){
eventsNotProcessed.await();
}
// Double buffer the events so that we can play them completely
pl... | 8 |
private void handleValidDate(Field field, Object container, SwingWorkerInterface swingworker) throws IllegalAccessException {
ValidDate validDate=field.getAnnotation(ValidDate.class);
if(validDate!=null && isCheckSupposedToExecuteBasedOnAction(validDate.value(), swingworker.getAction())){
Ob... | 5 |
public ProfessorServlet() {
super();
// TODO Auto-generated constructor stub
} | 0 |
private void setTextFieldVerifiers() {
//Определяем массив текстовых компонентов
final JComponent[] componentArr = new JComponent[]{textFieldName, textFieldMinAmount, textFieldMaxAmount, textFieldDuration, textFieldStartPay, textFieldPercent, textAreaDescription};
//Создаем обьект проверки
... | 4 |
private boolean areValidObstacles() {
boolean answer = true;
for(Obstacle o : obstacles)
{
if(o.getxStart() <= 0 || o.getxStart() >= nbLigneGrille -1)
{
answer = false;
}
if(o.getyStart() <= 0 || o.getyStart() >= nbColGrille - 1)
{
answer = false;
}
if(o.getxEnd() <= 0 || o.getxEnd() ... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,null,givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!(target instanceof Scroll))
{
mob.tell(L("You can't clarify that."));
... | 7 |
@Override
public String getColumnName(int column){
switch(column){
case 0:
return ("szYear");
case 1:
return("szMonth");
case 2:
return("IntWorkingDay");
case 3:
return("szWorkplaceId");
default:
return null;... | 4 |
public void newwdg(int id, Widget w, Object... args) {
if(w instanceof Listbox) {
chrlist = (Listbox)w;
} else if(w instanceof Button) {
if(((Button)w).text.text.equals("I choose you!"))
selbtn = (Button)w;
}
check();
} | 3 |
public List<SearchResult> findPostByWord(String keyWord, Map<String, String> indexMap, File contentFile) {
List<SearchResult> results = new ArrayList<SearchResult>();
try {
keyWord = keyWord.toLowerCase();
String indexStr = indexMap.get(keyWord);
if (indexStr == null || indexStr.trim().length() == 0)
... | 8 |
@Override
public void execute() {
final SceneObject cutRoot = SceneEntities.getNearest(Settings.CUT_ROOT_FILTER);
if(cutRoot != null) {
doAction("Collect", cutRoot);
} else {
final SceneObject uncutRoot = SceneEntities.getNearest(Constants.STRAIGHT_ROOT_ID);
if(uncutRoot != null) {
doAction("Chop", ... | 2 |
public boolean testVictoire(Joueur joueur) {
for (Case c : joueur.getCases()) {
if (c.getBateau() != null && !c.getBateau().testBateauCoule()) {
return false;
}
}
return true;
} // testVictoire(Joueur joueur) | 3 |
public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)pa... | 7 |
protected int parseTag()
throws IOException
{
if (_peekTag >= 0) {
int tag = _peekTag;
_peekTag = -1;
return tag;
}
int ch = skipWhitespace();
int endTagDelta = 0;
if (ch != '<')
throw expectedChar("'<'", ch);
ch = read();
if (ch == '/') {
endTagDel... | 7 |
public Theater getTheater(int theaterID) throws RemoteException {
if(this.lastRequest == -1)
this.lastRequest = System.currentTimeMillis();
if(connectionTimout())
return null;
for(LinkedList<Theater> theaters : list)
for(Theater t : theaters)
if(t.getId() == theaterID)
return t;
retur... | 5 |
public void commitOnly(final Set methods, final Set fields) {
try {
final OutputStream outStream = loader.outputStreamFor(this);
final DataOutputStream out = new DataOutputStream(outStream);
writeHeader(out);
writeConstantPool(out);
writeAccessFlags(out);
writeClassInfo(out);
writeFields(out, fi... | 1 |
private boolean search(Task task) throws IOException, ParseException {
searchResult = new ArrayList<TaskData>();
String content = task.getContent();
if (content != null
&& !content.isEmpty()
&& (content.startsWith("block") || content
.startsWith("blocked"))) {
searchResult = blockedList;
} else... | 7 |
public int [][] darHuertosIniciales() throws Exception {
int ij0=0;
int ij1=0;
int[][] rta= new int[Interfaz.NUM_COORD][Interfaz.NUM_HUERTOS];
for(int i=0; i <Interfaz.NUM_COORD;i++)
{
for(int j =0; j<Interfaz.NUM_HUERTOS;j++)
{
if(j%2==0){
ij0=Integer.parseInt(txtCrops[i][j].getText());
r... | 5 |
@SuppressWarnings("deprecation")
public static boolean isPigChest (Entity entity) {
if (entity instanceof Pig) {
Pig pigc = (Pig) entity;
if (pigc.getPassenger() instanceof StorageMinecart) {
ItemStack pigcChest = new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) ... | 3 |
protected static void importOutlinerDocument(FileProtocol protocol) {
DocumentInfo docInfo = new DocumentInfo();
PropertyContainerUtil.setPropertyAsString(docInfo, DocumentInfo.KEY_PROTOCOL_NAME, protocol.getName());
PropertyContainerUtil.setPropertyAsBoolean(docInfo, DocumentInfo.KEY_IMPORTED, true);
// Sel... | 1 |
public boolean addBindListener( BindListener l )
throws NullPointerException {
if( l == null )
throw new NullPointerException( "Cannot add null listeners." );
for( int i = 0; i < this.bindListeners.size(); i++ ) {
if( this.bindListeners.get(i) == l )
return false;
}
this.bindListeners.add( l );
re... | 3 |
public void createOffspring(Gene gene2, Gene offspring){
int crossoverBit = Math.abs(Environment.random.nextInt()%environment.bitsPerGene);
int crossoverByte = crossoverBit/Byte.SIZE;
byte[] firstGene, lastGene;//who provides the first bits?
if(Environment.random.nextInt()%2 == 0){
firstGene = geneData... | 3 |
public AsieLauncherGUI()
{
launcher = new AsieLauncher();
launcher.setUpdater((IProgressUpdater) this);
isRunning = true;
setResizable(false);
setLocationRelativeTo(null);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
addWindowListener(new WindowAdapter()
... | 9 |
public ConsoleOut(JavaConsole console)
{
if(mFonts == null)
{
mFonts = new Font[4];
for(int i = 0; i < 4; i++)
{
mFonts[i] = new Font("Lucida Console", i, 14);
}
}
mForegroundColor = Color.white;
mBackgroundColor = Color.black;
mConsoleForegroundColor = Color.white;
mConsoleBackgroundC... | 5 |
@Override
public String multiply(String a, String b) throws NumberFormatException
{
if (a.equals(BigDecimal.ZERO) || b.equals(BigDecimal.ZERO))
{
return String.valueOf(BigDecimal.ZERO);
}
else if (a.contains(".") || b.contains("."))
{
BigDecimal aa = new BigDecimal(a);
BigDecimal bb = new BigDecim... | 4 |
private static int findLastInstanceOfStackHanoi(Stack[] stacks) {
for (int i = stacks.length - 1; i >= 0; --i) {
if (stacks[i] instanceof StackHanoi) {
return i;
}
}
return -1;
} | 2 |
public static String printVars(String className, boolean raw, boolean newLine, MyVar... varList) {
String res = className == null ? "" : className + (newLine ? "\n" : " ");
for (MyVar v : varList) {
res += raw ? "" : "[";
if (v.name != null && !raw) {
res += v.na... | 8 |
public void method360(int i, int j, int k)
{
for(int i1 = 0; i1 < anIntArray1451.length; i1++)
{
int j1 = anIntArray1451[i1] >> 16 & 0xff;
j1 += i;
if(j1 < 0)
j1 = 0;
else
if(j1 > 255)
j1 = 255;
int k1 = anIntArray1451[i1] >> 8 & 0xff;
k1 += j;
if(k1 < 0)
k1 = 0;
else
if(k... | 7 |
public void simpan(javax.swing.JTextField no_beli, javax.swing.JTable kwitansiTable){
if (!no_beli.getText().equals("")){
kwitansi.setNoPembeli(no_beli.getText());
Object[][] listKwitansi = new Object[kwitansiTable.getRowCount()][3];
for (int i=0; i <kwitansiTable.getRo... | 3 |
public static void tempBanPlayer( String sender, String player, int minute, int hour, int day, String message ) throws SQLException {
BSPlayer p = PlayerManager.getPlayer( sender );
BSPlayer t = PlayerManager.getSimilarPlayer( player );
if ( t != null ) {
player = t.getName();
... | 6 |
public Node<T> findLowestCommonAncestor(Node<T> root, T data1, T data2){
if(root ==null){
return null;
}
if(contains(root.left, data1) && contains(root.left, data2)){
return findLowestCommonAncestor(root.left, data1, data2);
}
if(contains(root.right,data1... | 9 |
public int open() {
final Shell dialog = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | getStyle());
dialog.setText(GraphicsExample.getResourceString("Gradient")); //$NON-NLS-1$
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridLayout.marginHeight = 10;
gridLayout... | 7 |
@Override
public List<MOB> getCurrentReaders()
{
final List<MOB> readers=new LinkedList<MOB>();
if(amDestroyed())
return readers;
final MOB lastReader=this.lastReader;
if(lastReader!=null)
{
if(((lastReader==owner())||(lastReader.location()==owner()))
&&(CMLib.flags().isInTheGame(lastReader, true))... | 7 |
@Override
public void run() {
while (!end) {
process();
try {Thread.sleep(SLEEP_LONG);} catch (InterruptedException e) {}
}
process();
} | 2 |
public double getDouble(int index) throws JSONException {
Object object = get(index);
try {
return object instanceof Number ?
((Number)object).doubleValue() :
Double.parseDouble((String)object);
} catch (Exception e) {
throw new JSONExcepti... | 2 |
public Keyboard getKeyboard() {
return keyboard;
} | 0 |
public BufferedImage getImage(){
boolean canMove = this.canMove;
this.canMove = true;
BufferedImage img = null;
if(lastMove == NO_MOVE)
img = isLookRight() ? skin.getStandR() : skin.getStandL();
else if(lastMove > MOVE_RIGHT)
img = isLookRight() ? skin.getJumpR() : skin.getJumpL();
else
img = isLoo... | 9 |
public static String search4SqVenues(double[] sw, double[] ne,
String clientId, String clientSecret) throws Exception {
HttpsURLConnection c = null;
InputStream is = null;
int rc;
String url="";
/** This parameter represents the date of the Foursquare API version that we use.
* If you want to modify the... | 7 |
public void showCamera() {
if (checkCameraSupport() == false) {
// showAlert("Error", "Camera is not supported!", null);
return;
}
if (checkPngEncodingSupport() == false) {
// showAlert("Error", "Png encoding is not supported!", null);
return;
... | 3 |
private void findCutOff(double[] pos, double[] neg){
int[] pOrder = Utils.sort(pos),
nOrder = Utils.sort(neg);
/*
System.err.println("\n\n???Positive: ");
for(int t=0; t<pOrder.length; t++)
System.err.print(t+":"+Utils.doubleToString(pos[pOrder[t]],0,2)+" ");
System.err.println... | 9 |
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.