text stringlengths 14 410k | label int32 0 9 |
|---|---|
public V valAt(Class c) {
V val = lookup.valAt(c);
if (val == null) {
val = checkBaseClasses(c);
}
if (val == null) {
val = checkBaseInterfaces(c);
}
if (val == null) {
val = lookup.valAt((Class) Object.class);
}
return... | 3 |
public FastqBuilder withQuality(final String quality) {
if( quality == null ) { throw new IllegalArgumentException("quality must not be null"); }
if( this.quality == null ) {
this.quality = new StringBuilder(quality.length());
}
this.quality.replace(0, this.quality.length(), quality);
return this;
} | 2 |
protected void die() {
super.die();
int count = random.nextInt(2) + 1;
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.slime), x + random.nextInt(11) - 5, y + random.nextInt(11) - 5));
}
if (level.player != null) {
level.player.score += 25*lvl;
}
} | 2 |
public final void initUI() {
JMenuBar menubar = new JMenuBar();
JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
JMenu view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
JCheckBoxMenuItem sbar = new JCheckBoxMenuItem("Show StatuBar");
sbar.setState(true);
sbar.addActionListe... | 1 |
public static void divideString(String str){
char[] carr = str.toCharArray();
int len = carr.length;
for( int i=0; i< len-1; i++){
char chari = carr[i];
char nextc = carr[i+1];
if( isDigit( chari)){
stack.push( char2int(chari) );
}else if(isOp(chari)){
Op op = new Op();
op.left = stack.pee... | 5 |
@Override
public PermissionType getType() {
return PermissionType.ENTITY;
} | 0 |
public static void main(String[] args) {
try{
File directory = new File("/Users/bhaveshkumar/mygit/java-class-enumerator/folder");
System.out.println("Test class location: " );
List<Class<?>> classes = ClassEnumeratorFindAll.processDirectory(directory);
System.out.println("Number of classes found in direct... | 8 |
private void attackPlaceAbove(int position, char[] boardElements, int dimension) {
if (isPossibleToPlaceOnPreviousLine(positionAboveRight(position, dimension))
&& isPositionInRangeOnTheRight(position, dimension)
&& isBoardElementEmpty(boardElements[positionAboveRight(position, di... | 6 |
@Override
public int loop() {
if (stop) {
shutdown();
}
if (validate() && !wait) {
final Node stateNode = scriptTree.state();
if (stateNode != null) {
scriptTree.set(stateNode);
final Node setNode = scriptTree.get();
if (setNode != null) {
getContainer().submit(setNode);
setNode.jo... | 5 |
public void setKeyFrameTo(String name) {
for (KeyFrame k : keys) {
if (k.equalsIgnoreCase(name)) {
currentKey = k;
break;
}
}
} | 2 |
private static void fourthStrategy()
{
Semaphore MReading = new Semaphore(1);
Semaphore MWriting = new Semaphore(1);
Semaphore MPrio = new Semaphore(1);
Semaphore MPrioW = new Semaphore(1);
Semaphore MPrioR = new Semaphore(1);
int RCounter = 0;
int WCounter = 0;
Random r = new Random();
while(true... | 2 |
void select_imagesource_file_dialog() {
String fname = null;
JFileChooser chooser = new JFileChooser(image_dir);
chooser.setDialogTitle("Open Image File");
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f.exists()) {
fname = f.toString();
... | 4 |
public void draw(Graphics g) {
for (int i=0; i < edges.size(); i++) {
edges.get(i).draw(g);
}
} | 1 |
public static long getJailExpire(String playerName){
long expire = 0;
if(isJailed(playerName)){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'");
// This loop checks all bans ... | 4 |
public void findScalarProduct() throws IOException {
int totalInputs = Integer.parseInt(fileReader.nextLine());
int input=1;
List<Integer> arrayOne;
List<Integer> arrayTwo;
while(fileReader.hasNext()){
int totalNumberOfElements = Integer.parseInt(fileReader.nextLine(... | 5 |
public byte[] Int32ToByte4(Integer value) {
byte[] result = new byte[4];
/*** forward algorithm [123][0][0][0] ***/
byte i = 0, j = 0;
while(true) {
result[j] = (byte)((value >> (i*8)) & 0xff);
if (j == 3) break;
j++;
i++;
}
return result;
/*** inverse algorithm ... | 2 |
private void subtraction(int countryCode, int numberToMinus){
if(IPCTrackerKeys.DEBUG_STATUS){
logger.log(CLASS_NAME, "DEBUG: Minus");
}
switch(countryCode){
case IPCTrackerKeys.CountryCodes.SU:
logger.log(CLASS_NAME, "Subtracting: \"" + numberToMinus + "\" from SU");
int currentTotalSU = Integer... | 6 |
public void deleteElement(String value) throws NotExist{
ListElement previous = head;
ListElement current = head.next();
if (previous.getValue().equals(value)) {
head = head.next();
count--;
} else {
while (current != tail.next()) {
if ... | 3 |
public String getRegip() {
return this.regip;
} | 0 |
public void setQueue1(FloatQueue t) throws MismatchException {
if (t == null)
throw new NullPointerException("the arg cannot be null");
if (q2 != null) {
if (t.getLength() != q2.getLength())
throw new MismatchException("queue 1 and 2 have different lengths!");
if (t.getPointer() != q2.getPointer())
... | 9 |
public ArrayList<ArrayList<ArrayList<String>>> erstelleBlockelementListRegular(
ArrayList<Umlaufplan> umlaufplanliste, Fahrplan fahrplan) {
ArrayList<ArrayList<ArrayList<String>>> ListPlaeneGesamt = new ArrayList<ArrayList<ArrayList<String>>>();
int zaehler = 0;
ArrayList<Blockelement> blockelementlist = new... | 5 |
public static void render(Graphics g){
Graphics2D g2d = (Graphics2D) g;
if (screen == 0) {
g2d.setColor(Color.WHITE);
g2d.setFont(new Font("Serif", Font.BOLD, 96));
g.drawString("Jomapat", Jomapat.game.getWidth() / 2 - 170, 100);
g2d.setFont(new Font("Serif", Font.BOLD, 36));
g2d.drawString(selecti... | 8 |
public void setBlogContent(String blogContent) {
this.blogContent = blogContent;
} | 0 |
private static Properties Configure() {
Properties prop = new Properties();
InputStream in = null;
try {
in = new FileInputStream(getDefaultConfigPath() + "jmpd.properties");
prop.load(in);
} catch (FileNotFoundException e) {
System.out.println("[INFO... | 2 |
public void mate(Chromosome father, Chromosome offspring1,
Chromosome offspring2) {
int geneLength = getGenes().length;
int cutpoint1 = (int) (Math.random() * (geneLength - getGeneticAlgorithm()
.getCutLength()));
int cutpoint2 = cutpoint1 + getGeneticAlgorithm().getCutLength();
Set<Double> taken1 = ne... | 9 |
public void setPersons(Set<Person> persons) {
this.persons = persons;
} | 0 |
public List<ArrayOfKeyValueOfstringanyType.KeyValueOfstringanyType> getKeyValueOfstringanyType() {
if (keyValueOfstringanyType == null) {
keyValueOfstringanyType = new ArrayList<ArrayOfKeyValueOfstringanyType.KeyValueOfstringanyType>();
}
return this.keyValueOfstringanyType;
} | 1 |
public void generate(Land[][] world, int heightScale) {
// seed for the world
seed = (float) (System.nanoTime()/10000000);
this.world = world;
// grid of results for the noise algorithm
functionResults = new float[(int) (world.length/xFreq)+4][(int) (world[0].length/zFreq)+4]; // adding 4 to create buffer ... | 4 |
public Object[] getEdgesBetween(Object cell1, Object cell2, boolean directed) {
if (graphLayoutCache != null && graphLayoutCache.isPartial()
&& edgePromotion) {
Set cells1 = getHiddenChildren(cell1);
Set cells2 = getHiddenChildren(cell2);
// Optimise for the standard case of no child cells
if (c... | 9 |
public Void visitExecutableStatements(ExecutableStatementsContext ctx) {
if (ctx.children == null) return null;
int loc = 1;
for (ParseTree child : ctx.children) {
if (child instanceof ExecutableStatementContext) {
visitExecutableStatement((ExecutableStatementContext) child);
if (ctx.... | 8 |
@Override
public LoggerPanel getLoggerPanel(int defaultID, String supplierName)
{
final Vector<ChoiceItem> data = new Vector<ChoiceItem>(items.size());
for (Entry<Integer, BarItem> item : items.entrySet())
{
ChoiceItem toAdd = new ChoiceItem();
toAdd.id = item.getKey();
toAdd.item = item.getValue();
... | 3 |
public Teacher(DelayQueue<Student> students,ExecutorService exec) {
super();
this.students = students;
this.exec = exec;
} | 0 |
@Override
public void grabbed(EventMouse eventMouse) {
texPos = sliderTexture.getBobGrabbed();
float posDifference = eventMouse.getPosition().getX() - getPosition().getX() - getScale().getX()/2;
if (posDifference != 0)
setPosition(getPosition().add(new Vector3f(posDifference,0,0... | 1 |
public static void main(final String[] args) throws Exception {
int i = 0;
int flags = ClassReader.SKIP_DEBUG;
boolean ok = true;
if (args.length < 1 || args.length > 2) {
ok = false;
}
if (ok && "-debug".equals(args[0])) {
i = 1;
flag... | 9 |
public JPanel getjPanelTitre() {
return jPanelTitre;
} | 0 |
public void setValue(Object value) {
//
// Return an empty string if the value is null
//
if (value == null) {
setText(new String());
return;
}
//
// We must have a Number
//
if (!(value instanceof Number))
thr... | 8 |
private int getNum(String text) throws NumberFormatException {
int res = 0;
if(text.startsWith("+="))
res = Integer.parseInt(text.substring(2));
else if(text.startsWith("-="))
res = Integer.parseInt(text.substring(2)) * -1;
else if(text.equals("++"))
r... | 4 |
private int getTeleporterCoverage() {
int nrSquaresTeleport = 0;
for (Element e : grid.getElementsOnGrid())
if (e instanceof Teleporter) nrSquaresTeleport++;
return (nrSquaresTeleport * 100 / grid.gridSize());
} | 2 |
public static boolean hasHeadTag(String eadfile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError{
boolean result = false;
FileInputStream fileInputStreamEAD = new FileInputStream(eadfile);
XMLEventReader xmlEventReaderEAD = XMLInputFactory.newInstance()
.createXMLEventReader(fi... | 3 |
@Override
public void addProductToCart(UserModel user, int productId, int quantity)
throws WebshopAppException {
if (isValidUser(user, "ADD_PRODUCT_TO_SHOPPING_CART")
&& isPositiveQuantity(quantity, "ADD_PRODUCT_TO_SHOPPING_CART")) {
try (Connection conn = getConnection()) {
int db_quantity = getPro... | 3 |
@Override
public void run() {
try {
while (true){
if (!UserList.messages_list.isEmpty()){
System.out.println(UserList.messages_list.size());
String message = UserList.messages_list.get(0).replace("\n", ";;");
GUI.println("Sending message");
for(User value : UserList.user_list.values... | 4 |
public static FloatBuffer createFilppedBuffer(Matrix4f value)
{
FloatBuffer buffer = createFloatBuffer(4 * 4);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j ++)
{
buffer.put(value.get(i, j));
}
}
buffer.flip();
... | 2 |
public void add( V val,K key, W address){
if (root == null) {
root = new BinaryNode<K,V,W>(val,key,address,null,null);
}
else{
root.insert(val,key,address);
}
} | 1 |
public void setHover (boolean visible) {
if (champion != null) {
if (visible)
championIcon.setIcon (HOVER);
else championIcon.setIcon (null);
}
} | 2 |
public void setEndTime(int hr, int min) {
if (hr < 24 && hr >= 0) {
if (hr > this.tStart[0]) {
this.tEnd[0] = hr;
} else {
this.tEnd[0] = tStart[0] + 1;
}
}
if (min < 60 && min >= 0) {
this.tEnd[1] = min;
}
... | 5 |
@Override
public void caseASeExplogSenaoComando(ASeExplogSenaoComando node)
{
inASeExplogSenaoComando(node);
{
List<PComando> copy = new ArrayList<PComando>(node.getSenaoF());
Collections.reverse(copy);
for(PComando e : copy)
{
e.ap... | 3 |
public Object getValueAt(int row, int col) {
if(null == data)
return null;
if(col>=columnNames.length || col<0 || row<0)
return null;
return data[row][col];
} | 4 |
public boolean isValidType() {
return ifaces.length == 0 || (clazz == null && ifaces.length == 1);
} | 2 |
@Override
public void init() {
/* 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://download.o... | 8 |
@RequestMapping(value = "/saveEmployee", method = RequestMethod.POST)
public String saveCustomer(@ModelAttribute("employee") Employee employee, BindingResult result) {
if (employee.getEmployeeId() == null)
{
GenericDAO<Worktype> worktypesDAO = getWorktypesDAO();
... | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_ANY);
if((target==null)||(target.fetchEffect(ID())!=null))
return false;
if(!super.invoke(mob,commands,givenTarget,au... | 7 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
Outliner.menuBar.helpMenu = this;
} | 0 |
protected String parseHeader(String input) {
String[] lines = input.split("\r?\n", -1);
StringBuilder result = new StringBuilder();
boolean readingHeader = true;
boolean foundHeader = false;
for (int i = 0; (i < lines.length) && (readingHeader); i++) {
String line = ... | 8 |
private void sendMessage(JButton confirmButton) {
if (status.equals(GameStatus.NIGHT)) controller.sendMessage(new MafiaVotedOutVillagerMessage(votedOutPlayer));
else controller.sendMessage(new VillagerVotedOutMafiaMessage(votedOutPlayer));
disableVoteButtons(confirmButton);
} | 1 |
@Override
public void update(PositionChangedObservable observable) {
if(observable != this) {
if(observable.getPositions().contains(position)) {
addHoveringElement(observable);
if(getLifetime() > 0)
observable.accept(new CollideWithPowerFailureVisitor());
} else if(hoveringElements.remove(observab... | 5 |
public void init(int mode, byte[] key, byte[] iv) throws Exception{
String pad="NoPadding";
// if(padding) pad="PKCS5Padding";
byte[] tmp;
if(iv.length>ivsize){
tmp=new byte[ivsize];
System.arraycopy(iv, 0, tmp, 0, tmp.length);
iv=tmp;
}
if(key.length>bsize){
tmp=new b... | 4 |
public QueryUserByIdentityNumberResponse queryUserByIdentityNumber(QueryUserByIdentityNumberRequest request)
throws GongmingConnectionException, GongmingApplicationException {
URL path = _getPath(QUERY_USER_BY_IDENTITY_NUMBER);
QueryUserByIdentityNumberResponse response = _GET(path, request, QueryUserByI... | 1 |
public Class[] getParameterClasses() throws ClassNotFoundException {
Class[] paramClasses = new Class[parameterTypes.length];
for (int i = paramClasses.length; --i >= 0;)
paramClasses[i] = parameterTypes[i].getTypeClass();
return paramClasses;
} | 1 |
public void mergeGenKill(Collection gen, SlotSet kill) {
grow(gen.size());
big_loop: for (Iterator i = gen.iterator(); i.hasNext();) {
LocalInfo li2 = (LocalInfo) i.next();
if (!kill.containsSlot(li2.getSlot()))
add(li2.getLocalInfo());
}
} | 2 |
@Override
public void documentAdded(DocumentRepositoryEvent e) {} | 0 |
public Map<Integer, CatalogItem> GrabItemsByPage(int ID)
{
Map<Integer, CatalogItem> Itemz = new HashMap<Integer, CatalogItem>();
for(CatalogItem Item : Items.values())
{
if (Item.Page == ID)
{
Itemz.put(new Integer(Item.ID), Item);
}
}
return Itemz;
} | 2 |
public PokeFont() {
super(font);
File f = new File("res/Font/PokemonFont.ttf");
FileInputStream in;
try {
in = new FileInputStream(f);
dFont = Font.createFont(Font.TRUETYPE_FONT, in);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
font = setSize(20);
} | 1 |
public static void saveAllPlayers(boolean clearOfflinePlayers){
Iterator<Entry<String, PlayerData>> i = data.entrySet().iterator();
while(i.hasNext()){
Entry<String, PlayerData> e = i.next();
e.getValue().saveData();
if(clearOfflinePlayers){
Player p = Bukkit.getPlayerExact(e.getKey());
if(!p.isOnl... | 3 |
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 addToPosition(int place, int value) {
ListElement current = new ListElement(value);
int nextCount = count + 1;
if (place == first) {
addToStart(value);
} else if (place == nextCount) {
addToEnd(value);
} else if (place < nextCount) {
... | 4 |
public static boolean isGreaterThan(Date inDate, Date dateToCompare){
if(inDate.getYear() > dateToCompare.getYear()){
return true;
}else if(inDate.getYear() < dateToCompare.getYear()){
return false;
}else{
if(inDate.getMonth() > dateToCompare.getMonth... | 6 |
public String toBizHawkString() {
StringBuilder str = new StringBuilder();
// UDLRBAZSLRudlr xxx, yyy
str.append("|.|...."); // UDRL
str.append(b ? "B" : "."); // B
str.append(a ? "A" : "."); // A
str.append(z ? "Z" : "."); // Z
str.append(".."); // Start , L
str.append(r ? "R" : "."); // R
str.append... | 6 |
@Override
public List<Point> findWay(Node<Point> start, Node<Point> goal, ListGraph<Point> graph) {
this.closedList = new LinkedList<Node<Point>>();
this.openList = new LinkedList<Node<Point>>();
Node<Point> current = start;
// ADD IT TO OPEN LIST
openList.add(current);
... | 7 |
static void test(Fraction f1, Fraction f2, String msg){
if (! f1.equals(f2))
System.out.println(msg);
} | 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 static Properties load(String [] paths, String fileName) {
Properties properties = null;
File propertiesFile = null;
try {
String path = null;
for(int i=0; i<paths.length; i++) {
path = paths[i] + File.separator + fileName;
propertiesFile = new File(path);
if(prope... | 6 |
private static void browse(String url) throws ClassNotFoundException, IllegalAccessException,
IllegalArgumentException, InterruptedException, InvocationTargetException, IOException,
NoSuchMethodException {
String osName = System.getProperty("os.name", "");
if (osName.startsWith("... | 6 |
public boolean addNoClaimChunk(String chunk)
{
if(this.noclaim.contains(chunk)) return false;
if(this.chunkIsOwned(chunk))
{
if(this.owners.containsKey(chunk))
{
String owner = this.owners.remove(chunk);
Player p = Bukkit.getPlayer(owne... | 4 |
@Override
public int compareTo( VoteItem o ) {
if ( o instanceof VoteItem ) {
VoteItem otherVoteItem = (VoteItem) o;
if ( this.getScore() < otherVoteItem.getScore() ) {
return 1;
} else if ( this.getScore() > otherVoteItem.getScore() ) {
return -1;
} else {
... | 3 |
public static void finalizeObjectAxioms(Stella_Object self) {
{ Object old$Termsourcebeingparsed$000 = Logic.$TERMSOURCEBEINGPARSED$.get();
Object old$LogicDialect$000 = Logic.$LOGIC_DIALECT$.get();
try {
Native.setSpecial(Logic.$TERMSOURCEBEINGPARSED$, null);
Native.setSpecial(Logic.$L... | 8 |
public static void main(String[] args){
// abstractPathname = "MyTextFile.txt";
abstractPathname = "C:";
file = new File(abstractPathname);
// file.createNewFile();
if(file.exists()){
System.out.println("File or Directory exists.");
if(file.isFile()){
System.out.println("This is file.");
if(file.c... | 7 |
public static long toLong(byte ... b) {
int mask = 0xff;
int temp = 0;
long res = 0;
int byteslen = b.length;
if (byteslen > 8) {
return Long.valueOf(0L);
}
for (int i = 0; i < byteslen; i++) {
res <<= 8;
temp = b[i] & mask;
res |= temp;
}
return res;
} | 2 |
public static void main (String[] args) throws IOException, ClassNotFoundException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException {
String jarFilePath = "WordCount.jar";
JarFile jarFile = new JarFile(jarFilePath);
Enumeration<JarEnt... | 4 |
public void compute3KindCategoryPoints(Dice[] roll)
{
if(this.ones >= 3 || this.twos >= 3 || this.threes >= 3 || this.fours >= 3 || this.fives >= 3 || this.sixes >= 3)
{
for(int i=0; i<5; i++)
{
scoreArray[THREEKIND_INDEX] += roll[i].face;
}
}
else
{
scoreArray[THREEKIND_INDEX] = 0;
}
} | 7 |
public boolean isPoweredOn(String vmName) throws Exception {
String vmSearch = doGet(apiLink + Utils.VMS_QUERY_SUFFIX);
Document doc = RestClient.stringToXmlDocument(vmSearch);
NodeList list = doc.getElementsByTagName(Constants.VM_RECORD);
String vmRef = new String();
for(int i=0; i < list.getLength(); i++... | 3 |
public boolean step() {
// get relevant rule
int c = grid[pos_x][pos_y];
Rule r = rules.getRule(state, c);
if (r == null) {
System.out.println("No rule for state " + state + ", colour " + c + "!");
System.exit(-1);
}
//Change the colour and state... | 9 |
private static int getRepresentation(final String s) {
if ("code".equals(s)) {
return BYTECODE;
} else if ("xml".equals(s)) {
return MULTI_XML;
} else if ("singlexml".equals(s)) {
return SINGLE_XML;
}
return 0;
} | 3 |
public void collideWithPlayer(final PlayerEntity player, final int delta) {
boolean playerToLeft = player.pos.x - pos.x - SIZE / 2 < 0;
Vector2d target = pos.copy();
if (playerToLeft)
target.add(0.03 * delta, 0);
else
target.add(-0.03 * delta, 0);
boolean isValide = World.getInstance().isValidPos(targ... | 3 |
public Strike(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "class":
clazz = Class.parse(this, v);
break;
case "dir":
dir = Dir.parse(this, v);
break;
... | 7 |
public boolean verifyConnection(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
this.connect=DriverManager.getConnection("jdbc:mysql:"+this.link,this.username, this.passwd);
this.statement=this.connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
... | 4 |
@Override
public final int index() {
final int key = this._key_;
final BEXFileLoader owner = this._owner_;
switch (BEXLoader._typeOf_(key)) {
case BEX_VOID_TYPE:
return -1;
case BEX_ATTR_NODE: {
final IAMArray array = owner._attrParentRef_;
if (array.length() == 0) return -1;
fina... | 9 |
private TowerView getTowerView(Tower t) {
for (TowerView tv : towers) {
if (tv.getTower().equals(t)) {
return tv;
}
}
//if it's not already in the list create a new and add it
TowerView tv = new TowerView(t);
towers.add(tv);
return tv;
} | 2 |
public void open() {
if (this.state != CellState.CLOSED) return;
if (hasMine()) {
explodeMine();
} else {
this.state = CellState.OPENED;
notifyObservers("Opened");
if (countNeighborsWithMines() == 0) openNeighbors();
}
} | 3 |
public int Decksize(){
return size;
} | 0 |
public void setZipCode(String zipCode) {
this.zipCode.set(zipCode);
} | 0 |
private void handleMenuInput() {
if (this.upHelper.state()) {
this.activeMenu.up();
} else if (this.downHelper.state()) {
this.activeMenu.down();
} else if (this.enterHelper.state()) {
if (this.activeMenu instanceof BattleActionMenu) {
BattleActionMenu.Action action = (BattleActionMenu.Action) this.a... | 9 |
@Override
public boolean pollControls() {
Main.KEYBOARD_LISTENER.recordPollСontrols(KEYS, keyStates);
return !Display.isCloseRequested();
} | 0 |
public int getMedianOfTwoArrays(int[] a1, int[] a2, int start1, int end1, int start2, int end2) {
int length = end1 - start1 + 1;
if (length == 0)
return -1;
if (length == 1)
return (a1[0] + a2[0]) / 2;
if (length == 2)
return (Math.max(a1[start1 + 0], a2[start2 + 0]) + Math.min(a1[start1 + 1], a2[star... | 7 |
private Method findStaticGetter(Class<?> theClass, String propertyName) {
Method[] methods = theClass.getMethods();
for (Method method : methods) {
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
String m... | 9 |
public boolean mousedown(Coord c, int button) {
if (folded) {
//recalcSize(this.sz);
return super.mousedown(c, button);
}
parent.setfocus(this);
raise();
Resource h = bhit(c);
if (button == 1) {
if (h != null) {
pressed ... | 6 |
private void setUpWeapons() {
for (int i = 0; i < 25; i++) {
weapons.add("Weapons" + File.separator + "dagger.properties");
}
for (int i = 0; i < 15; i++) {
weapons.add("Weapons" + File.separator + "shortsword.properties");
}
for (int i = 0; i < 10; i++) {
weapons.add("Weapons" + F... | 4 |
public synchronized void jvnUnLock() throws JvnException {
System.out.println("unlock STATE : "+STATE+" waitforread : "+wait_for_read+" waitforwrite : "+wait_for_write+" "+System.currentTimeMillis());
if(STATE == STATE_ENUM.R){
if(wait_for_write){
wait_for_write = false;
STATE = STATE_ENUM.NL;
th... | 6 |
private static void initKeywordMergeMap()
{
Iterator p = map.keySet().iterator();
while( p.hasNext() )
{
final String key = ( String )p.next();
if( key.indexOf( ' ' ) > -1 )
{
final String[] array = key.split( "\\s+" );
final String firstKeyword = array[ 0 ];
if( firstKeyword.length() > maxMergedKeywordLengt... | 4 |
public void busquedaOrdenada(T dato){
if(dato instanceof Integer ){
Nodo<T> nodoQ = this.inicio;
while(nodoQ != null && (Integer)nodoQ.getInfo() < (Integer) dato){
nodoQ = nodoQ.getLiga();
}
if(nodoQ == null ||(Integer) nodoQ.getInfo() > (Integer)dato){
System.out.println("El elemento no se e... | 5 |
@Override
public void init(List<String> argumentList) {
} | 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.