text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean isStrike() {
if (first == 10)
return true;
else
return false;
} | 1 |
private static SecretKey getSecretKey(String publicKey, String privateKey)
throws Exception {
// 初始化公钥
byte[] pubKeyBytes = SecurityCoder.base64Decoder(publicKey);
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKeyBytes);
PublicKey pu... | 0 |
private boolean updateSession(Response re) {
byte[] token = re.getSessionToken();
try {
if (token == null || token.length == 0) {
throw new NotLoggedInException("Your session has expired. Please log in again to continue.");
}
if (userProfile != null) {
if (!Arrays.equals(token, userProfile.get... | 8 |
private void leave(StateEnum state, final C context) {
if (context.isTerminated()) {
return;
}
try {
if (isTrace())
log.info("when leave %s for %s <<<", state, context);
handlers.callOnStateLeaved(state, context);
if (isTrace())
... | 4 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// String for which page to forward to (assigned after switch)
String goToThisPage = null;
// Get parameter
String director = request.getParameter("director");
///////////////////////... | 8 |
@Override
public boolean validGameID(int id){
if(id >= 0 && id < gameModels.size()){
return true;
}
else return false;
} | 2 |
private void check(File f, String[] splits, int i, String file) throws IOException{
if(splits.length-1==i){
String s = splits[i];
s = "\\Q"+s+".xsm\\E";
final Pattern pattern = Pattern.compile(s.replace("*", "\\Q.*\\E").replace("?", "\\Q.\\E"));
File[] files = f.listFiles(new FileFilter() {
@Override
... | 8 |
@Override
public Card turn(Card[] table, int stepNum) {
Iterator<Card> iterBatchOnHand;
Card card;
// Мы ходим первыми?
if (stepNum == 0) {
// Мы назначали козырь?
if (getTrumpSetterFlag()) {
// Ходим любой
return batchOnHand.remove();
} else {
// Не назначали козыря, ходим простой картой
... | 9 |
public static ArrayList<ItemSet> findRuleSubsets(ItemSet candidates, ArrayList<ItemSet> sets){
ArrayList<ItemSet> allRuleSets = sets;
if(!allRuleSets.contains(candidates)){
allRuleSets.add(candidates);
}
for(int i = 0; i < candidates.getItemSet().size();i++){
ArrayList<Item> subset = new ArrayLi... | 2 |
private void initFileList() {
fileList = new HashSet<FileModel>();
File folder = new File(dir);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
fileList.add(new FileModel(listOfFiles[i].getName(),0));
}
}
} | 2 |
private void drawGrid(Graphics g, Tile[][] grid)
{
for (int i = 0; grid != null && i < grid.length; i++)
for (int j = 0; j < grid[i].length; j++)
{
if (grid[i][j] != null && grid[i][j].getActive())
{
Tile current = grid[i][j];
g.setColor(current.getColor());
g.fillRect(current.getX()*32,... | 5 |
public static void putRandomInput(Comparable[] a)
{
Random r = new Random();
for (int i = 0; i < a.length; i++)
a[i] = Math.abs(r.nextInt());
} | 1 |
public void testFactory_parseDays_String() {
assertEquals(0, Days.parseDays((String) null).getDays());
assertEquals(0, Days.parseDays("P0D").getDays());
assertEquals(1, Days.parseDays("P1D").getDays());
assertEquals(-3, Days.parseDays("P-3D").getDays());
assertEquals(2, Days.pars... | 2 |
public void toggleDecodingMethod(int methodID) {
if(methodID > 0) {
if(!CipherHandler.activeCiphers.containsKey(methodID)) {
CipherHandler.activeCiphers.put(methodID, new CipherPanel(methodID).createPanel(this));
}
else CipherHandler.activeCiphers.remove(metho... | 3 |
public static void render(){
for(int i = 0; i < ACTIONSLOTS; i++){
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0f, 0f, 0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(Game.PLAYER.getCameraX() + Game.SCREEN_WIDTH / 2 - 2 - ACTIONSLOTS*17 + i*2 + i*32, Game.PLAYER.getCameraY());
GL11.glV... | 8 |
private void modifyObjectClass(SootClass cl) {
// TODO Auto-generated method stub
//add 'implements' relation
cl.addInterface(poolObj);
//add finalizePoolObject() method
SootMethod finalize = new SootMethod("finalizePoolObject", new ArrayList<Type>(), VoidType.v(), Modifier.PUBLIC);
cl.addMethod(finaliz... | 3 |
private void printLocationInfo() {
String presentCharacters = "Present characters: ";
boolean found = false;
for (Character character : characters.values()) {
if (character.getLocation() == player.getLocation()) {
presentCharacters += character.getName() + "; ";
... | 3 |
private void signUpButtonActionPerformed(java.awt.event.ActionEvent evt) {
String psw, cpsw;
String u_name;
String fname;
String lname;
String emailId;
psw = new String(password.getPassword());
cpsw = new String(confirmPsw.getPassword());
u_name = userName.getText();
fname ... | 7 |
static private final void step6()
{ j = k;
if (b[k] == 'e')
{ int a = m();
if (a > 1 || a == 1 && !cvc(k-1)) k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1) k--;
} | 7 |
private boolean checkSquare(int row,int col,int val) {
int rowStart = (-1)*(row % 3);
int colStart = (-1)*(col % 3);
for(int i = rowStart; i < rowStart+3;i++) {
for(int j = colStart; j < colStart+3;j++) {
if(b[row+i][col+j] == val)
return false;
}
}
return true;
} | 3 |
public void loadBoardDimensions(String layoutFile) throws BadConfigFormatException, FileNotFoundException {
FileReader reader = new FileReader(layoutFile);
Scanner scan = new Scanner(reader);
String temp;
int lineCount = 0;
int cellCount = 0;
int cellCount2 = 0;
temp = scan.nextLine();
lineCount++;
St... | 2 |
public static int toInteger(Object value) {
if(value != null && Double.class.isAssignableFrom(value.getClass()) ){
return ((Double)value).intValue();
}
else if(value != null && String.class.isAssignableFrom(value.getClass()) ){
String text = (String)value;
if( ... | 6 |
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 Mat generateBoardProjection(Mat boardThreshold, boolean ui)
throws VisionException {
// Find the polygon enclosing the blue connect four board
LinkedList<MatOfPoint> contours = new LinkedList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(boardThreshold, contours, hierarchy,
... | 6 |
public static void main(String[] args) {
riverDB = readCSV ("/home/arno/workspace/CampPlaner/data/river.csv");
System.out.println (riverDB);
try {
System.out.println ("saving...");
riverDB.write ("riverdb.xml");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
... | 2 |
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == e.VK_W) {
}
if (keyCode == e.VK_S) {
}
if (keyCode == e.VK_A) {
}
if (keyCode == e.VK_D) {... | 4 |
@Override
public String toString() {
String wString = "";
switch (this) {
case ROCK:
wString = "R";
break;
case PAPER:
wString = "P";
break;
case SCISSORS:
wString = "S";
... | 3 |
public void testWithFieldAdded_nullField_zero() {
MonthDay test = new MonthDay(9, 6);
try {
test.withFieldAdded(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst...
// harga = 444;
int ribuan[] = new int[10];
int counter=0;
String temphasil="";
while(harga/1000!=0){
ribuan[counter] = harga%1000;
counter++;
//temphasil = temphasil + ribuan+".";
harga = harga /1000... | 9 |
public void execute(
String line,
Map<String, EntityUser> users,
Map<String, EntityDocument> documents,
ConstantTime constantTime) {
this.st = new StringTokenizer(line);
this.users = users;
this.documents = documents;
String commandName = st.nextToken();
if (commandName.equa... | 5 |
public static boolean isInputPressed(GameContainer container, List<Integer> input) {
for (Integer key : input) {
if (container.getInput().isKeyPressed(key)) {
return true;
}
}
return false;
} | 2 |
public List<String> findStrings(String expr)
throws XPathExpressionException
{
List<String> strings = new ArrayList<String>();
NodeList nodes = findNodes(expr);
for(int i=0; i<nodes.getLength(); i++)
{
strings.add(nodes.item(i).getNodeValue());
... | 1 |
public void setCommandButtonFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.buttonComFontStyle = UIFontInits.COMBUTTON.getStyle();
} else {
this.buttonComFontStyle = fontstyle;
}
somethingChanged();
} | 1 |
public void updateTeam(String newId) {
if (id != null) {
PreparedStatement st = null;
String q = "UPDATE team SET id = ?, name = ?, location = ? WHERE id = ?";
try {
conn = dbconn.getConnection();
st = conn.prepareStatement(q);
... | 3 |
@Override
public List<AdminNotice> getNoticeList() {
log.debug("get admin notice list");
Connection conn = null;
Statement statement = null;
ResultSet rs = null;
ArrayList<AdminNotice> list = new ArrayList<AdminNotice>();
StringBuilder sql = new StringBuilder();
sql.append(" select note_id, note_type,... | 8 |
public static void main(String[] args) {
// LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>();
// compras.put(1, new Compra(1,2,"bolis"));
// compras.put(2, new Compra(2,4,"pera"));
// compras.put(3, new Compra(3,8,"gafas"));
LinkedHashMap<Integer, Persona> pers... | 1 |
public void run() {
String command;
try {
while (true) {
command = input.readLine();
if (command.startsWith("MOVE")) {
System.out.println(command);
//TODO make the split command more reada... | 5 |
public static void main(String[] args){
int sum=0;
for(int i=2;i<1e7;i++){
int dsum=0;
for(char c:Integer.toString(i).toCharArray()){
dsum+=Math.pow(Integer.parseInt(""+c), 5);
}
if (dsum==i){ sum+=i; System.out.println(i);}
}
System.out.println(sum);
} | 3 |
public void refresh(Camera camera) {
for(GraphicForm gForm : graphForms)
gForm.refresh(camera);
} | 1 |
public static boolean isBlue(int c) {
int r = (c >> 16) & 0xFF;
int g = (c >> 8) & 0xFF;
int b = c & 0xFF;
return (r < 100 && r > 60) && (g < 115 && g > 80) && (b < 215 && b > 190);
} | 5 |
public static CtMethod delegator(CtMethod delegate, CtClass declaring)
throws CannotCompileException
{
try {
return delegator0(delegate, declaring);
}
catch (NotFoundException e) {
throw new CannotCompileException(e);
}
} | 1 |
public String getDescription() {
if (fullDescription == null) {
if (description == null || isExtensionListInDescription()) {
fullDescription = description == null ? "(" : description + " (";
// build the description from the extension list
Enumeration ... | 6 |
public static void main(String[] args){
Set<Long> pent = new HashSet<Long>();
for(long i=1;i<1e4;i++){
pent.add(i*(3*i-1)/2);
}
Long min = Long.MAX_VALUE;
for(Long a : pent){
for(Long b : pent){
if (pent.contains(a+b) && pent.contains(Math.abs(a-b)) && a!=b){
if (Math.abs(a-b) < min){
Sys... | 7 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
// Pega o contato referente a linha especificada.
Contato contato = linhas.get(rowIndex);
switch (columnIndex) {
case ID:
return contato.getId();
case NOME:
return contato.getNome();
case APELIDO:
... | 8 |
@Override
public void closeWindows() {
System.out.println("closeWindows");
} | 0 |
private Secteur chargerUnEnregistrement(ResultSet rs) throws DaoException {
try {
Secteur secteur = new Secteur(null,null);
secteur.setCode(rs.getString("SEC_CODE"));
secteur.setLibelle(rs.getString("SEC_LIBELLE"));
return secteur;
} catch (SQ... | 1 |
public boolean run() {
Utils.getString("city/index");
Utils.getString("casino/slotmachine");
try {
JSONObject data = Utils.getJSON("casino/slotmachineData/0");
// {"jackpot":"192028","fortunes":"990","error":"ok","freispiele":0,"spiele":100,"bet":0}
int min = 100;
if (modus == 2) {
min = 250;
... | 4 |
public void addScore (final String score) {
this.scores.add(score);
} | 0 |
private static void performPerHalogenoSubstitution(BuildState state, Fragment perhalogenFrag, Element subBracketOrRoot) throws StructureBuildingException {
List<Fragment> fragmentsToAttachTo = findAlternativeFragments(subBracketOrRoot);
List<Atom> atomsToHalogenate = new ArrayList<Atom>();
for (Fragment fragment ... | 9 |
public void doBetting(GameVars gv, CustomPoker cp)
{
boolean ripe = false;
int idx = betOffset;
int lastPlayerToRaise = -1;
while (!ripe)
{
idx = idx%players.size();
if (idx != -1 && idx == lastPlayerToRaise)
{
ripe = true;
break;
}
if (lastPlayerToRaise == -1)
lastPlayerToRaise = ... | 8 |
@EventHandler
public void CaveSpiderJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCaveSpiderConfig().getDouble("CaveSpide... | 6 |
public static void sayit(int tc,String msg){
String tmsg[]=msg.split("<4;2>0:");
String player = tmsg[0];
String capplayer=player;
player=player.toLowerCase().trim();
String u1=GosLink.prps("muser1");
String u2=GosLink.prps("muser2");
if (TC1.ghost ==1 || TC2.ghost == 1){tmsg[1]=tmsg[1]+"\n";}
if (!play... | 5 |
private ITaggedValue getTaggedValue(String tagKey, boolean isCreateIfNotExist) {
ITaggedValue ret = null;
boolean isInTransaction = TransactionManager.isInTransaction();
try {
ProjectAccessor projectAccessor = ProjectAccessorFactory.getProjectAccessor();
IModel project =... | 9 |
private void tryToCookIt(final Order o) {
EnumItemType food = o.choice;
if(mRole.mItemInventory.get(food) < mItemThreshold) {
if(!mRole.mHasCreatedOrder.get(food)) {
mRole.mItemsDesired.put(food,baseNeed);
}
}
... | 7 |
private boolean calculateVelocities() {
boolean end1 = true, end2 = true;
for (Point p : frontier.innerBorder) {
velocities[p.x][p.y] = calculateVelocity(p);
if (end1 && velocities[p.x][p.y] < 0) {
end1 = false;
}
}
for (Point p : frontier.outerBorder) {
velocities[p.x][p.y] = calculateVelocity(... | 7 |
public void visitJumpInsn(final int opcode, final Label label) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendLabel(label);
buf.append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitJumpInsn(opcode, label);
... | 1 |
public ResultatenScherm(final Spel spel) {
ArrayList<GekozenAntwoord> gekozenAntwoorden = spel.getGekozenAntwoorden();
setBackground(new Color(43, 43, 43));
setBorder(null);
setLayout(new MigLayout("", "[grow][77px][grow]", "[grow][20px,growprio 50,grow][grow]"));
JPanel panel = JPanelFactory.createBackgrou... | 8 |
public static Matrice getShortestPaths(Matrice mat){
Matrice A = new Matrice(mat.getData());
for(int k=0; k < mat.getNbLines(); k++){
for(int i=0; i< mat.getNbLines(); i++){
for(int j=0; j< mat.getNbColumns(); j++){
if((A.getValueAt(i,k) + A.getValueAt(k,j)) < A.g... | 4 |
@Override
public void draw(Graphics2D g) {
if(flicker)
flickerTimer++;
if(flickerTimer > 50){
flickerTimer = 0;
flicker = false;
}
if(flickerTimer % 5 == 0)
{
super.draw(g);
}
} | 3 |
@Override
public Item swap(Item newItem) {
Item temp = null;
try{
temp = weaponItem;
//weaponItem = null;
weaponItem = (WeaponItem) newItem;
return temp;
}catch(Exception e){
weaponItem = (WeaponItem) temp;
temp= null;
return newItem;
}
//return temp;
} | 1 |
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) {
if (c != null && string != null) {
try {
return Enum.valueOf(c, string.trim().toUpperCase());
} catch (IllegalArgumentException ex) {
}
}
return null;
} | 3 |
public void setHmac(Key key){
Mac hmac = null;
try {
hmac = Mac.getInstance("HmacSHA256");
} catch (NoSuchAlgorithmException e) {
System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage());
}
try {
hmac.init(key);
} catch (InvalidKeyException e) {
System.err.println... | 3 |
private LLNode exchangeUp(LLNode t) {
LLNode left = t.prev.left;
LLNode right = t.prev.right;
LLNode prev = t.prev.prev;
LLNode cleft=t.left;
LLNode cright=t.right;
int vcheck=t.prev.val;
LLNode cprev = t;
if(!isEqual(t,left)){
t.left=... | 6 |
public void setPriceCode(int arg) {
switch (arg) {
case REGULAR:
price = new RegularPrice();
break;
case NEW_RELEASE:
price = new NewReleasePrice();
break;
case CHILDRENS:
price = new ChildrensPrice();
break;
default:
throw new IllegalArgumentException("Incorrect Price Code");
}
... | 3 |
private static String testDataToStiring(classifiedData Data){
String out = "";
//Add Cedd data
int i = 0;
for(i = 0; i < Data.getCEDDData().length; i++){
out = out + Data.getCEDDData()[i] + ",";
}
// System.out.println("CEDD data added for image " + Data.getImgName() + " is: " + i);
//Add FCTH d... | 2 |
public void getInput() {
String command;
Scanner inFile = new Scanner(System.in);
do {
this.display();
command = inFile.nextLine();
command = command.trim().toUpperCase();
switch (command) {
... | 6 |
@Override
protected void paintComponent(Graphics g){
super.paintComponent(g);
g.drawString("test", 0, 0);
} | 0 |
private void nextEvent()
{
if (eventCount >= TOTAL_EVENTS)
{
state = BanditState.DONE;
if (currentUser.isLogging())
{
game.log.sendByteBySocket(SocketToParallelPort.TRIGGER_BANDIT_DONE);
}
}
else
{
eventCount++;
if (winCount >= TOTAL_WIN)
{
... | 9 |
public void dismissBox() {
dispose();
// CLIP.stop();
} | 0 |
private void reset(JCheckBoxMenuItem... checkBoxMenuItems) {
for (JCheckBoxMenuItem checkBoxMenuItem : checkBoxMenuItems) {
checkBoxMenuItem.setState(false);
}
} | 1 |
@Override
public List<Player> findWinner() {
sortHands();
// Find the top score
List<Player> winners = new ArrayList<Player>();
for (int i = currentPlayers.size() - 1; i >= 0; i--) {
if (Hand.getHandValue_OneCard(currentPlayers
.get(currentPlayers.size() - 1).getHands().get(0)) == Hand
.getHandVa... | 5 |
public Zone retrieveZone(String zoneName)
{
if(zones != null)
{
//Iterate through zones, returning the zone with name specified by
//zoneName. Once a zone is returned the method terminates
for(int i=0; i< zones.size(); i++)
{
if(zones.get(i).name == zoneName)
return zones.get(i);
}
}
/... | 4 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder("User(");
boolean first = true;
sb.append("firstName:");
if (this.firstName == null) {
sb.append("null");
} else {
sb.append(this.firstName);
}
first = false;
if (!first) sb.append(", ");
sb.appe... | 8 |
boolean isPerpendicularAttackPlacementNotHarming(int position, int dimension, char[] boardElements) {
return isAttackPlaceHorizontallyRightNotHarming(position, boardElements, dimension, attackPlacesOnTheRight(position, dimension))
&& isAttackPlaceHorizontallyLeftNotHarming(position, boardElement... | 3 |
@BeforeClass
public static void beforeClass() {
System.out.println("Testing WordReader Started.");
_dictionary = new WordReader("/dict4test.txt");
} | 0 |
public static void main(String[] args) {
int x = 7;
System.out.println("x = " + Integer.toBinaryString(x));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
... | 0 |
public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length... | 6 |
public JointAppointmentFinalized(Appointment appt)
{
this.appt = appt;
} | 0 |
public void setHeight(Double height) {
this.height = height;
} | 0 |
public void performStructureConsistencyVerification(Tile topTile){
int jWidthTop = 0;
int kWidthTop = 0;
int jWidthBot = 0;
int kWidthBot = 0;
int total = 0;
System.out.println("DATASTRUCTURE CONSISTENCY VERIFICATION");
Tile leftCornerTile = topTile;
while(leftCornerTile.leftDown != null){
leftCornerTile =... | 9 |
public final void setAlias(String name) {
if (name != null) {
Identifier rep = getRepresentative();
rep.wasAliased = true;
rep.alias = name;
}
} | 1 |
@Test
public void testInsert() {
int size = 10000;
int range = 10000;
Random r = new Random();
int[] test = new int[size];
for(int i=0;i<size;i++)
test[i] = r.nextInt(range);
long start = System.currentTimeMillis();
for(int i=0;i<size;i++)
instance.insert(i, test[i]);
long end = System.currentTim... | 8 |
public boolean contains(int x, int y)
{
return x1 <= x &&
y1 <= y &&
x2 >= x &&
y2 >= y;
} | 3 |
public void addScore(int score){
scores.add(score);
//Calculates average score
int total = 0;
for(int s : scores){
total+=s;
}
if(score < lowscore || lowscore == 0){
lowscore = score;
}
if(score > highscore){
highscore = score;
}
//Checks for zero division
if(scores.size() ... | 5 |
public ArrayList<ArrayList<Integer>> rangeCombine(int startN, int endN,
int k) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
int countInRange = endN - startN + 1;
if (startN > endN || countInRange < k)
return result;
// count in range same as k, only one comb
if (countI... | 9 |
protected synchronized void scheduleNext() {
if ((active = tasks.poll()) != null) {
executor.execute(active);
}
} | 1 |
public static URL getCharacterPortraitURL(long characterID, short size) throws ApiException {
if(Arrays.binarySearch(characterPortraitSizes, size) < 0)
throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes));
try {
return new URL(IMA... | 2 |
public static void main(String args[]) throws IOException {
System.out.println(" ___ \n" +
" / _ \\ \n" +
"/ /_\\ \\_ __ __ _ _ __ __ _ _ __ ___ __ _ _ __ \n" +
"| _ | '_... | 2 |
public boolean InsertarProveedor(Proveedor p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} | 1 |
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Please input the robot name!");
return;
}
String[] answer = null;
if (args[0].equalsIgnoreCase("Judy")) {
answer = JudyAnswer;
} else if (args[0].equalsIgnoreCase("Max")) {
answer = MaxAnswer;
}
if (null == ... | 9 |
public void run() {
ReplyMessage sysinfo;
try {
while(comm.isOpen()) {
sysinfo = comm.execute(new SystemStatusRequest());
System.out.println(sysinfo);
Thread.sleep(2000);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 2 |
@Override
public String getColumnName(int column){
String name = "??";
switch (column){
case 0:
name ="RaavareID";
break;
case 1:
name ="Raavare Navn";
break;
case 2:
name ="Kostpris pr. stk.";
break;
case 3:
name ="Antal Total";
break;
case 4:
name ="Kostpris Ialt";
break;
... | 5 |
public static final void next(boolean goUp, long[] x, long[] n) {
if(goUp == false) {
if(!isLeaf(x)) {leftChild(x,n);} else next(true,x,n);
} else {
if(isRoot(x)) done(n);
else {
long[] p = {0,0,0,0};
parent(x,p);
if(isL... | 4 |
private void printTaskTrees() {
System.out.println("Task Trees:");
for (Iterator iter = taskTrees.iterator(); iter.hasNext(); ) {
Tree nextTree = (Tree)iter.next();
Tree.printTree(nextTree);
}
} | 1 |
@Override
public void add(Task taskBean) {
try {
connection = getConnection();
ptmt = connection.prepareStatement("INSERT INTO Task(description, title, id_owner) VALUES(?,?,?);");
ptmt.setString(1, taskBean.getDescription());
ptmt.setString(2, taskBean.getTitl... | 5 |
public CacheIndice(RandomAccessFile dataFile, RandomAccessFile indexFile, int id) {
this.maxFileSize = 99999999;
this.id = id;
this.dataFile = dataFile;
this.indexFile = indexFile;
try {
for (int i = 0; i < indexFile.length() / 6L; i++) {
byte[] data = null;
data = get(i);
if (data != null)
... | 3 |
public static void main(String[] args) {
String use = "";
LookAndFeelInfo[] available = UIManager.getInstalledLookAndFeels();
for(LookAndFeelInfo info : available) {
if(info.toString().contains("Nimbus")) {
use = info.toString();
}
}
try {
... | 6 |
private static void parseValueElement(Element element,
ConfigurableEmitter.Value value) {
if (element == null) {
return;
}
String type = element.getAttribute("type");
String v = element.getAttribute("value");
if (type == null || type.length() == 0) {
// support for old style which did not write the... | 9 |
public static void printPokerCombInOrder(int minRank, int maxRank) {
int hand[] = new int[5];
int answerHand[][] = new int[2598960][5];
double maxValue = maxRank * Math.pow(13, 5);
double minValue = minRank * Math.pow(13, 5);
System.out.println("max Value: " + minValue);
System.out.println("min Val... | 9 |
public Perceptron getPerceptron(String name) {
for (String a : perceptrons.keySet()) {
if (name.equalsIgnoreCase(a)) {
return perceptrons.get(a);
}
}
return null;
} | 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.