text stringlengths 14 410k | label int32 0 9 |
|---|---|
private boolean canSimpleCheckerFight(Cell fighter, Cell targetCell) {
if (targetCell == null || !targetCell.isEmpty()) {
return false;
}
StepDirection direction = chessBoardModel.getDirection(fighter, targetCell);
Cell victimCell = getRelativeCell(fighter, direction);
... | 5 |
private boolean jj_3R_14() {
if (jj_scan_token(STRING)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3_67()) {
jj_scanpos = xsp;
if (jj_3_68()) {
jj_scanpos = xsp;
if (jj_3_69()) return true;
}
}
if (jj_3R_31()) return true;
return false;
} | 5 |
private void asetaAKuva() {
if (noppa == 2 || noppa == 3){
ImageIcon raha1 = new ImageIcon(new ImageIcon(getClass().getResource("/kolikot.jpg")).getImage());
setIcon(raha1);
} else if (noppa == 4){
ImageIcon raha2 = new ImageIcon(new ImageIcon(getClass().getResource("... | 5 |
public void repartirFichas(){
int k=10;
for (int i = 0; i < 14; i+=2) {
this.listaFichaPc.add(this.listaFicha.get(this.fichasBarajadas[i]));
this.listaFichaHumano.add(this.listaFicha.get(this.fichasBarajadas[i+1]));
int tlh = Domino.listaFichaHumano.size();
... | 4 |
public void reactionAnalysis(){
//System.out.printf("%d\n", reactions.size());
for(int i=0; i<reactions.size(); i++){
if(reactions.get(i).getCount() > 1){
System.out.printf("%d\t", reactions.get(i).getCount());
System.out.printf(""+reactionToString(reactions.get(i))+"\n");
}
}
... | 2 |
public static void print(String s) {
if (verbose)
System.out.println(s);
} | 1 |
public boolean interact(EntityPlayer var1) {
ItemStack var2 = var1.inventory.getCurrentItem();
if(var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared()) {
if(!this.worldObj.multiplayerWorld) {
this.setSheared(true);
int var3 = 2 + this.rand.nextInt(3)... | 5 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((adresse == null) ? 0 : adresse.hashCode());
result = prime * result
+ ((emailAdresse == null) ? 0 : emailAdresse.hashCode());
result = prime * result + geburtsjahr;
result = prime * result
+ ((geschl... | 7 |
public double getMAP() {
if (this.predictionData.size() != 0 && this.realData.size() != 0 && this.numFoundRelevantDocs != 0) {
double sum = 0.0;
for (int i = 1; i <= this.predictionData.size(); i++) {
sum += (getPrecisionK(i) * isCorrect(i - 1));
}
return sum / this.realData.size();
}
return 0.0;
... | 4 |
public static void main(String[] args) {
ArrayList<Figura> figuras = new ArrayList();
fabricarFiguras(figuras);
for (Figura figura:figuras) {
figura.desenhar();
if (figura instanceof Figura2D) {
Figura2D figura2D = (Figura2D) figura;
System... | 2 |
public static void addWadToBlacklist(String filename, String sender) {
String query = "SELECT `md5`,`name` FROM `" + mysql_db + "`.`blacklist` WHERE `name` = ?";
try {
Connection con = getConnection();
PreparedStatement pst = con.prepareStatement(query);
pst.setString(1, filename);
ResultSet r = pst.exe... | 4 |
public boolean isMatched(String str){
String[] s=str.split(" ");
Map<String,String> map= new HashMap<String,String>();
map.put(")","(");
map.put("}","{");
map.put("]","[");
for(String item : s){
System.out.println("handle "+item);
if(item.equals("(") || item.equals("[") ||item.equals("{"))... | 9 |
public PartList getPartList(InputStream is) throws Exception{
PartList partList;
Element root;
try {
root = getRootElement(is);
} catch (Exception e) {
throw e;
}
String bucketName = root.getElementsByTagName("Bucket").item(0).getTextContent();
String uploadId = root.getElementsByTagNam... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
static String toHex4String(int pValue)
{
String s = Integer.toString(pValue, 16);
//force length to be four characters
if (s.length() == 0) {return "0000" + s;}
else
if (s.length() == 1) {return "000" + s;}
else
if (s.length() == 2) {return "00" + s;}
else
if (s.length() == 3) {re... | 4 |
public static BigInteger convertoToRepresentationNumber(String representationString, char[] alfabet){
Hashtable<Character,Integer> conversionFunction = new Hashtable<>();
BigInteger base = BigInteger.valueOf(alfabet.length);
BigInteger out = BigInteger.ZERO;
for... | 2 |
@Override
public double evaluate(int[][] board) {
int r = 0;
int n = board.length;
int m = board[0].length;
int x = 0, y = 0;
while (y != m) {
int nextX, nextY;
if (y % 2 == 0) {
if (x == n - 1) {
nextX = x;
... | 7 |
public void clickChooseSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) {
System.out.println("You can't choose items, you haven't got any characters to put items on.");
} | 0 |
public void setCode(String code) {
this.code = code;
} | 0 |
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
} | 0 |
private void FacturarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FacturarActionPerformed
// TODO add your handling code here:
List<Usuario> us = new Conectar().ConexionUs();
Usuario u = new Usuario();
String s1 = null;
try {
s1 = new Us... | 7 |
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>... declaredExceptions) {
if (!isCheckedException(ex)) {
return true;
}
if (declaredExceptions != null) {
for (Class<?> declaredException : declaredExceptions) {
if (declaredException.isInstance(ex))... | 6 |
private static Node intersection(Node l1, Node l2){
int len1=findLength(l1);
int len2=findLength(l2);
if(len1>len2){
int diff = len1-len2;
while(diff-->0){
l1=l1.next;
}
} else {
int diff = len2-len1;
while(diff-->0){
l2=l2.next;
}
}
while(l1!=null && l2!=null){
if(l1 == l2) ret... | 6 |
public void calculateBobbing(){
float maxB = 3.5f;
float inc = 0.25f;
if(moving){
if(up){
if(bob + inc < maxB) bob += inc;
else bob = maxB;
if(bob == maxB) up = false;
}else{
if(bob - inc > 0.0f) bob -= inc;
else bob = 0.0f;
if(bob == 0.0f) up = true;
}
}else{
bob = 0.0f;... | 6 |
public void setOutputChannels(OutputChannels out)
{
if (out==null)
throw new NullPointerException("out");
outputChannels = out;
} | 1 |
static void tokenizeInstruction(String strLine)
{
StringTokenizer tt= new StringTokenizer(strLine,", \t");
stepins=tt.nextToken();
strLine = strLine.replace(",", " ");
if(frontend.FrontEnd.onconsole.isSelected())
{
System.out.println("Current Instruction ->... | 7 |
public void cambiarPassword(String newpass, String nick){
try {
String queryString = "UPDATE Usuarios SET password=? WHERE nick=?";
connection = getConnection();
ptmt = connection.prepareStatement(queryString);
ptmt.setString(1, newpass);
ptmt.setString(2, ... | 5 |
public int isFriend(User user) {
try {
String statement = new String("SELECT * FROM " + FriendDBTable + " WHERE uid1 = ? AND uid2 = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, userID);
stmt.setInt(2, user.userID);
ResultSet rs = stmt.executeQuery();
if ... | 2 |
synchronized void doDelay(int milliseconds) {
// ожидает указанное время, или пока не прервет управляющее сообщение присланное через setMessage()
// для неопределенно длительного ожидания < 0
if (milliseconds < 0) {
try {
wait();
}
catch (I... | 3 |
public Simulator() {
e = new Employee[6];
r = new Random();
for (int g = 0; g < 6; g++) {
if (g < 2) {
e[g] = new TastebudStylist();
} else if (g < 4) {
e[g] = new Moover();
} else {
e[g] = new Shaker();
}
}
for (int i = 0; i < 24; i++) {
for (int j = 0; j < e.length; j++) {
for... | 7 |
public long skip(long n) throws IOException
{
long skip = in.skip(n);
if (available > 0)
{
available -= skip;
}
return skip;
} | 1 |
public static char two(int r, int c, int f) {
if (s2(r, c, f) || s5(r, c, f))
return '|';
else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f))
return '_';
return '.';
} | 5 |
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... | 9 |
public boolean autoBitrateSize(){
if (prop.getProperty("autoBitrateSize").equals("true"))
return true;
else
return false;
} | 1 |
@EventHandler(priority = EventPriority.LOWEST)
public void onKickServer(ServerKickEvent e) {
ProxiedPlayer p = e.getPlayer();
if (p == null) {
return;
}
if (plugin.maintenanceEnabled && !p.hasPermission("bungeeutils.bypassmaintenance")) {
p.disconnect(new Co... | 6 |
public Dysk dawajDysk(){
System.out.println("Dodaje: " + name);
return new DyskDlaLaptopa();
} | 0 |
@Override
public int compareTo(DoublyLinkedList<E> o) {
return this.size - o.getSize();
} | 0 |
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 |
private static String reformatTimezone(String str, int signIdx) {
String str2 = str;
if (signIdx >= 0 &&
signIdx + 5 < str.length() &&
Character.isDigit(str.charAt(signIdx + 1)) &&
Character.isDigit(str.charAt(signIdx + 2)) &&
str.charAt(signIdx + 3) == ':... | 7 |
void actionAwardFilter() {
if (isEmpty(awardFilterTxt.getText()) &&
!achievedOkFilter.isSelected() &&
!achievedKoFilter.isSelected() &&
!secretFilter.isSelected() &&
!multiFilter.isSelected() &&
!addedFilter.isSelected())
{
awardListModel.filter(null);
}
el... | 9 |
public void setMinLength(Long value) {
this.minLength = value;
} | 0 |
public Whitelist addAttributes(String tag, String... keys) {
Validate.notEmpty(tag);
Validate.notNull(keys);
Validate.isTrue(keys.length > 0, "No attributes supplied.");
TagName tagName = TagName.valueOf(tag);
if (!tagNames.contains(tagName))
tagNames.add(tagName);
... | 3 |
private static void send() {
wLabel.setText("- VOID -");
lLabel.setText("- VOID -");
GWCAOperation operationToInvoke = (GWCAOperation) cb.getSelectedItem();
String parameterType = (String) cbType.getSelectedItem();
String wInput = wTextField.getText();
String lInput = lT... | 4 |
public void paintComponent(Graphics gfx) {
super.paintComponent(gfx);
Graphics2D g = (Graphics2D) gfx;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setFont(font);
//g.setColor(Color.gray);
//g.drawRect (0,0,get... | 9 |
public static void insertCompte(Compte compte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("insert into compte (typeCompte, solde, dateCreation, fk_id_utilisateur) values (?,?,?,?)");
stat.setString(1, compte.getTypeCompte());
... | 2 |
@Test
public void reTest2() {
userInput.add("hi");
userInput.add("my name is meng meng");
userInput.add("i want to go to the canteen");
userInput.add("can i eat at line one");
userInput.add("errorhandling");
userInput.add("errorhandling");
userInput.add("errorhandling");
userInput.add("errorhandling");... | 9 |
@Override
public IssueStatus getStatus() {
if (statusValue == null || isEmpty(statusValue.getText())) {
return null;
}
return IssueStatus.valueOf(statusValue.getText().trim());
} | 2 |
public void mouseDragged(MouseEvent me)
{
if (this.isEnabled())
{
this.wasDragged = true;
int tool = tools.getSelectedDrawingTool();
if (!(tool == Toolset.TOOL_EYEDROPER
|| tool == Toolset.TOOL_PAINT_BUCKET || tool == Toolset.TOOL_PENCIL)
... | 5 |
public void update(float delta) {
for (Plant plant : this.plants) {
plant.update(delta);
}
for (Rock rock : this.rocks) {
rock.update(delta);
}
for (Light light : this.lights) {
light.update(delta);
}
for (Nutrients nutrient : t... | 5 |
static int dfs(int node, int num){
if(visited[node]) return num;
num++;
visited[node]=true;
for(int neighbor: g.get(node)){
if(!visited[neighbor]){
num = dfs(neighbor, num);
}
}
return num;
} | 3 |
static public <T> ConstructorAccess<T> get (Class<T> type) {
try {
type.getConstructor((Class[])null);
} catch (Exception ex) {
if (type.isMemberClass() && !Modifier.isStatic(type.getModifiers()))
throw new RuntimeException("Class cannot be created (non-static member class): " + type.getName());
else
... | 7 |
public void placeDisk(String position){
board = board.placeDisk(position);
this.passedBefore = false;
} | 0 |
Object[] parameterForType(String typeName, String value, Widget widget) {
if (value.equals("")) return new Object[] {new TabItem[0]};
if (typeName.equals("org.eclipse.swt.widgets.TabItem")) {
TabItem item = findItem(value, ((TabFolder) widget).getItems());
if (item != null) return new Object[] {item};
}
i... | 5 |
public Matrix solve (Matrix B) {
if (B.getRowDimension() != m) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!this.isNonsingular()) {
throw new RuntimeException("Matrix is singular.");
}
// Copy right hand side with pivoting
int n... | 9 |
public int compareTo(Point that)
{
if (this.y < that.y)
{
return -1;
}
else if (this.y > that.y)
{
return 1;
}
else if (this.x < that.x)
{
return -1;
}
else if (this.x > that.x)
{
return 1;
}
else
{
return 0;
}
/* YOUR CODE HERE */
} | 4 |
public long transfer(
final FileChannel dst,
long position,
long count) throws IOException {
if (dst == null) {
return 0;
}
if (this.completed) {
return 0;
}
long bytesRead;
if (this.buffer.hasData()) {
... | 9 |
public void rendererCheckboard(CPRect r) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(r);
for (int j = rect.top; j < rect.bottom; j++) {
for (int i = rect.left; i < rect.right; i++) {
if ((i & 0x8) != 0 ^ (j & 0x8) != 0) {
data[i + j * width] = 0xffffffff;
} else {
data[i + j * ... | 3 |
protected double renderThread(Graphics2D g2d, Thread[] threads, int height, int width, int tdiam, int tradius,
double angle, Thread t, Map<String, Integer> actorIdMap) {
try {
int x = width / 2 + (int) (Math.cos(angle) * tradius);
int y = height / 2 + (int) (Math.sin(angle) * tradius);
ActorRunnable ar = ... | 8 |
private boolean isBankCommand(CommandName input) {
return input == CommandName.newAccount
|| input == CommandName.getAccount
|| input == CommandName.deleteAccount
|| input == CommandName.deposit
|| input == CommandName.withdraw
|| input == CommandName.balance || input == CommandName.list;
} | 6 |
public VertexChain(Graph g)
{
vertices = new ArrayList();
graph = g;
} | 0 |
public static TreeMap<Double,Integer> rhythmRound(TreeMap<Double,Integer> rhythmTreeIn){
TreeMap<Double,Integer> rhythmTreeOut = new TreeMap<Double,Integer>();
Iterator<Double> rhythmIterator = rhythmTreeIn.keySet().iterator();
while(rhythmIterator.hasNext()){
double origKey = rhythmIterator.next()... | 2 |
public static ArrayList<String> getTrackList(){
JsonParser jp = null;
boolean leadingKEY = false;
String ldKEY = null;
ArrayList<String> trackID = new ArrayList<String>();
try {
jp = Json.createParser(new FileReader(DaemonMainController.getDatabasePath()));
while(jp.hasNext()){
JsonParser.Event ... | 9 |
@RequestMapping(method = RequestMethod.GET, value = "/login")
public String getLoginPage(@RequestParam(value = "error", required = false) String errorMsg,
@RequestParam(value = "msg", required = false) String msg,
Model uiModel){
if (errorMsg != ... | 2 |
public String toString(){
String txt = "[";
for (String[] values : allLines) {
String line = " [";
for (String value : values) {
line += " \"" + value + "\",";
}
txt += line.substring(0, line.length()-1) + " ],";
}
txt = txt.substring(0,txt.length()-1) + " ]";
return txt;
} | 2 |
public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
} | 4 |
private static boolean isInteger(String s)
{
try
{
Integer.valueOf(s);
}
catch(NumberFormatException e)
{
return false;
}
return true;
} | 1 |
public void execute() {
final int initialTurns = (int) Math.ceil(3.0 / State.coolingRate) + 4;
double safeTurns = state.robotGunHeat / State.coolingRate;
if(state.time < initialTurns) {
/*
* Do we have enough time to move around before they can start
* firing?
*/
if(safeTurns > 4) {
doMoveme... | 2 |
static final void method2131(int i) {
if (i == 0) {
if (Npc.anInt10503 == 2) {
Class348_Sub40_Sub34.aClass293Array9432[0]
.method2206(GfxLoader.aClass315Array3982[0]);
Class348_Sub40_Sub34.aClass293Array9432[1]
.method2206(GfxLoader.aClass315Array3982[1]);
} else if (Npc.anInt10503 == 3) {
... | 9 |
public void finalWinSimu(int total, int count){
int leftNum = total;
int[] allPeople = new int[total];
int nextGoIndex = -1;
for(int i=0;i<allPeople.length;i++){
allPeople[i]=i;
}
while(leftNum>1){
for(int i=1;i<=count;i++){
nextGoIndex = getNextIndex(nextGoIndex,total);
while(allPeople[nextGo... | 6 |
public void obfuscate(RawCorpus corpus) throws UndefinedException{
ArrayList<ArrayList<String>> ret = new ArrayList<ArrayList<String>>();
System.out.println("obfuscating corpus ...");
if(corpus==null || corpus.getData()==null || corpus.getSize()==0){
System.err.println("non-input corpus...");
return ;
}
... | 7 |
public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
return;
}
if (ya < 0) direction = 0;
if (ya > 0) direction = 1;
if (xa < 0) direction = 2;
if (xa > 0) direction = 3;
if (!checkCollision(xa, ya)) {
x += xa;
y += ya;
}
} | 7 |
protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/transition.gif");
return new javax.swing.ImageIcon(url);
} | 0 |
public static int checkLogin(Db db, LogAc logAc, String userName, char[] password){
int i = 0;
while (logAc.getDoctor(i)!=null){
if (logAc.getDoctor(i).getUserName().equals(userName)){
if (Arrays.equals(logAc.getDoctor(i).getPassword().toCharArray(),password))
return 1;
}
i++;
}
i = 0;
while... | 6 |
@EventHandler
public void crafting(PrepareItemCraftEvent e){
Player p = (Player)e.getViewers().get(0);
ItemStack[] items = e.getInventory().getContents();
ArrayList<ItemStack> correct = new ArrayList<ItemStack>();
for(ItemStack i : items){
correct.add(i);
}
correct.remove(0);
ItemStack result = e.... | 3 |
void Load(GL2 gl2,String fname) {
name=fname;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(new File(fname)));
String line;
int j=0;
while( ( line = br.readLine() ) != null ) {
if( line.length() < 16 ) continue;
j++;
if(j==4) {
j=0;
num_triangles++;
... | 9 |
public static String trimTrailingZerosAfterDecimal(String buffer, boolean localized) {
if (buffer != null) {
buffer = buffer.trim();
int dot = buffer.indexOf(localized ? DecimalFormatSymbols.getInstance().getDecimalSeparator() : '.');
if (dot != -1) {
int pos = buffer.length() - 1;
while (true) {
... | 6 |
public Book getBook(long isbn) {
//TODO
Book ret = null;
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456");
st=conn.createStatement();
rs = st.executeQuery("SELECT isbn, t... | 6 |
@Override
public void keyReleased(KeyEvent e) {
//only checks for user input if the game has started
if(gameStarted){
if (KeyEvent.getKeyText(e.getKeyCode()).equals("Escape")) {
// if the in game menu is up, close it
if (ingameMenuActive) {
closeIngameMenu();
} else {
// otherwise bring ... | 5 |
@Override
public boolean gainPassage(Oergi oergi) {
if (jumpheight == 3) { //a wall, no real corridor
return false;
}
Element element = oergi.getElement();
ElementMovability elementMovability = new ElementMovability();
Movability movability = elementMovability.getMovability(this.getBiotype(), element);... | 5 |
@Override
public <T extends PersistentObject> T update(T entity) {
return (T) dataStore.put(entity.getId(), entity);
} | 0 |
public void set(String counterName, long[] countersValue) {
if(counterName.equals("Reduce input groups")) {
Reduce_input_groups = countersValue;
}
else if(counterName.equals("Combine output records")) {
Combine_output_records = countersValue;
}
else if(counterName.equals("Map input records")) {
Map_i... | 4 |
@Override
public void actionPerformed(ActionEvent e) {
// New button clicked
if (e.getSource() == newPersonButton) {
submitButton.setVisible(true);
newPersonButton.setVisible(false);
deletePersonButton.setEnabled(false);
editPersonButton.setEnabled(false);
cancelButton.setVisible(true);
if (subm... | 7 |
public int numCasesTotal()
{
return myAllCases.size();
} | 0 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
public void spawnEtoile()
{
if(timer > 0)
timer --;
else
{
int x = 0;
int y = 0;
while(carte[x][y] == '1' || carte[x][y] == '4' || carte[x][y] == '2' || carte[x][y] == '5')
{
x = (int)(Math.random()*(width-2)+1);
y = (int)(Math.random()*(height-2)+1);
}
if(carte[x][y]=='3')
ca... | 7 |
public void updateProduct(Product product) {
try {
beginTransaction();
session.update(product);
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSesion();
}
} | 1 |
@Override
public boolean equals( Object toCompare ) {
//only deal with PolynomialTerm comparison
if ( toCompare instanceof PolynomialTerm ) {
//check for equaling to zero
if ( toCompare instanceof Numerical ) {
if ( toCompare.equals( Numerical.ZERO ) ) {
for ( Monomial aTerm : this.m_numerato... | 9 |
private void addSongsToPlaylistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSongsToPlaylistActionPerformed
JPanel panel = new JPanel();
JList list = new JList();
Map<String, Library> playlists = currUser.getLibrary().getPlayLists();
Vector<String> tmp = new Vector<String>();
for... | 7 |
public static boolean deleteNode(ListNode node){
if(node == null || node.next ==null)
return false;
ListNode next = node.next;
node.val = next.val;
node.next =next.next;
return true;
} | 2 |
public static void loadFromFile(File f) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
String inlin = ""; int line = 0;
while((inlin = in.readLine()) != null) {
String lin = comment.matcher(inlin).replaceAll("");
... | 6 |
public static double[][] identity( int n )
{
double[][] res = newMatrix(n, n, 0.0);
for ( int i = 0; i < n; ++i )
res[i][i] = 1.0;
return(res);
} | 1 |
private static void sendMsgToClient(Process process, BufferedReader buffer,
IoSession session, boolean isNormal) throws IOException {
String msg;
try {
buffer = new BufferedReader(new InputStreamReader(
isNormal ? process.getInputStream()
: process.getErrorStream()));
while ((msg = buffer.readL... | 4 |
public static void processSpherePlaneCollision(RigidBody plane,
RigidBody sphere, double restitution, double timeStep) {
// Predicted positions
Vector3d planePosition = new Vector3d();
Vector3d spherePosition = new Vector3d();
Quat4d planeRotation = new Quat4d();
Quat4d sphereRotration = new Quat4d();
s... | 2 |
private void sumNumbersRec(TreeNode root, int tmp) {
if(root == null) return;
if(root.left == null && root.right == null){
this.res += tmp + root.val;
}
if(root.left != null){
sumNumbersRec(root.left, (tmp + root.val) * 10);
}
if(root.right != null){
sumNumbersRec(root.right, (tmp + root.val) * 10)... | 5 |
public void updateLookAndFeel(String newlnfClassName) {
if(newlnfClassName != null) {
try {
UIManager.setLookAndFeel(newlnfClassName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.... | 5 |
public void run() {
double t = 5; //timeScale;
int i = 0;
while (true) {
rungeKutta(t);
if (i>1000){
System.out.println(bodies.get(3).position);
i = 0;
}
i++;
}
} | 2 |
@Override
public double getHig() {
return hight;
} | 0 |
private SootMethod getMethodFromHierarchyEx(SootClass c, String methodSignature) {
if (c.declaresMethod(methodSignature))
return c.getMethod(methodSignature);
if (c.hasSuperclass())
return getMethodFromHierarchyEx(c.getSuperclass(), methodSignature);
throw new RuntimeException("Could not find method");
} | 2 |
private void build_map(HashMap<Character,String> m1,HashMap<String,Character> m2)
{
int i=1;
int j=1;
int k=1;
boolean[] filled=new boolean[26];
for(int m=0;m<keyword.length();m++)
{
char cur_c=keyword.charAt(m);
int char_pos=cur_c-'A';
if(!filled[char_pos])
{
String... | 8 |
private void paintBoard(PaintEvent event) {
for (int xCoordinate = 0; xCoordinate < game.getBoardWidth(); xCoordinate++) {
for (int yCoordinate = 0; yCoordinate < game.getBoardHeight(); yCoordinate++) {
paintCell(event, xCoordinate, yCoordinate);
}
... | 2 |
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.