text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String getHexPeerId() {
return this.hexPeerId;
} | 0 |
private HeaderType(String type) {
this.typeOf=type;
} | 0 |
String []frequencey(double array[]){ // find mode.
int [][]tools = new int[array.length][2];
String shed[] = new String [2];
double []check = array;
int big = 0;
ArrayList<Integer> counter = new ArrayList<Integer>();
int count = 0;
for (int i = 0; i < array.leng... | 5 |
public void day() {
List<Subject> movedAlready = new ArrayList<Subject>();
for (int i = 0; i < grid.getWidth(); i++) {
for (int j = 0; j < grid.getDepth(); j++) {
if (getSubject(i, j) == null
|| movedAlready.contains(getSubject(i, j))) {
... | 6 |
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String line ; (line = in.readLine())!=null; ) {
StringTokenizer st = new StringTokenizer( line );
int i = Integer.parseInt(st.nextToken());
int j = Integer.parseInt(st.ne... | 7 |
public Boolean process() {
// Permissions
if(!plugin.permission.isAdmin(player)) {
noPermission();
return true;
}
// Invalid args
if(args.length < 3) {
sendMessage("Usage:");
sendMessage("/casino type add <type>");
sendMessage("/casino type edit <type>");
sendMessage("/casino type ... | 7 |
public void HoldIfNotActive(){
Iterator<Entry<CallFrame, List<String>>> linkBridgeIterator = linkBridgeLines.entrySet().iterator();
while (linkBridgeIterator.hasNext()) {
Entry<CallFrame, List<String>> entry = linkBridgeIterator.next();
List<String> bridgeList = (List<String>) entry.getValue();... | 6 |
protected static String pumpString(String s, int i)
{
StringBuffer sb = new StringBuffer();
for(int n = i; n > 0; n--)
sb.append(s);
return sb.toString();
} | 1 |
public static Hand findHighestStraight(Set<Card> cardSet) {
CardSetStats stats = new CardSetStats(cardSet);
if (stats.rankList.size() < 5) {
return null;
}
Rank pointerRank = null;
List<Rank> straight = new ArrayList<Rank>();
boolean containsAce = false; // used for wheel straight
for... | 9 |
public static long imageToLong(String name) {
name = name.toUpperCase();
long encoded = 0L;
for (int i = 0; i < name.length(); i++) {
encoded = encoded * 61L + name.charAt(i) - 32L;
encoded = encoded + (encoded >> 56) & 0xffffffffffffffL;
}
return encoded;
} | 1 |
public List<MenuItem> getMenuChoices() throws RuntimeException {
List<MenuItem> items = new ArrayList<MenuItem>();
try {
// Make sure you always open a connection before trying to
// send commands to the database.
db.openConnection(DRIVER, URL, ADMIN, PAS... | 5 |
private Calendar promptForDate(BufferedReader keyboard)
throws IOException {
Calendar date = new GregorianCalendar();
boolean valid = true;
do {
// Prompt and read input
System.out
.print("Task date (Format = DD/MM/YYYY, Default = today): ");
String dateString = keyboard.readLine();
... | 5 |
private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
}... | 3 |
public boolean func_48457_a(EntityPlayer par1EntityPlayer, int par2, int par3, int par4, int par5)
{
if (par5 == 0)
{
--par3;
}
if (par5 == 1)
{
++par3;
}
if (par5 == 2)
{
--par4;
}
if (par5 == 3)
... | 7 |
@Override
public String toString() {
return getURLString();
} | 0 |
public void renderBackground(SpriteSheets sprite, boolean clouds) {
int pixelIndex;
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
int xAbs = x + cameraXCoord;
int yAbs = y + cameraYCoord;
pixelIndex = (xAbs) + (yAbs) * sprite.getXSheetSize();
if(xAbs > 0 && yAbs > 0 && xAbs <... | 7 |
private static void assemblyC(ArrayList<Integer> cList){ //"spaja" listy wszystkich cykli w jedną listę ułożoną w kolejności
asmC.addAll(cycles[cList.get(0)].vxList);
cList.remove(0);
do{
for(int i : cList){
if(asmC.get(asmC.size()-1) == cycles[i].vxList.get(0)){ //jeżeli ostatni == prerwszy
asmC.addA... | 5 |
public boolean inServerDB(Connection con, String file_path) {
boolean result = false;
try {
PreparedStatement ps = con
.prepareStatement("SELECT * FROM db_like_files WHERE path_local = ?");
ps.setString(1, file_path);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
result = true;
} else {... | 2 |
public static void main(String args[]){
System.out.println("Usage of MySQLAccess Object...");
try {
MySQLAccess dbAccess = new MySQLAccess();
dbAccess.register();
dbAccess.connect();
dbAccess.createStatement();
//dbAccess.markerIsTaken(1, "kash098");
//dbAccess.deletePlayer("dice098");
//dbA... | 1 |
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView index() {
return new ModelAndView("index");
} | 0 |
@Override
public boolean scan(String c) {
if (mapOfProductsList.containsKey(c))
return scanProducts.add(c);
return false;
} | 1 |
public void doLoad(String path) {
FileInputStream inputStream = null;
ObjectInputStream deserializer = null;
try {
inputStream = new FileInputStream(path);
deserializer = new ObjectInputStream(inputStream);
dictionary = (Map<String, TreeSet<Document>>) deseria... | 7 |
private static void sqlStore(Status status) throws SQLException{
long sql_pid = Settings.pid;
Settings.pid++;
SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd, HH:mm:ss, z");
String sqlCreateAt = tempDate.format(new java.util.Date(status.getCreatedAt().getTime()));
double sqlGeoLocationLat = 0... | 3 |
@Override
public double access(Balance balance) {
return balance.getBalance();
} | 0 |
public Button(JButton button) {
this.button = button;
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
if (clickHandler != null)
clickHandler.run();
}
});
} | 1 |
public boolean setTileNoUpdate(int var1, int var2, int var3, int var4) {
if(var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height) {
if(var4 == this.blocks[(var2 * this.height + var3) * this.width + var1]) {
return false;
} else {
... | 7 |
public int[] bigPower(int pN, int pn){
int[] number = new int[(int) Math.ceil(Math.log10(pN)*pn) + 1];
java.util.Arrays.fill(number,0);
number[0]=pN;
for(int n = 1; n < pn; n++){
for(int i = 0; i < number.length; i++){
number[i] = number[i]*2;
}
for(int j=0;j<number.length;j++){
if(number[j]>... | 4 |
public void sendMessage(Message msg){
try{
b.writeObject(msg);
}catch(Exception e){
e.printStackTrace();
}
} | 1 |
protected boolean isVector (double x, double y, double z) {
if(x != 0 && y != 0 && z != 0) {
return true;
}
return false;
} | 3 |
public static int getRegimeOfGame(){
Scanner scanner = new Scanner(System.in);
int regimeOfGame = 0;
System.out.println("Please choose regime of game:");
System.out.println("1 - Two players on one computer");
System.out.println("2 - Player vs computer");
System.out.printl... | 5 |
public static void TrieIntTreeDemo() {
TrieTreeAPI<Integer> api = new TrieTreeAPI<Integer>() {
@Override
public Integer[] toArray(Object integer) {
String valueStr = integer.toString();
char[] valueChars = valueStr.toCharArray();
Integer[] value = new Integer[valueChars.length];
for(int i=0;i<va... | 9 |
public void update() {
if(!stallListen) {
up = Keys[KeyEvent.VK_UP] || Keys[KeyEvent.VK_W];
down = Keys[KeyEvent.VK_DOWN] || Keys[KeyEvent.VK_S];
left = Keys[KeyEvent.VK_LEFT] || Keys[KeyEvent.VK_A];
right = Keys[KeyEvent.VK_RIGHT] || Keys[KeyEvent.VK_D];
}
} | 5 |
public boolean find(int value) {
System.out.println("happen " + this.value);
if (value == this.value) {
return true;
} else if (value > this.value) {
if (right == null)
return false;
return right.find(value);
} else {
if (left == null)
return false;
return left.find(value);
... | 4 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(anteriorBt)) {
anterior();
} else if (e.getSource().equals(proximoBt)) {
proximo();
} else if (e.getSource().equals(gravarBt)) {
gravar();
} else if (e.getSource().equals(apagarBt)) {
apagar();
} else if (e.... | 7 |
public String get(String key){
return configproperty.get(key);
} | 0 |
private void updateTopBottom(int myRoot, int destRoot) {
if (toTop[myRoot]) {
toTop[destRoot] = true;
} else if (toTop[destRoot]) {
toTop[myRoot] = true;
}
if (toBottom[myRoot]) {
toBottom[destRoot] = true;
} else if (toBottom[destRoot]) {
toBottom[myRoot] = true;
}
... | 6 |
@Override
public String toString() {
return "{VirtualReplayGain}";
} | 0 |
public static void main(String[] args)
{
Grammar g=new ContextFreeGrammar();
Production[] p=new Production[5];
/* p[0]=new Production("S","bAC");
p[1]=new Production("A","C");
p[2]=new Production("A","a");
p[3]=new Production("B","bAE");
p[4]=new Production("C","cC");
p[5]=new Production("C","B");
p[6... | 0 |
@Test
public void deepMiddleTest() {
IntArray arr = IntArray.from(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26);
for(int i = 8; i >= 6; i--) {
arr = arr.remove(i);
}
for(int i = 15; i >= 9; i--) {
arr = arr.remo... | 5 |
public boolean exists(){
String path = Directory.toString();
//Special case for a directory whose path represents a server name (e.g. "\\192.168.0.1")
if (isWindows && path.startsWith("\\\\")){
if (path.endsWith(PathSeparator)) path = path.substring(0, path.length()-1);
... | 9 |
@Override
public double[] get2DData(int px, int pz, int sx, int sz)
{
double[] sa = a.get2DData(px, pz, sx, sz);
double[] sb = b.get2DData(px, pz, sx, sz);
double[] sw = weight.get2DData(px, pz, sx, sz);
int s = sx*sz;
for(int i = 0; i < s; i++)
{
double w = sw[i];
i... | 3 |
public boolean compleixRes(Clausula c, ClausulaNom cn) {
String d = cn.getDia();
Integer h = cn.getHora();
int g = c.getGrup();
if(h !=-1 && dia != null){
if (!CompleixResDiaHora(c.getAssignatura(), g, d, h)) return false;
}
else if(dia!=null){
if ... | 7 |
@Override
public Operation simplify() {
Expression L = Simplify.mod(this.L);
Expression R = Simplify.mod(this.R);
if ( "1.0".equals(R.getString()) ){
return L.operation;
} else if ( "0.0".equals(L.getString()) ){
return new Number(0);
} else if ( "x".equals(L.getString()) && "x".equals(R.getString()) )... | 4 |
private void setLanguageComboBox(JComboBox comboBox) {
ItemListener[] il = comboBox.getItemListeners();
for (ItemListener i : il)
comboBox.removeItemListener(i);
if (Locale.getDefault().equals(Locale.US))
comboBox.setSelectedIndex(0);
else if (Locale.getDefault().equals(Locale.CHINA))
comboBox.setSelec... | 9 |
public static void main(String[] args) {
try {
Configuration configuration = new Configuration();
configuration
.set("header",
"id,tstamp,Queue Time,Hold Time,Talk Time,Agent Skill,Agent Tenure,Case Severity,Answer Within Service Level,Brand,Case Status,Product,Vendor,Location,Customer Satisfaction,... | 3 |
@RequestMapping(value = "/hello2/{names}/{ages}", method = RequestMethod.GET)
@ResponseBody
public String testMatrixVariable(@MatrixVariable(pathVar = "names", required = false, defaultValue = ValueConstants.DEFAULT_NONE) Map<String, List<String>> names, @MatrixVariable(pathVar = "ages", required = false) Map<String,... | 6 |
@Override
public void remove(ClienteBean oClienteBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oClienteBean.getId(), "cliente");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("ClienteDao.removeCl... | 1 |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBorderCollision(PlayerMoveEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
Location location = player.getLocation().clone();
Location spawnLoc = player.getWor... | 5 |
@Override
public String toString() {
StringBuffer s = new StringBuffer();
int counter = 0;
for (MatterInterval mi : intervals) {
s.append("" + (counter++) + " : ");
s.append(mi.toString() + "\n");
}
return s.toString();
} | 1 |
public Card[] contains(Hand h)
{
Card[] nums = {null, null};
for(int i = 0; i < deck.size(); i++)
if(deck.get(i).getValue() == h.getCard(0).getValue())
for(int j = 0; j < deck.size(); j++)
if(deck.get(j).getValue() == h.getCard(1).getValue() && i != j)
... | 7 |
public void updateDeletePicturefromAlbum(String filePath){
this.albumDao.deletePicture(filePath);
String albumName = "";
for(PictureObject f: pictureList){
if(f.getPath().equals(filePath))
pictureList.remove(f);
albumName = f.getAlbum().getAlbumName();
}
files.setPictureList(pictureList);
if(album... | 5 |
@SuppressWarnings({ "unchecked", "rawtypes" })
public Generator() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setTitle("ASM Generator");
setBounds(100, 100, 500, 351);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayo... | 4 |
public Card draw(boolean from_throwpile)
{
synchronized(Rummy.this)
{
if (Rummy.this.getCurrentPlayer() != p.getPlayer())
return null;
}
if ((player_state != PlayerState.EXPECTING_DRAW) && (player_state != PlayerState.DEALING))
return null;
Card c = null;
if (!hand.holdingExtraC... | 8 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
String nome = jTextField1.getText();
String descricao = jTextArea1.getText();
int ano = Integer.parseInt(jTextField3.getText());
double valor = D... | 2 |
private Constant parseMemberLookup(byte refKind, List<Object> args) {
// E.g.: lookup().findStatic(Foo.class, "name", MethodType)
if (args.size() != 4) return null;
int argi = 0;
if (!"lookup".equals(args.get(argi++))) return null;
short cindex, ntindex, nin... | 8 |
public String toString() {
if (this == UNINITIALIZED_VALUE) {
return ".";
} else if (this == RETURNADDRESS_VALUE) {
return "A";
} else if (this == REFERENCE_VALUE) {
return "R";
} else {
return type.getDescriptor();
}
} | 3 |
@Override
public void run() {
if (SwingUtilities.isEventDispatchThread() == false) {
long WAIT = 1500;
while ((System.currentTimeMillis() - this.myStamp) < WAIT) {
try {
long delay = WAIT - (System.currentTimeMillis() - thi... | 8 |
public int read( ) throws IOException
{
String bits = "";
int bit;
int decode;
while( true )
{
bit = bin.readBit( );
if( bit == -1 )
throw new IOException( "Unexpected EOF" );
bits += bit;
decode = codeTree.getChar( bits );
if( decode == HuffmanTree.INCOMPLETE_CODE )
continue;
el... | 5 |
public List<OSMWay> readWaysFromOSMFile(Document doc) {
List<OSMWay> osmWays = new ArrayList<OSMWay>();
NodeList waysList = doc.getElementsByTagName("way");
// NOTICE: don't put this into condition part of a for-loop,
// because getLength() is a O(n) function.
int length = waysList.getLength();
... | 9 |
@Override
protected void addNewChildrenToOpen(SearchNode parent)
{
boolean[] percepts = board.getPercepts(parent.location.x, parent.location.y);
int danger = 0;
for(int i = 0; i < 2; i++)
if(percepts[i])
danger++;
Point location = parent.getLocation();
SearchNode node = createSearchNode(location.x, l... | 6 |
private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... | 5 |
@Override
public void caseAProgram(AProgram node)
{
inAProgram(node);
if(node.getPrograma() != null)
{
node.getPrograma().apply(this);
}
if(node.getId() != null)
{
node.getId().apply(this);
}
if(node.getInicio() != null)
... | 6 |
@Override
public Long getLongProp(String key, Long value){
Long result = value;
String propValue = getProperty(key);
if (null != propValue){
result = new Long(propValue);
}
return result;
} | 1 |
public int f() {
return 1;
} | 0 |
public File getFile( String fname ) {
JFileChooser fc = new JFileChooser();
fc.setSelectedFile( new File(fname) );
int result = fc.showSaveDialog(new JFrame());
File recvfile;
if (result == JFileChooser.APPROVE_OPTION) {
recvfile = fc.getSelectedFile();
filename = recvfile.getAbsolutePath();
//System... | 1 |
@Override
public final void mouseDragged(MouseEvent me)
{
int sliderIndex = 0;
for (TButton slider : sliders)
{
if (slider.inUse)
if (orientation == VERTICAL)
{
slider.y = me.getY() - 12.5f;
if (slider.y < y)
slider.y = y;
else if (slider.y > y... | 8 |
private static void bootStrap() throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
// print the classpath
// String classPath = System.getProperty("java.class.path");
// System.out.printf("JVM classpath: %s\n", classP... | 5 |
public static String selectAccountType(){
Scanner scan = new Scanner(System.in);
do{
System.out.printf("\n***TIPOS DE CUENTA***\n1-%s\n2-%s\n3-%s\nEscoja uno: ",
PLANILLA, NORMAL, VIP);
int opt = scan.nextInt();
switch(opt){
case 1: ret... | 4 |
public int spaceFor(Service good) {
switch (upgradeForGood(good)) {
case (-1) : return 0 ;
case ( 0) : return 20 ;
case ( 1) : return 35 ;
case ( 2) : return 45 ;
case ( 3) : return 50 ;
}
return 0 ;
} | 5 |
protected void transitionChange(AutomataTransitionEvent event) {
invalidate();
} | 0 |
public static void loadOptionsFile() {
File file = new File("options.ini");
if (file.exists()) {
BufferedReader br;
try {
br = new BufferedReader(new FileReader(file));
String tempString;
try {
while ((tempString... | 9 |
public void setName(String name) {
Name = name;
} | 0 |
public GerirEscolasEquipas(AssociacaoEscolasFutebol a) {
this.a = a;
this.a.addObserver(this);
initComponents();
this.setVisible(true);
for (Escola escola : a.getDAOEscola().values()) {
Escola_ComboBox.addItem(escola.getNome());
}
for (Escola escola ... | 7 |
public static String getPlayerFromUUID(final UUID uuid) {
if (uuid == null)
return null;
final Map<UUID, String> players = getPlayers(Arrays.asList(uuid));
if (players == null)
return null;
if (players.isEmpty())
return null;
if (players.get(uuid) == null) {
throw new Nul... | 4 |
@Override
public void fromMessage(Message message) throws JMSException {
try {
inputStream = ((BlobMessage) message).getInputStream();
} catch (IOException e) {
logger.error("Can't get input stream.", e);
}
} | 1 |
public void setX(int x) {
this.x = x;
} | 0 |
public void addNode (int coefficient, int exponent) {
if (head == null) {
head = new Node(coefficient, exponent);
return;
}
if (head.exponent < exponent) {
Node added = new Node(coefficient, exponent);
added.next = head;
head = added;
return;
} else if (head.exponent == exponent) {
... | 6 |
public void setPerson(PersonBean person) {
this.person = person;
} | 0 |
public final void parameters() throws RecognitionException {
try {
// Python.g:99:12: ( LPAREN ( varargslist )? RPAREN )
// Python.g:99:14: LPAREN ( varargslist )? RPAREN
{
match(input,LPAREN,FOLLOW_LPAREN_in_parameters261); if (state.failed) return;
// Python.g:99:21: ( varargslist )?
int alt10=2;
... | 9 |
@Override
public void run(int interfaceId, int componentId) {
Master master = (Master) player.getTemporaryAttributtes().get(
"SlayerMaster");
if (stage == -1) {
stage = 0;
sendEntityDialogue(SEND_4_OPTIONS, new String[] {
SEND_DEFAULT_OPTIONS_TITLE,
"How many monsters do I have left?",
"Wh... | 6 |
public static boolean handleOption(int option, int longind, String arg) {
if (arg == null)
options ^= 1 << option;
else if ("yes".startsWith(arg) || arg.equals("on"))
options |= 1 << option;
else if ("no".startsWith(arg) || arg.equals("off"))
options &= ~(1 << option);
else {
GlobalOptions.err.print... | 5 |
private void checkObstacleBounds(boolean positiveSide, float delta, float half) {
positionCenter = originalCenter + delta;
if (positiveSide) {
positionCorner = Math.abs(originalCorner + delta);
delta = 0.5f * (positionCenter + positionCorner - half);
if (delta > 0) {
positionCenter -= delta;
positi... | 7 |
private static void drawHistogram(GC gc, int x, int y, int[] histogram, int MAX, int width, int height) {
int gap = 1;
gc.setForeground(Colors.red);
int thickness = 5;
gc.drawRectangle(x - thickness, y - thickness, 256 * gap + 2 * thickness, height + 2 * thickness);
gc.setForeground(Colors.blue);
gc.setLi... | 1 |
public String toString () {
if (!isDisposed () && (parent.getStyle () & SWT.VIRTUAL) != 0 && !cached) {
return "CTableItem {*virtual*}"; //$NON-NLS-1$
}
return super.toString ();
} | 3 |
private int calcNumberOfNodes(double serialProb, double pow2Prob, double uLow,
double uMed, double uHi, double uProb) {
double u = random.nextDouble();
if (u <= serialProb) {// serial job
return 1;
}
double par = twoStageUniform(uLow, uMed, uHi, uProb);
if (u <= (serialP... | 3 |
@Override
public void mouseExited(MouseEvent e) {} | 0 |
Client1() throws IOException {
String s;
System.out.println(getCurrentTime() + "::" +"Starting Client ..");
clientSocket = new Socket("localhost", 38000);
serverIn=new DataInputStream(clientSocket.getInputStream());
serverOut=new DataOutputStream(clientSocket.getOutputStream());
/*--------Reading file from ... | 3 |
private void downloadIfNeeded(String videoID) throws Exception {
if ( !cacheContains(videoID) )
downloadParseSave(videoID);
} | 1 |
private void process_incoming_soap() {
try {
// Copy output stream to input stream to simulate
// coordinated streams over a network connection.
coordinate_streams();
// Create the "received" SOAP message from the
// input stream.
SOAPMessa... | 4 |
ListeTableModel(ArrayList<Metadonnee> listeMetadonnees) {
this.liste = liste;
} | 0 |
public static void main(String[] args) {
String jobName = "";
String jobId = null;
// set command line usage
Arguments.usage = usage;
// get command line arguments
Arguments arguments = new Arguments(args);
jobName = arguments.getOptionalArgument("Default Job Name");
System.out.println("jobName: " + jo... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Square other = (Square) obj;
if (x == null) {
if (other.x != null)
return false;
} else if (!x.equals(other.x))
return false;
if (y... | 9 |
@Test
public void test_gold(){
assertNotNull(pawn);
assertEquals(gold, pawn.getGold());
} | 0 |
public void update(Activity activity) throws InstanceNotFoundException {
boolean found = false;
Iterator<Activity> iter;
iter = activities.iterator();
while (iter.hasNext() && !found) {
Activity a = iter.next();
if (a.equals(activity)) {
found = true;
a.setPlaces(activity.getPlaces());
a.setPr... | 4 |
@Override
public boolean onCommand(CommandSender sender, ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMessage(plugin.... | 7 |
public int getRetainPercentage(Player player) {
if (plugin.getWorldGuardClass().isWorldGuardReady()) {
RegionManager regionManager = wgPlugin.getRegionManager(player
.getWorld());
if (regionManager != null) {
ApplicableRegionSet set = regionManager
.getApplicableRegions(player.getLocation());
... | 5 |
public static double[][] sub( double[][] mat1, double[][] mat2 )
{
int m = mat1.length;
int n = mat1[0].length;
double[][] matres = new double[m][];
for ( int i = 0; i < m; ++i )
{
matres[i] = new double[n];
for ( int j = 0; j < n; ++j )
matres[i][j] = mat1[i][j] - mat2[i][j];
}
return(matres);
} | 2 |
private static void initStuIDVec() {
StuIDs.clear();
unAssignedStudents.clear();
for (int i = 0; i < Students.size(); i++) {
Student thisStu = new Student((Student) Students.get(i));
StuIDs.add(thisStu.getID());
unAssignedStudents.add(thisStu.getID());
}
System.out.println("initStuIDVec");
for (int... | 2 |
public static TreeNode commomAncestorWithBinarySearchTree(TreeNode p,TreeNode q,TreeNode root){
if(root==null){
return null;
}
if(root.data > p.data && root.data < q.data){
return root;
}
TreeNode left = commomAncestorWithBinarySearchTree(p,q,root.left);
if(left!=null){
return left;
}
TreeNode ... | 5 |
private ArrayList<String> removeHTMLCommands(ArrayList<String> array) {
for (int i = 0; i < array.size(); i++) {
if (array.get(i).contains("<") || array.get(i).contains(">")) {
array.remove(i);
i--;
}
}
return array;
} | 3 |
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.