text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected int getVersionIndex(String romId) {
switch (romId) {
case "BRBJ0":
return 0;
case "BRKJ0":
return 1;
case "BRBE0":
case "BRBP0":
return 2;
case "BRKE0":
case "BRKP0":
return 3;
default:
throw new IllegalArgumentException("Unknown ROM ID \"" + romId
+ "\".");
... | 6 |
public static void main(String[] args) {
Scanner number = new Scanner(System.in);
System.out.println("Enter number to check Prime : ");
int chk = number.nextInt();
int i;
if( chk == 2){
System.out.println(chk +" Number is prime ");
}else{
for( i=2; i<=chk-1; i++){
if... | 4 |
@Override
public void resize(BufferedImage srcImage, BufferedImage destImage)
throws NullPointerException
{
super.performChecks(srcImage, destImage);
int currentWidth = srcImage.getWidth();
int currentHeight = srcImage.getHeight();
final int targetWidth = destImage.getWidth();
final int targetHeigh... | 8 |
private void generatePrimitiveWriter(CodeVisitor cw,
Method method,
String className)
{
String fieldName = makeFieldName(method);
Class type = getClassOfMethodSubject(method);
cw.visitVarInsn(ALOAD, 0);
if (type == int.class... | 8 |
public static String plumpColumnName(final String kin, final Set<String> seen) {
String k = kin.toUpperCase();
final int colonIndex = k.indexOf(':');
if(colonIndex>0) { // get rid of any trailing : type info
k = k.substring(0,colonIndex);
}
k = stompMarks(k).replaceAll("\\W+"," ").trim().replaceAll("\\... | 7 |
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if (response.isCommitted()) {
return;
}
String uri = request.getRequestURI();
String context = request.getContextPath();
if (uri.endsWit... | 9 |
@SuppressWarnings("unchecked")
@Override
public void refreshView(Map<String, Map<String, Object>> state) {
// Extract the maps from the state
//
Map<String, Object> mapState = state.get("mapState"), dayState = state
.get("dayState");
LinkedList<Map<String, Object>> elementList = (LinkedList<Map<String, O... | 6 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int inpay=sc.nextInt();
int iapay=sc.nextInt();
if(iapay < inpay){
System.out.println("null");
return;
}
if((iapay-inpay)>100){
System.out.println("null");
return;
}
if(iapay ==... | 3 |
@Override
public void setNegativeFlag(boolean flagIsOn) {
try {
Image img;
if (flagIsOn) {
img = ImageIO.read(getClass().getResource("/resources/vdk-light-colour.png"));
if (!CECIL_RESOLUTION.equals(CECIL_RESOLUTION_HIGH)) {
img = img.getScaledInstance(ICON_SMALL.width, ICON_SMALL.height, Image.SC... | 4 |
public void printInfos(Graphics g)
{
if (inEditor)
level.printInfo(g, player.getPos(), player.getVisibility());
} | 1 |
static void dradf4(int ido,int l1,float[] cc, float[] ch,
float[] wa1, int index1,
float[] wa2, int index2,
float[] wa3, int index3){
int i,k,t0,t1,t2,t3,t4,t5,t6;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
t1=t0;
t4=t1<<1;
t2=t1+(t1<<1);
... | 7 |
@Override
public void run() {
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out... | 2 |
public static void addFriendship(String username1, String username2) {
User user1 = getUserByUsername(username1.trim());
if (user1 == null) {
System.out.println("User " + username1 + " NOT FOUND");
}
User user2 = getUserByUsername(username2.trim());
if (user2 == null) {
System.out.println("User " + user... | 2 |
public void run() {
for (int id : Equipment.getAppearanceIds())
if (id != -1)
equipIds.add(new PkItem(id, 1, false));
for (Item item : Inventory.getItems()) {
if (item == null || item.getId() == -1)
continue;
PkItem pkItem = get(invItems, item.getId());
if (pkItem == null)
invItems.add(new P... | 6 |
public static Object getField(Field field, Object target) {
try {
return field.get(target);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
throw new IllegalStateException(
"Unexpected reflection exception - "
+ ex.getClass().getName() + ": " + ex.getMessage());
}
} | 1 |
@Override
public int indexOf( Object elem )
{
if( elem == null )
{
for( int i = 0; i < size; i++ )
{
if( elementData[i] == null )
{
return i;
}
}
}
else
{
for( int i = 0; i < size; i++ )
{
if( elem.equals( elementData[i] ) )
{
return i;
}
}
}
return -1... | 5 |
@Override
public void actionPerformed(ActionEvent e) {
GuiThreatSelection guiThreatSelection =
GuiThreatSelection.getInstance(this);
List<ThreatClass> threats = guiThreatSelection.getSelectedThreats();
if (guiThreatSelection.getComponentMenuItem() instanceof MenuItemApplet) {
String url = JOptionPane.show... | 5 |
public void draw(Point point){
switch (selectedTool) {
case IMAGE:
createImage(point);
break;
case TEXT:
createText(point);
break;
case LINE:
drawLine(point);
break;
case RECTANGLE:
drawRect(point);
break;
case ELLIPSE:
drawEllipse(point);
break;
case MOVE:
hand(point);
... | 8 |
public KeyPair generate() {
BigInteger p, q, n, d;
// 1. Generate a prime p in the interval [2**(M-1), 2**M - 1], where
// M = CEILING(L/2), and such that GCD(p, e) = 1
int M = (L+1)/2;
BigInteger lower = TWO.pow(M-1);
BigInteger upper = TWO.pow(M).subtract(ONE);
byte[] kb = n... | 9 |
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request,
VaadinResponse response) throws IOException {
if (!"/remoteConsole".equals(request.getPathInfo())) {
// Not for us
return false;
}
int contentLength = request.getContentL... | 6 |
@Test
public void shaMethodTest() throws IOException {
String result = null;
TeleSignRequest tr;
if(!timeouts && !isHttpsProtocolSet)
tr = new TeleSignRequest("https://rest.telesign.com", "/v1/phoneid/standard/" + PHONE_NUMBER, "GET", CUSTOMER_ID, SECRET_KEY);
else if(timeouts && !isHttpsProtocolSet)
tr ... | 6 |
public void setCity(String city) {
this.city = city;
} | 0 |
@Override
public void deserialize(Buffer buf) {
int limit = buf.readUShort();
positionsForChallengers = new short[limit];
for (int i = 0; i < limit; i++) {
positionsForChallengers[i] = buf.readShort();
}
limit = buf.readUShort();
positionsForDefenders = ne... | 3 |
public void testUnmatchedOpenParenthesis() throws Exception {
String openParenString = "(3 + 5";
try {
new Expression(openParenString);
fail("Did not throw exception");
} catch (MalformedParenthesisException mpe) {}
} | 1 |
public void setUpComparisonBars() {
overBars.clear();
underBars.clear();
float toScale = 0.05f;
for (int i = 0; i < nbars; i++) {
int over = beatMarket.histogram[i];
int under = marketBeat.histogram[i];
int absDiff = Math.abs(over - under);
int top = (int) (frameH - SIDE_BUFFER - (int) (toScale * ... | 3 |
public void setEntityDead(Entity var1) {
if (var1.riddenByEntity != null) {
var1.riddenByEntity.mountEntity((Entity) null);
}
if (var1.ridingEntity != null) {
var1.mountEntity((Entity) null);
}
var1.setEntityDead();
if (var1 instanceof EntityPlay... | 3 |
public void setRefreshing(boolean refreshing) {
if(refreshJob == null) {
refreshJob = new RefreshJob();
}
boolean prev = isRefreshing;
isRefreshing = refreshing;
if(refreshing && !prev) {
Thread t = new Thread(refreshJob);
t.start();
}
} | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Perifericos)) {
return false;
}
Perifericos other = (Perifericos) object;
if ((this.idPeriferico == null && oth... | 5 |
@Test
public void testGetDescriptionFirstPhone() {
Map<String, Object> descriptionFirstPhone = new HashMap<String, Object>();
descriptionFirstPhone.put("name", "Cink Five");
descriptionFirstPhone.put("brandName", "Wiko");
descriptionFirstPhone.put("screenSize", 5);
descriptionFirstPhone.put("screenType", Scr... | 8 |
public static boolean distanciaUnaLetra (final String cad1, final String cad2){
if (cad1.length() == cad2.length() ){
final String cadena1 = cad1.toUpperCase(LOCALE_ES);
final String cadena2 = cad2.toUpperCase(LOCALE_ES);
for (int i = 0; i < cad1.length(); i++){
... | 7 |
public void fill(byte[] b) {
int coordinate = 0;
storagePointer = NumberUtils.byteArrayToInt(Arrays.copyOfRange(b,
coordinate, coordinate + 4));
coordinate += 4;
int parent_storagePointer = NumberUtils.byteArrayToInt(Arrays.copyOfRange(
b, coordinate, coor... | 9 |
public SampleResult runTest(JavaSamplerContext context) {
SampleResult sampleResult = new SampleResult();
sampleResult.sampleStart();
String key = null ;
if(keyRondom){
key = String.valueOf(String.valueOf(new Random().nextInt(keyNumLength)).hashCode());
}else{
key = String.valueOf(SequenceKey.getsequenc... | 6 |
public void save(Map map){
File f = new File("assets/maps/" + map.getName());
try {
biEx.save(map, f);
} catch (IOException ex) {
Logger.getLogger(MapLoader.class.getName()).log(Level.SEVERE, null, ex);
}
} | 1 |
* @return Returns true if the cell is bendable.
*/
public boolean isCellBendable(Object cell)
{
mxCellState state = view.getState(cell);
Map<String, Object> style = (state != null) ? state.getStyle()
: getCellStyle(cell);
return isCellsBendable() && !isCellLocked(cell)
&& mxUtils.isTrue(style, mxCons... | 3 |
@Override
protected Class<?> loadClass(String name, boolean resolve)
{
try {
if ("outpost.sim.Player".equals(name) ||
"outpost.sim.Point".equals(name) || "outpost.sim.Pair".equals(name) || "outpost.sim.movePair".equals(name))
return parent.loadClass(name);
... | 6 |
@Override
public void initialise()
{
for (int client = 0; client < 8; client++ )
{
int arrival = masterAgent.agent.getClientPreference(client, TACAgent.ARRIVAL);
int departure = masterAgent.agent.getClientPreference(client, TACAgent.DEPARTURE);
int cheapAuctionNo = TACAgent.getAuctionFor(TAC... | 7 |
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 void initToolbar(JToolBar toolBar) {
//NEW BUTTON - creates a new simulation with a new turing machines
JButton btnNew = createIconButton("/icons/ic_new.png", TOOLBAR_BUTTONSIZE);
btnNew.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TuringMachin... | 5 |
public void read() throws IOException {
if (!cached) {
next();
}
cached = false;
} | 1 |
@Post
public Representation accept(Representation entity) throws IOException
{
try
{
host = (getRequestAttributes().get("host") == null) ? host :
((String) getRequestAttributes().get("host")).trim();
port = (getRequestAttributes().get("port") == null) ? port :
Integer.parseInt(((String) get... | 9 |
private String createUserList() {
FilmothekModel model = new FilmothekModel();
ArrayList<UserBean> users = model.getUsers();
String userList = "<select name='userID' size='1'>";
for (Iterator<UserBean> it = users.iterator(); it.hasNext();) {
UserBean userBean = it.next();
... | 2 |
public Image[] getCells(ImageRetriever paramImageRetriever, int paramInt1, int paramInt2)
{
Integer localInteger = new Integer(paramInt1);
if (this.animationList == null)
this.animationList = new Hashtable();
Object localObject = this.animationList.get(localInteger);
Image[] arrayOfImage;
if... | 4 |
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
// start line
String name = this.getNameAndupspace();
if(null!=name){
sb.append(name);
}else{
// please set directiveName
return null;
}
for(int i=0;i<listParam.size();i++){
if(null != listParam.get(i)){
Strin... | 4 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected instanceof Item)
&&(((Item)affected).owner() instanceof Room)
&&(((Room)((Item)affected).owner()).isContent((Item)affected))
&&(msg.sourceMinor()==CMMsg.TYP_SPEAK)
&&(invoker!=null)
... | 7 |
private void treeClicked(MouseEvent e) {
TreePath selPath = this.tree.getPathForLocation(e.getX(), e.getY());
if (selPath == null)
return;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath
.getLastPathComponent();
Object userObj = node.getUserObj... | 9 |
public static int priority(String operator)
{
if (operator.equals("+") || operator.equals("-"))
return 1;
else if (operator.equals("*") || operator.equals("/"))
return 2;
else if (operator.equals("^"))
return 3;
else
return 0;
} | 5 |
public int minCut(String s) {
// Start typing your Java solution below
// DO NOT write main() function
int n = s.length();
if (n <= 1)
return 0;
boolean[][] res = new boolean[n][n];
int[] dp = new int[n];
for (int i = 0; i < n; i++)
res[i][i] = true; // 第一层初始化
for (int i = 1; i < n; i++) {
int ... | 8 |
@Test
public void testInvert() {
/*
* Test with constant values.
*/
gf = new GF2N(283);
PolynomialGF2N polyGF = new PolynomialGF2N(gf);
Polynomial polynomial1 = new Polynomial(3);
polynomial1.setElement(0, 195);
polynomial1.setElement(1, 103);
... | 6 |
private void connectForest() {
List forest = new ArrayList();
Stack stack = new Stack();
NodeList tree;
graph.nodes.resetFlags();
for (int i = 0; i < graph.nodes.size(); i++) {
Node neighbor, n = graph.nodes.getNode(i);
if (n.flag)
continue;
tree = new NodeList();
stack.push(n);
while (!sta... | 9 |
public static void listMembers(){
ArrayList<beansMiembro> listaMembers = null;
listaMembers = ManejadorMiembros.getInstancia().getLista();
if(listaMembers.size() >= 0){
for(beansMiembro miembro : listaMembers){
mostrarMiembro(miembro, 0);
verAdentro(miembro,1);
}
}else{
System.out.println("No ... | 2 |
private static void test(String input, String output, int v, String dir) {
int n = input.length();
boolean[] voters = new boolean[n];
int i;
/* convert the string into an array of booleans */
for (i = 0; i < n; i++) {
voters[i] = (input.charAt(i) == 'A');
}
Opinion.update(voters, v);
/* check the outp... | 7 |
public void doGet(HttpServletRequest request, HttpServletResponse response) {
response.setContentType("text/html");//设置服务器响应的内容格式
// response.setCharacterEncoding("gb2312");//设置服务器响应的字符编码格式。
DButil ab = new DButil();
try {
PrintWriter pw = response.getWriter();
St... | 2 |
public Type getType(Environment<Type> env) throws TypeIllegalException,
TypeEnvironmentException {
Token op = getChild(1).jjtGetFirstToken();
Type left = getChild(0).getType(env);
Type right = getChild(2).getType(env);
if (op.kind == PseuCoParserConstants.PLUSASSIGN) {
if (right.getKind() == Type.STRING... | 9 |
public static String guessEmotion(String s) {
int sad = 0;
int happy = 0;
int angry = 0;
String v = s.toLowerCase().trim();
String result = "I cant guess your emotion.";
File file = new File("help/emo.txt");
ArrayList<String> emoTXT = IOTools.readFile(file);
for (String n : emoTXT) {
String args[] =... | 9 |
@Override
public ZemObject eval(Interpreter interpreter) {
if(arguments.size() < 1){
return null;
}
Node node = arguments.get(0);
UserFunction fun = null;
if(node instanceof VariableNode){
fun = (UserFunction) interpreter.getSymbolTable().get(((Vari... | 5 |
public static byte[] Kinverse(byte[] t, BigInteger n, int L) {
byte[] output = new byte[L];
for (int i = 0; i < L; i++) {
output[i] = t[(int) kappa(t.length, n, i + 1)];
}
return output;
} | 1 |
@Override
public void parseXML(String xml)
{
final List<XMLLibrary.XMLTag> V=CMLib.xml().parseAllXML(xml);
if((V==null)||(V.size()==0))
return;
final List<XMLLibrary.XMLTag> xV=CMLib.xml().getContentsFromPieces(V,"AREAS");
root.clear();
String ID=null;
String NUMS=null;
if((xV!=null)&&(xV.size()>0))
... | 9 |
public void doTraining(Team team) {
// with injuries
int nofPlayers = team.getNofPlayers();
for (int i = 0; i < nofPlayers; i++) {
Player player = team.getPlayer(i);
int ranRange;
if (getEffort() == Effort.EASY) {
ranRange = 230;
} else if (getEffort() == Effort.NORMAL) {
ranRange = 200;
} ... | 6 |
public String getName() {
return name;
} | 0 |
@Override
protected boolean shouldBlock(Entity e) {
if (e instanceof Bullet)
return false;
if ((e instanceof Mob) && !(e instanceof RailDroid) && !((Mob) e).isNotFriendOf(owner))
return false;
return e != owner;
} | 4 |
@Override
public void deserialize(Buffer buf) {
alignmentSide = buf.readByte();
alignmentValue = buf.readByte();
if (alignmentValue < 0)
throw new RuntimeException("Forbidden value on alignmentValue = " + alignmentValue + ", it doesn't respect the following condition : alignmentV... | 5 |
private static void createStone(int width, int height) {
for(int x = 0; x < width; x++) {
for(int y = stoneBoundary; y < height; y++) {
blockSheet[x][y] = World.STONE;
}
}
} | 2 |
public void printArray(PrintableStringWriter stream) {
{ two_D_array self = this;
{ int nofRows = self.nofRows;
int nofColumns = self.nofColumns;
int limit = 9;
stream.print("|i|[");
{ int row = Stella.NULL_INTEGER;
int iter000 = 0;
int upperBound000 = nof... | 6 |
int afterRoot() throws IOException {
int n = in.next();
switch (n) {
case ' ':
case '\t':
case '\r':
case '\n':
in.back();
String ws = parseWhitespace(in);
if (!isIgnoreWhitespace()) {
set(JSONEventType.WHITESPACE, ws, false);
}
return AFTER_ROOT;
case -1:
return -1;
case '{':
ca... | 9 |
@Override
public void setDataObject(IRemoteCallObjectData data) {
this.data = data;
} | 0 |
public void setOptions(String[] options) throws Exception {
String numFolds = Utils.getOption('F', options);
if (numFolds.length() != 0) {
setNumFolds(Integer.parseInt(numFolds));
} else {
setNumFolds(0);
}
String numRuns = Utils.getOption('R', options);
if (numRuns.length(... | 7 |
private void toPixel(int[][] matrix, int h, int w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
double re = fd[j * h + i].re();
double im = fd[j * h + i].im();
int ii = 0, jj = 0;
int temp = (int) (Math.sqrt(re * re + im * im) / 100);
if (temp > 255)
temp = 255;
if ... | 5 |
public Board boardEquiv() {
Board b = new Board();
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
DerpyPiece p = arr[x][y];
boolean pieceColor = p.getColor();
Piece db = null;
if (p instanceof DerpyBishop) {
db = new Bishop(pieceColor);
} else if (p instanceof DerpyBlank) ... | 9 |
int evaluateState(Checker[][] state) {
int whiteNumber = 0;
int blackNumber = 0;
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 4; col++) {
if (state[row][col] != null) {
if (state[row][col].getColor() == 1) {
w... | 9 |
public void setPrice(double price) {
if (price <= 0) {
throw new IllegalArgumentException("Price should be bigger than zero");
}
this.price = price;
} | 1 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DataStructure that = (DataStructure) o;
if (calibrationKey != that.calibrationKey) return false;
if (implementedChannels != that.implementedCha... | 7 |
public boolean deathChecker() {
if (state == GestureState.LIFE || state == GestureState.DEATH) {
// If hand is below shoulder
if (usingLeftArm) {
if ((GestureInfo.gesturePieces[GestureInfo.LEFT_ARM_ANGLE_DECREASING])
|| (!GestureInfo.gesturePieces... | 9 |
private void endAudio(String to) {
if (to.equals("slide"))
slide.addEntity(audio);
else if (to.equals("quizslide"))
quizSlide.addEntity(audio);
else if (to.equals("scrollpane"))
scrollPane.addEntity(audio);
else if (to.equals("feedback"))
quizSlide.addFeedback(audio);
} | 4 |
public Rectangle getSecondCorner() {
return secondCorner;
} | 0 |
@Override
public void execute() {
Socket s = null;
try {
while (!stop && !runningThread.isInterrupted()) {
try {
s = serverSocket.accept();
} catch (SocketException se) {
log.info("Received a shutdown request: " + se);
stop = true;
} catch (IOException ioe) {
log.error("IO-error... | 9 |
public boolean login()
{
if(!loaded || username.isEmpty() || password.isEmpty())
return false;
Users.addUser(this);
logins++;
loggedIn = true;
save();
System.out.println(username+" has logged in.");
return true;
} | 3 |
public int longestValidParentheses(String s) {
// Start typing your Java solution below
// DO NOT write main() function
char[] c = s.toCharArray();
Stack<Integer> store = new Stack<Integer>();
int[] right = new int[c.length];
int res = 0;
for (int i = 0; i < c.le... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employee employee = (Employee) o;
if (id != employee.id) return false;
if (firstName != null ? !firstName.equals(employee.firstName) : employee... | 8 |
public static Object[] isSignatureOK(Map<String, String> docEndorserInfo,
Node node) {
try {
DOMValidateContext context = createContext(node);
XMLSignature signature = extractXmlSignature(context);
boolean coreValidation = signature.validate(context);
if (coreValidation) {
KeyInfo keyInfo = si... | 6 |
public ArrayList<AbstractCookie> populateCookies(){
cookies = new ArrayList<AbstractCookie>();
for (int i = 0; i < this.getSize(); i++){
for(int k = 0; k < this.getSize(); k++)
if(i == 0 && k == 0){
cookies.add(new PoisonCookie(i, k));
}
else if(i == 0 && k == 1){
cookies.add(new BlueCo... | 9 |
public void simulateBullyBotAttack(){
Planet source = null;
Planet dest = null;
// (1) Apply your strategy
double sourceScore = Double.MIN_VALUE;
double destScore = Double.MAX_VALUE;
for (Planet planet : planets) {
if(planet.Owner() == 2) {// skip planets with only one ship
if (planet.NumShips... | 8 |
public String execute(DeleteCalendarObject deleteCalendarObject) throws SQLException{
String answer = "";
resultSet = queryBuilder.selectFrom("Calendars").where("CalendarName", "=", deleteCalendarObject.getCalendarToDelete()).ExecuteQuery();
resultSet.next();
String calendarID = resultSet.getString("calendarID"... | 8 |
public static void showMessageDialog(Component parentComponent, String htmlContent, String title, int messageType, Icon icon)
{
// for copying style
JLabel label = new JLabel();
Font font = label.getFont();
// create some css from the label's font
StringBuffer style = new St... | 4 |
private int getInt(String test) {
int page;
try {
page = Integer.parseInt(test);
if (page < 1) {
page = 1;
}
} catch (NumberFormatException e) {
page = 1;
}
return page;
} | 2 |
private void destruction() {
System.out.println("TestTesT");
if (!connectionSocket.isClosed()) {
try {
connectionSocket.close();
} catch (IOException e) {
}
}
} | 2 |
public void setWireSeparation(double separation){
if(separation<=0.0D)throw new IllegalArgumentException("The wire separation, " + separation + ", must be greater than zero");
if(this.wireRadius!=-1.0D && separation<=2.0D*this.wireRadius)throw new IllegalArgumentException("The wire separation distance, ... | 5 |
public void addfromIndex(String file){
try{
Scanner readFrom =new Scanner(new InputStreamReader
(new FileInputStream(file)));
if(file.equals("yourindex.txt")){
if(readFrom.hasNextLine()==false){
JOptionPane.showMessageDialog(null, "The file is probably empty.\nPlease click on \"Add... | 6 |
public void advice(String msg) {
System.out.println("Called ..." + LoggerUtils.getSig() + "; msg:" + msg);
} | 0 |
private String whichBinary(String type)
{
for (int i = 0; i < Expression.binaryTypes.length; i++)
{
if (type.equals (Expression.binaryTypes[i]))
{
if(type.equals("plus")||type.equals("minus")||type.equals("times")
||type.equals("divided by"))
{
return "operator";
}
else if(type.e... | 8 |
public boolean equals(Object otherO) {
if (otherO == null) {
return false;
}
if (!(otherO instanceof Picture)) {
return false;
}
Picture other = (Picture) otherO;
if (image == null || other.image == null) {
return image == other.image;
}
if (image.getWidth() != other.... | 9 |
@EventHandler
public void onClick(PlayerInteractEvent e) {
Action action = e.getAction();
if (action == Action.RIGHT_CLICK_BLOCK) {
Player player = e.getPlayer();
Location loc = e.getClickedBlock().getLocation();
if (e.getClickedBlock().getType() == Material.SIGN
|| e.getClickedBlock().getType() == M... | 6 |
private void createObjectSpawnRequest(int delayUntilRespawn, int id2,
int face2, int type, int y, int type2, int z, int x,
int delayUntilSpawn) {
GameObjectSpawnRequest request = null;
for (GameObjectSpawnRequest request2 = (GameObjectSpawnRequest) spawnObjectList
.peekLast(); request2 != null; request2 =... | 6 |
@Override
public String toString() {
if(getVariableType() == VariableType.STRING) {
return (String) variable;
} else if(getVariableType() == VariableType.INTEGER) {
return variable+ "";
} else {
return "function";
}
} | 2 |
public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} | 3 |
private void doCollision(int pin1, int pin2, Vector3f distance, boolean clatter) {
Debug.println("PhysicsEngine.doCollision()");
MovableObject[] pins = model.getPins();
MovableObject p1 = pins[pin1];
MovableObject p2 = pins[pin2];
Vector3f p1v = p1.getVelocity();
Vector3f p2v;
float m1 = p1.getMass();
f... | 3 |
public int getIndex(ArrayList<Person> list) {
String[] values = null;
if (supplierComboBox.getSelectedItem() != null) {
values = ((String) supplierComboBox.getSelectedItem()).split("\\t");
int index = 0;
for (Person person : list) {
if (person.getId() == Integer.parseInt(values[1].trim()))
break;
... | 3 |
public Path()
{
movement = new int[Game.map.width][Game.map.height];
pathColor = new Color(0, 75, 255, 128);
attColor = new Color(255, 0, 0, 128);
walkColor = new Color(0, 255, 144, 128);
font = new Font("Arial", Font.PLAIN, 15);
} | 0 |
@Override
public Data execute(Data data)
{
String[] strings = data.getText().split(" ");
Color color = Color.black;
if (strings.length >= 1)
{
try
{
color = stringToColor(strings[1]);
}
catch (NoSuchFieldException e)
{
return null;
}
catch (SecurityException e)
{
e... | 7 |
public void placeCollectableBlock(Player p, Color c){
//do check for collision with other world items
String path = null;
if(c == Color.red){
path = COLLLECTABLEBLOCK_RED_PATH;
}else if(c == Color.green){
path = COLLLECTABLEBLOCK_GREEN_PATH;
}else if(c == Color.blue){
path = COLLLECTABLEBLOCK_BLUE_PA... | 9 |
public T pop() {
if(nodes.size() == 0)
return null;
T t = nodes.get(0);
nodes.remove(0);
return t;
} | 1 |
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.