text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void unicast (Message m, int delay) {
int src = m.getSource();
int dst = m.getDestination();
Record source = r.find (src);
Record destination = r.find (dst);
if ((source == null) || (destination == null)) {
/* In this unlikely event. */
String msg =
String.format("Error: link <P%d, P%d... | 7 |
protected boolean eval(IEvaluationContext context, Expr a, boolean strict)
throws ExprException {
if (a == null)
return true;
if (a instanceof ExprEvaluatable) {
a = ((ExprEvaluatable) a).evaluate(context);
}
if (a instanceof ExprNumber) {
... | 9 |
private static boolean Biparticao_Visit(Graph grafo, int u, int[] cor, int corPai) {
if (corPai == 1) {
cor[u] = 2;
} else {
cor[u] = 1;
}
for (int i = 0; i < grafo.getNlc(); i++) {
if (grafo.getElement(u, i) > 0) {
if (cor[i] == cor[u])
return false;
if (cor[i] == 0)
Biparticao_Visit... | 5 |
protected final void onKeyPress(char var1, int var2) {
if(var2 == 14 && this.name.length() > 0) {
this.name = this.name.substring(0, this.name.length() - 1);
}
if("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_\'*!\"#%/()=+?[]{}<>".indexOf(var1) >= 0 && this.name.length... | 4 |
private void addDirNode(final Element root, final File dir)
{
final Element dirnode = new Element("Directory");
root.addContent(dirnode);
dirnode.setAttribute("name", dir.getName());
final File[] list = dir.listFiles();
for (final File f : list) {
if (f.isFile() && f.exists()) {
this.progressModel... | 4 |
@Test
public void getVertexSetNeigourhoodTest2(){
VertexSet s = new VertexSet();
s.addVertex(city_graph.getCity(0));
s.addVertex(city_graph.getCity(1));
VertexSet v = city_graph.getVertexSetNeighbourhood(s);
VertexSet expect = new VertexSet();
expect.addVertex(city_graph.getCity(9));
expect.addVertex(... | 0 |
@Override public void init() {
control = new HeatControl();
control.setTargetEnabled(true);
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(long now) {
if (now > lastTimerCall + 1_000_000_000l) {
... | 3 |
public String getName() {
return name;
} | 0 |
public Class<? extends Annotation> annotationOf(Field field) {
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
return item.getAnnotation();
}
return null;
} | 2 |
@Test
public void testSetState() throws IOException {
System.out.println("setState");
int newState = 9;
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
instance.setState(newState);
} | 0 |
@EventHandler
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
if (event.getDestination().getHolder() instanceof Hopper) {
Hopper hopper = (Hopper) event.getDestination().getHolder();
hopperHandler(hopper, event.getItem(), event);
}
} | 1 |
public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... | 4 |
@Override
public void process(ConsoleCommandContext consoleCommandContext) {
final String argument1 = getArgument(consoleCommandContext, 1);
final String argument2 = getArgument(consoleCommandContext, 2);
String column = argument1.substring(0, 1);
String row = argument1.substring(1, 2);
int columnIndex = -1;... | 5 |
public static void AdjustSaturation(BufferedWrapper bw, int adjustQuantity)
{
Color newColor;
float[] hsbvals = new float[3];
float saturation;
BufferedImage bi2 = new BufferedImage(bw.img.getWidth(), bw.img.getHeight(), bw.img.getType());
for (int x = 0; x < bw.img.getWidth(); x++)
{
f... | 7 |
public List findByProblemId(Object problemId) {
return findByProperty(PROBLEM_ID, problemId);
} | 0 |
public void keyPressed(KeyEvent e) {
GameAction gameAction = getKeyAction(e);
if (gameAction != null) {
gameAction.press();
}
// make sure the key isn't processed for anything else
e.consume();
} | 1 |
public static Set<PosixFilePermission> toPosixPermissions(int mode) {
Set<PosixFilePermission> permissions = new HashSet<>();
if ((mode & 0b001_000) == 0b001_000) {
permissions.add(PosixFilePermission.GROUP_EXECUTE);
}
if ((mode & 0b100_000) == 0b100_000) {
permissions.add(PosixFilePermissio... | 9 |
public void run() {
String inputLine, outputLine;
System.out.println("\tHilo iniciado");
try {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
inputLine = in.readLine();
//while ( !(inp... | 8 |
public RORobotInstance() {
joystickHandler = new ROJoystickHandler();
dashboardData = new RODashboardData();
packetTransmitter = new ROPacketTransmitter(joystickHandler);
packetTransmitter.setDashboardData(dashboardData);
} | 0 |
public static boolean downloadHookLibrary(LauncherFrame frame, String baseURL)
{
Util.Family family = Util.getFamily();
Util.Arch arch = Util.getArchitecture();
String extension = Util.getNativeExtension();
if(family == Util.Family.UNSUPPORTED || arch == Util.Arch.UNSUPPORTED)
return false;
String file = ... | 3 |
public static String compress(String s) {
String dest = "";
if (s.length() == 0) return s;
char c = s.charAt(0);
for (int i = 1; i < s.length(); i++) {
if (c == ' ' &&
((s.charAt(i) == ' ') ||
(s.charAt(i) == ',') ||
(s.charA... | 8 |
public static void main(String[] args)
{
Exception3 e1 = new Exception3();
try
{
e1.method("hello");
}
catch(MyException e)
{
System.out.println("进入输入是null的异常!before");
e.printStackTrace();
System.out.println("进入输入是null的异常!after ");
}
// catch(MyException1 e)
// {
// System.out.println("进... | 2 |
public void closeConnections() {
try {
if (myResultSet != null) {
myResultSet.close();
}
if (myPreparedStatement != null) {
myPreparedStatement.close();
}
if (connect != null) {
connect.close();
}
} catch (Exception e) {
System.out.println(e.toString());
// Ein Dialogfenster... | 4 |
public void updatePercent(){
pastPrices.add(price);
if (pastPrices.size() > 300)
pastPrices.remove(); // remove oldest price after 300 passed
double oldP = pastPrices.peek(); // oldest value in queue
percentChange = ((price - oldP)/price) * 100;
percentChange = (double)(Math.round(percentChange * 100)) / 100;... | 2 |
private static double[] toLab(final int red, final int green, final int blue)
{
//The weight of chromaticity [0, ∞[, 1 is unweighted.
final double chromaWeight = 1;
int ir = red ; if (ir < 0) ir += 1 << 8;
int ig = green; if (ig < 0) ig += 1 << 8;
int ib = blue ; if (ib < 0) ib += 1 << 8;
do... | 9 |
private String drop() {
StringBuilder sb = new StringBuilder();
sb.append( "DROP TABLE " + table.getTableName() + ";\n" );
if ( buildSequence ) {
sb.append( "DROP SEQUENCE " + table.getTableName() + "_SEQ;\n" );
}
return sb.toString();
} | 1 |
public void run() {
while(true) {
System.out.print(this);
if (--countDown == 0)
return;
}
} | 2 |
public static boolean getMouseDown(int mouseButton)
{
return getMouse(mouseButton) && !lastMouse[mouseButton];
} | 1 |
static String getValidFeedback(String code, String guess){
if (code.length() != guess.length()){
return "0b0w";
}
int b = 0;
int w = 0;
Map<String,Integer> codeMap = new HashMap<String,Integer>();
Map<String,Integer> guessMap = new HashMap<String,Integer>();
for (int i = 0; i < code.le... | 7 |
@SuppressWarnings("rawtypes")
public Map activity(String uid, String rewardId,
Map<Integer, String> priceMap) {
Connection connection = DBconnection.getInstance();
Statement stmt;
String value = null;
try {
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("");
while (rs.next()... | 8 |
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage: java UnitsConverter <weight in pounds>");
System.exit(0);
}
numberToConvert = Double.parseDouble(args[0]);
System.out.println("lbs " + args[0] + " equals:\n");
for (Converter converter : Converter.values()) {
... | 2 |
public void setDisplay(int[][] values) {
if(values.length== PAGE_SIZE && values[0].length== PAGE_SIZE) {
for(int row = 0; row < values.length; row++) {
for(int col = 0; col < values[row].length; col++) {
userValues[row][col] = values[row][col];
}
... | 4 |
public void finish ()
{
boolean noNukes = false;
try {
checkTalking ();
get (RIO_COMM_END, 0, 0);
get (RIO_UNKNOWN_42, 0, 0);
} catch (IOException e) {
// ignored
} catch (IllegalStateException e) {
noNukes = true;
} finally {
if (!noNukes)
talking = null;
}
} | 3 |
@Override
public void run()
{
while (running)
try
{
Task t = taskQueue.take();
if (chunks.isTaskStillValid(t))
{
chunks.setChunk(t.px, t.pz, chunks.makeChunk(t.px, t.pz));
... | 3 |
public static String printLine(String... values) {
// set up a CSVUtils
StringWriter stringWriter = new StringWriter();
CSVPrinter csvPrinter = new CSVPrinter(stringWriter);
// check for null values an "null" as strings and convert them
// into the strings "null" and "\"null\""
... | 3 |
private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 3; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2()... | 7 |
public ArrayList<Piece> getPieces(boolean color)
{
ArrayList<Piece> answer = new ArrayList<Piece>();
for(Piece[] pieces:theGrid)
{
for(Piece p : pieces)
{
if(p!=null&&p.isWhite()==color)
{
answer.add(p);
}
}
}
return answer;
} | 4 |
public String getName(){
return name;
} | 0 |
public String setUpdate() {
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() && file.getName().endsWith(".mail") && file.getName().startsWith("TODEL")) {
file.delete();
}
}
}
ret... | 5 |
private void parsePath(List list, String path) {
if (path == null) {
return;
}
if (path.length() == 0) {
// is_absolute_path is ambiguous so we won't change anything
this.file = null;
return;
}
// Determine if the path is absolute
if (path.startsWith(PATH_DELIM)) {
this.is_absolute_path... | 9 |
public static byte[] readFile(String dir, String filename)
{
FileInputStream fileInputStream=null;
File file = new File(dir+"/"+filename);
byte[] bFile = new byte[(int) file.length()];
try {
fileInputStream = new FileInputStream(file);
fileInputStream.read(bFile);
... | 1 |
public PluginLoader(String directory, Class<? extends IPlugin> type) throws MalformedURLException {
// check whether the URL is a directory
File dirFile = new File(directory);
if (dirFile == null || ! dirFile.isDirectory()) {
String errmsg = directory + " is not a directory";
logger.warning(errmsg);
... | 4 |
@Override
public void reduce(IntWritable key, Iterable<Text> values,
Context context)
throws IOException, InterruptedException {
Map<String, Double> temp= new HashMap<String, Double>();
for (Text value : values) {
String countryName = value.toString();
if(temp.contai... | 2 |
public static PropertyValue getPropertyValue(String property, RDFNode n) {
PropertyValue p = new PropertyValue();
p.setProperty(property);
if (n.isResource() || n.isURIResource()) {
p.setType(PropertyType.URI);
p.setValue(n.asResource().getURI());
} else if (n.isLiteral()) {
Literal l = n.asLiteral();
... | 7 |
public CustomWorld(final World w) {
super();
this.w = w;
gp.renderWorld(w);
setLayout(new FlowLayout());
add(xCoorL);
add(yCoorTF);
add(yCoorL);
add(xCoorTF);
add(doneBut);
add(cancelBut);
add(elementBox);
add(addBut);
add(gp);
Util.cntrl = new Controller(w);
addBut.addActi... | 7 |
public void updateFromScorecard(ScorecardSummary summary) {
addAlbatrosses(summary.getAlbatrosses());
addPars(summary.getPars());
addBirdies(summary.getBirdies());
addBogeys(summary.getBogeys());
addDoubleBogeys(summary.getDoubleBogeys());
addTripleBogeys(summary.getTripleBogeys());
addEagles(summar... | 1 |
private void txtHome_telephone_NumberKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtHome_telephone_NumberKeyPressed
if (evt.getKeyCode() == 38) {
txtAddress.grabFocus();
} else if (evt.getKeyCode() == 40) {
txtMother_Name.grabFocus();
} else if (evt.getKeyCode() == 37) {
... | 3 |
public void execute(List<String> inputs, StringBuilder output) {
Map<String, TokenIdentifier> identifiers = new HashMap<String, TokenIdentifier>();
for (String input : inputs) {
output.append("Lexer\n");
Lexer lexer = new Lexer();
Parser parser = new Parser();
Evaluator evaluator = new Evaluator();
... | 8 |
private boolean searchUpForNextSupersetNode( Node node, K key, Object[] ret ) {
if( node.mRight != null && mComp.compareMaxes( key, node.mRight.mMaxStop.mKey ) <= 0 ) {
// Request downward search on right subtree.
ret[0] = node.mRight;
return false;
}
while( ... | 8 |
private static void initialize(){
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex)... | 6 |
public void setSize(int width, int height) {
if (width < 0 || height < 0
|| width > RASTER_MAX_WIDTH || height > RASTER_MAX_HEIGHT) {
// Invalid width or height.
throw new ExceptionInvalidParam();
} else if (width == 0 || height == 0) {
// An empty noi... | 8 |
public static LinkedHashMap<String,Object> arrayListToLinkedHashMap(ArrayList<?> arr) {
if (arr == null) return new LinkedHashMap<String,Object>();
//is this the same as arr2hm?
int i=0;
LinkedHashMap<String,Object> hm = new LinkedHashMap<String,Object>();
for (Object value: arr) {
hm.put(String.valueOf(i... | 3 |
private static void printExceptPublicMembers(Member[] mems){
for (Member m : mems) {
Annotation[] annotations = new Annotation[0];
if (m instanceof Field) {
annotations = ((Field)m).getAnnotations();
}
if (m instanceof Constructor) {
annotations = ((Constructor<?>)m).getAnnotations();
}
if ... | 8 |
public static void main(String[] args) throws IOException {
LockManager manager = new LockManager("230.0.0.1", "Node1");
manager.start();
} | 0 |
public MultiplePane(JSplitPane split) {
super(new BorderLayout());
add(split, BorderLayout.CENTER);
mySplit = split;
} | 0 |
public void resoutRatio(Probleme p) {
int bestScore = p.valeurSelection();
double[][] tab = ratio(p);
double tmp = 0, tmp2 = 0;
for (int d = p.nombreItem(); d != 0; d--) {
for (int a = 0; a < d; a++) {
if (tab[a][0] < tab[a + 1][0]) {
tmp = tab[a][0];
tmp2 = tab[a][1];
tab[a][0] = tab[a + ... | 7 |
public static void main(String[] args){
System.out.println("Hello World");
int[]s = {4,1,0};
List<List<Integer>> result = new ArrayList<List<Integer>>();
result = new Subsets().subsets(s);
for(int i = 0 ; i< result.size();i++)
System.out.println(Arrays.toString(result... | 1 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void renderCrisis() {
if(b)
i++;
else {
i--;
}
if(i >= 100) {
b = false;
}
else if(i <= 0) {
b = true;
}
Iterator<IScreenItem> it = screenItems.descendingIterator();
boolean bgDone = f... | 7 |
public static String getMarkerSVG( double x, double y, String clr, int marker )
{
String markersvg = "<use x='" + x + "' y='" + y + "' stroke='" + clr + "' fill='" + clr + "' xlink:href='#";
if( marker == 1 ) // square
{
markersvg += "square1'/>";
}
else if( marker == 2 ) // diamond
{
markersvg += "d... | 9 |
@Override
public void confirmQuotes(String clientName) throws ReservationException {
Set<Reservation> newReservations = new HashSet<Reservation>();
try {
for (Quote quote : this.quotes) {
CarRentalCompany company = RentalStore.getRentals().get(quote.getRentalCompany());
... | 4 |
public static boolean checkPlaceRoomBounds(int x, int y, Room room,
int ratioX, int ratioY, int rotation) {
if (x == 0 && room.hasWestDoor(rotation))
return false;
if (y == 0 && room.hasSouthDoor(rotation))
return false;
if (x == ratioX - 1 && room.hasEastDoor(rotation))
return false;
if (y == ratio... | 8 |
public boolean isNewline(String ign) {
return ign.equals("\n")||ign.equals("\r")||ign.equals("\r\n");
} | 2 |
public int diff_xIndex(LinkedList<Diff> diffs, int loc) {
int chars1 = 0;
int chars2 = 0;
int last_chars1 = 0;
int last_chars2 = 0;
Diff lastDiff = null;
for (Diff aDiff : diffs) {
if (aDiff.operation != Operation.INSERT) {
// Equality or deletion.
chars1 += aDiff.text.leng... | 6 |
public synchronized boolean moveDown(int slotID) {
if (!_isOpen) {
return false;
}
if ((slotID < 0) || (slotID >= _slots.size())) {
return false;
}
if (!_slots.get(slotID).isOccupied()) {
return false;
}
int nextSlotID ... | 7 |
public void listenUser(){
MeinScanner myscan = new MeinScanner();
ArrayList<Object> liste = myscan.scanInput();
if(liste == null){
System.out.println("Befehl nicht verstanden!");
this.listenUser();
}else if(liste.get(0)=="Add" && liste.get(1)!=null){
... | 9 |
public void refresh(){
int i,j;
this.ventana.remove(panel);
panel=new JPanel();
panel.setLayout(null);
for(i=0;i<15;i++){
for(j=0;j<15;j++){
this.panel.add(buttonMatrix[i][j].boton);
}
}
this.ventana.getContentPane().add(panel);
this.ventana.setVisible(true);
} | 2 |
@Override
public void handleCloseElementEnd(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws ParseException {
if (!this.insideAllSelectorMatchingBlock) {
this.someSelectorsMatch = false;
... | 8 |
public StoneStair(Point p, boolean up) {
super(p);
this.up = up;
if (up) {
flagCommand(Command.UP);
addFlag(EntityFlag.POINT_MOVE_UP);
controller = new StairController(this, up, EnviroSprite.stone_stair_up);
} else {
flagCommand(Command.DOW... | 1 |
private BitSet selectRectangles(String str) {
int n = view.getNumberOfInstances(RectangleComponent.class);
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
for (int i = 0; i < n; i++) {
if (view.getRectangle(i).isSelected())
bs.set(i);
}
return bs;... | 8 |
protected boolean isFinished() {
return super.isFinished() || Robot.oi.getLeftDrive() != 0 || Robot.oi.getRightDrive() != 0;
} | 2 |
@Override
public void awardPoints(int amount) {
points += amount;
} | 0 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addTreeSelectionListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} | 0 |
protected void maintainScrollBar(boolean horizontal, double factor,
boolean center)
{
JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar()
: getVerticalScrollBar();
if (scrollBar != null)
{
BoundedRangeModel model = scrollBar.getModel();
int newValue = (int) Math.round(model.getValue() * ... | 3 |
@Override
public void run() {
try {
synchronized (this) {
while (true) {
while (ofertasRecursosLivres.isEmpty()) {
wait(tempoWaitVerificacoesLocais);
}
OfertaEmprego empregoLivre = buscarOfertaEmp... | 9 |
private void added (DeviceImpl dev)
{
if (Windows.trace)
System.err.println ("notify add " + dev);
// call synch'd on devices
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try { listener.deviceAdded (dev); }
catch (... | 4 |
@Override
public int getLoginTimeout() throws SQLException {
return 0;
} | 0 |
public void inicio(AreaFormacao areaformacao) throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(areaformacao.getId());
id.setEditable(false);
id.setEnabled(false);
nome = new JTextField(areaformacao.getNome() == null ? ""
: areaformacao.getNome());
JPanel pp = new JPanel();
Design... | 1 |
boolean anyMove (int x,int y, OthelloPiece colour){
boolean valid = false;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_2,colour)) valid=true;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_3,colour)) valid=true;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_1,colour)) valid=true;
if(move(... | 8 |
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 int playSecondThrow(Player player, PlayerFrameHistory frame, int previousThrowScore) {
int maxPossibleScore = 10-previousThrowScore;
int score = -1;
do {
System.out.print("How much did you score, " + player.getName() + "? (Type 'exit' to interrupt the game)");
S... | 7 |
@Override public void sign(String apikey) {
this.apikey = apikey;
} | 0 |
public LogInFrame() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().setLayout(new MigLayout("", "[fill][185.00][30.00][41.00]", "[][][][][][][][fill][pref!,center][][][][][]"));
setSize(275,450);
JLabel usernameLabel = new JLabel("Username:");
usernameLabel.setHorizontalAlignment(SwingConstants.LE... | 2 |
private void fillRandomItems(String string, int amt, int index) {
// fills a random item into the contents array
switch (string) {
case "gun":
contents[index] = getRandomGun();
break;
case "sword":
contents[index] = getRandomSword();
break;
case "item":
contents[index] = getRandomItem();
br... | 6 |
public static void startUploading(String url) {
if (url == null) {
BmLog.error("Cannot start SamplesUploader: server did not send callBack URL");
return;
}
callBackUrl = new StringBuilder(url);
samplesUploaderThread = new Thread(new Runnable() {
@Overr... | 5 |
public boolean handleRightClick(Point clickPoint) {
if (shouldRender) {
HUDArea hudArea = null;
if (isInside(clickPoint)) {
//start from the top and work our way down to "layer" the huds
for (int i = (hudAreas.size() - 1); i >= 0; i--) {
... | 4 |
protected String getUndoText() {
if (!canUndo()) {
return "Cannot undo.";
}
int i = insertionPoint - 1;
for (; (i >= 0) && (!edits.get(i).isSignificant()); i--) {
String description = edits.get(i).describeUndo();
if (!description.equals("undo")) {
... | 7 |
public static String formatString(final boolean format, final CharSequence object) {
if (object == null) return "null";
final String space = (format ? "\\n\"+\n\"" : "\\n");
final StringBuilder result = new StringBuilder("\"");
int last = -1, next = 0;
final int size = object.length();
while (next < size) {... | 7 |
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 == 0)
{
return false;
}
else if (par7 == 1)
{
return false;
}
else
{
... | 8 |
public static List<Long> getUnique(List<Long> ids) {
Long[] idsArray = ids.toArray(new Long[ids.size()]);
Arrays.sort(idsArray);
List<Long> uniqueList = new ArrayList<Long>();
for (long id : idsArray) {
if (uniqueList.isEmpty() || (id != uniqueList.get(uniqueList.size() - 1))) {
uniqueLi... | 3 |
public int[] attack(Country t1, Country t2) {
int[] result = new int[3];
result[0]=0;
result[1]=0;
result[2]=0;
if (gameState==STATE_ATTACKING) {
if (
t1!=null &&
t2!=null &&
t1.getOwner()==currentPlayer &&
t2.getOwner()!=currentPlayer &&
t1.isNeighbours(t2) &&
// t2.isNeig... | 9 |
public static boolean getDataMaskBit(int maskPattern, int x, int y) {
if (!QRCode.isValidMaskPattern(maskPattern)) {
throw new IllegalArgumentException("Invalid mask pattern");
}
int intermediate, temp;
switch (maskPattern) {
case 0:
intermediate = (y + x) & 0x1;
break;
... | 9 |
static void warshallFloydWithPath(int[][] dists, int[][] path) {
int n = dists.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
path[i][j] = j;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int ... | 8 |
public void addBanner(Banner banner) {
if (banner != null) {
if (banner.getBannerType() == BannerListType.SERIES) {
addSeriesBanner(banner);
} else if (banner.getBannerType() == BannerListType.SEASON) {
addSeasonBanner(banner);
} else if (banne... | 5 |
public void updateMidiInSelectedItems(String[] midiInDevices) {
for (int i = 0; i < midiInMenu.getItemCount(); i++) {
String name = midiInMenu.getItem(i).getText();
if (name == null || name.equals("No MIDI Input Devices Enabled")) {
continue;
}
Str... | 7 |
public void jumpTo(int paramInt)
{
if (paramInt < 0)
this.CurrentIndex = 0;
if (paramInt >= this.Indexes.length)
if (this.Loop)
this.CurrentIndex = (paramInt - this.Indexes.length);
else
this.CurrentIndex = (this.Indexes.length - 1);
setImage(this.Cells[this.Indexes[this.... | 3 |
@SuppressWarnings("rawtypes")
public static void settingsDialog(){
final JFrame f = new JFrame();
JTabbedPane mainPane = new JTabbedPane();
JPanel buttonPanel = new JPanel();
CBeanRolloverButton ok = CBeanRolloverButton.GetOkButton("OK","Save the settings");
CBeanRolloverButton cancel = CBeanRolloverButto... | 8 |
@Override
public boolean equals(Object other)
{
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return isEqual(this.first, otherPair.first) &&
isEqual(this.second, otherPair.second);
}
return false;
} | 2 |
public RegisterPanel(FacelookInitGUI j) {
super();
container = j;
this.setBackground(Color.decode("#3b5998"));
this.setBorder(new EmptyBorder(5, 5, 5, 5));
this.setLayout(new MigLayout("", "[grow]", "[][][][][][][][]"));
JLabel lblFacelook = new JLabel("Facelook");
lblFacelook.setForeground(Color.WHITE... | 9 |
public void setNote(String note) {
this.note = note;
} | 0 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.