text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean hides(Element hiderEl, Element hideeEl) {
Symbol hider = cast(Symbol.class, hiderEl);
Symbol hidee = cast(Symbol.class, hideeEl);
// Fields only hide fields; methods only methods; types only types.
// Names must match. Nothing hides itself (just try it).
if (hide... | 9 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
return true;
}
Player player = (Player)sender;
if (args.length <= 1) {
sender.sendMessage(ChatColor.RED + "You haven't supplied enough arguments.");
return fal... | 6 |
public String getAmount(){ return amountInt; } | 0 |
private void adjustToLink() {
String tooltip;
Color color;
if (mLink != null) {
tooltip = (String) mLink.getClientProperty(ERROR_MESSAGE_KEY);
if (tooltip == null) {
tooltip = mLink.getToolTipText();
color = mColor;
} else {
color = Color.RED;
}
} else {
tooltip = null;
color = mC... | 2 |
public String toJSONString( HashMap<String,String> options )
{
boolean set = false;
StringBuilder sb = new StringBuilder();
int baseRow = -1;
sb.append("{");
// put table contents here
if ( this.depth > 0 )
{
String localId = RandomId.getId( 32 );
... | 8 |
public static /*@pure@*/ int[] stableSort(double[] array) {
int[] index = new int[array.length];
int[] newIndex = new int[array.length];
int[] helpIndex;
int numEqual;
array = (double[]) array.clone();
for (int i = 0; i < index.length; i++) {
index[i] = i;
... | 8 |
public int ExecuteUpdate(String query) {
Statement st;
if (!IsConnected) { return -1; }
try {
st = Conn.createStatement();
plugin.Debug("SQL Update: " + query);
return st.executeUpdate(query);
} catch (SQLException e) {
plugin.Warn("Query execution failed!");
plugin.Log("SQL: " + query);
... | 2 |
public static void main(String[] args) {
Vector<Metier> liMetier = new Vector<Metier>();
liMetier.add(new Metier(3, "bucheron", 1200));
liMetier.add(new Metier(4, "fermier", 1000));
liMetier.add(new Metier(2, "saltimbanque", 1700));
liMetier.add(new Metier(0, "roi", 5000));
Vector<Humain> population = new ... | 4 |
static void linkPartitions(List<Node> positiveNodes,
List<Node> negativeNodes,
int[] positiveIndices,
int[] negativeIndices,
Graph result) {
int k = 0;
for (int i : positiveIndice... | 7 |
public void testToStandardHours_years() {
Period test = Period.years(1);
try {
test.toStandardHours();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardHours();
fail();
... | 2 |
public void initComponents() {
/* Instanciation du panel global */
panelGlobal = new JPanel();
setContentPane(panelGlobal);
/* Instanciation des panels */
panelTags = new VueTag();
panelSeries = new VueSeries();
panelCommandes = new VueCommandes();
panelLecture = new VueLecture();
panelListe = new Vue... | 0 |
private static boolean checkCompatibility(HTMLElement html, Browsers b) {
if (html.getClass().isAnnotationPresent(NotSupportedInBrowsers.class)) {
NotSupportedInBrowsers not = html.getClass().getAnnotation(
NotSupportedInBrowsers.class);
Browsers[] browsers = not.browsers();
for (Browsers browser : brow... | 6 |
public static void main(String[] args)
{
// Make File Handle
File file = new File("parser-test.txt");
// If the test-file does not exist, create it.
if(!file.exists())
{
try
{
// Create the file...
file.createNewFile();
// Then fill it with basic test-data...
PrintStream out = n... | 5 |
String LetterChanges(String str) {
int charnum;
char charact;
char[] charArray = str.toCharArray();
for (int i = 0; i < charArray.length; i++) {
charnum = (int) charArray[i];
if (charnum >= 65 && charnum <= 91 || charnum >= 97 && charnum <= 122) {
charnum += 1;
}
if (charnum == 91) {
char... | 8 |
public int clean() {
int cleaned = 0;
Set<UUID> _saves = PluginVars.npc_decks.keySet();
List<UUID> _nonsaves = PluginVars.npc_nonduelists;
List<UUID> saves = new ArrayList<UUID>();
for(UUID uuid : _saves) {
saves.add(uuid);
}
for(UUID uuid : _nonsaves) {
saves.add(uuid);
}
List<World> worlds ... | 8 |
@Override
public void readFromSave(DataTag data) {
super.readFromSave(data);
DataList list = data.readList("items");
for(int i = 0; i < list.data().size(); i++){
DataTag tag = list.readArray(i);
int slot = tag.readInt("slot");
ItemStack stack = ItemStack.createFromSave(tag);
setStackInSlot(slot, sta... | 1 |
public static String substituteXMLContent( String xml, String xpath, Hashtable values, boolean keepCDATA) throws Exception {
XPathFactory factory = XPathFactory.newInstance();
XPath xPath = factory.newXPath();
xPath.setNamespaceContext(CommonNamespaceContext.getInstance());
DocumentBuil... | 7 |
public OrderType getOrderType() {
for(OrderType o : OrderType.values())
{
if(o.getValue() == orderType)
return o;
}
return null;
} | 2 |
@Override
public User findByLogin(String login) {
User user = null;
try {
connection = getConnection();
ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE login =?;");
ptmt.setString(1, login);
resultSet = ptmt.executeQuery();
result... | 5 |
public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
put(key, value);
}
return this;
} | 3 |
private void setShapeInMatrix() {
for (int r = 0; r < shape.getHeight(); r++) {
for (int c = 0; c < shape.getWidth(); c++) {
if (shape.checkSlot(r, c)) {
setSlot(r + currentY, c + currentX, shape.getType());
}
}
}
} | 3 |
public PageId newPage(Page firstpage, int pages) throws
BufferPoolExceededException,
HashOperationException,
ReplacerException,
HashEntryNotFoundException,
InvalidFrameNumberException,
PagePinnedException,
PageUnpinnedException,
PageNotReadException,
BufMgrException,
DiskMgr... | 2 |
public static void read() throws Exception
{
FileReader file = new FileReader(ActionHandler.importConfigSelectedFile.toString());
BufferedReader reader = new BufferedReader(file);
String line = reader.readLine();
boolean foundBlock = false;
boolean endBlock = false;
while (line != null)
{
String... | 6 |
public static PolynomialComplex getCPolynomial(){
while(true){
Scanner input = new Scanner(System.in);
String inputString = input.nextLine();
if (inputString.length()==0){
continue;
}
StringTokenizer st=new StringTokenizer(inputString);
ArrayList<Complex>coefficients=new ArrayList<Complex>();
... | 4 |
public void updateParticipantsPanel () {
Integer c[] = MainWindow.tripDB.getParticipantsCount (targetDay.getTime());
Integer t = 0;
for (int i = 0; i < 5; i++) {
t += c[i];
tfWW[i].setText(((Integer)c[i]).toString());
}
tfTotal.setText(t.toString());
} | 1 |
public int bonusScore(Frame[] frame, int frameNumber) throws Exception {
int bonusScore = 0;
int firstBonusPoint;
int secondBonusPoint;
if (frameNumber == LAST_FRAME_NUM)
return 0;
if (frame[frameNumber].isStrike()) {
if (frame[frameNumber+1] == null)
throw new Exception("#");
firstBonu... | 9 |
public String move(Direction d) throws
OutOfBoardException {
String message = "";
int newx = x;
int newy = y;
switch(d) {
case Up:
newy++ ;
break;
case Down:
newy-- ;
break;
case Left:
newx-- ;... | 9 |
*
* @throws ConfigurationChangeException Falls der Default nicht gesetzt werden konnte.
*/
private void setDefault(SystemObject systemObject, String aDefault) throws ConfigurationChangeException {
if("_Undefiniert_".equals(aDefault)) throw new IllegalArgumentException("Der Default-Wert '_Undefiniert_' ist nicht ... | 7 |
public static Set<Class> getClassesInPackage(String packageName) {
Set<Class> classes = new HashSet<Class>();
String packageNameSlashed = "/" + packageName.replace(".", "/");
// Get a File object for the package
URL directoryURL = Thread.currentThread().getContextClassLoader()
.getResource(packageNameSlashed);
i... | 6 |
public boolean accept(File file) {
String filename = file.getName();
return filename.endsWith(".txt");
} | 0 |
public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectByteMap ) ) {
return false;
}
TObjectByteMap that = ( TObjectByteMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectByteIterator iter = ... | 8 |
public void run() {
while (!isInterrupted()) {
try {
Task t = null;
Result r = null;
Type ty = Type.PROCESS;
while (t == null) {
if (ty == Type.PROCESS) ty = whatShouldIRequest();
t = host.getTask(me, ty);
try { Thread.sleep(50); } catch (InterruptedException e) {}
}
... | 6 |
protected void processGISResourceARList(Sim_event ev)
{
if (ev == null || ev.get_data() == null) {
return;
}
Integer id = (Integer) ev.get_data();
int tag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_RESULT;
boolean result = sendListToSender(id.intValue(), tag, arList... | 3 |
public boolean isPickUpAble() {
return !isActive() && !this.isExploded();
} | 1 |
private int largeurMax() {
int toRet = 0;
if(t1.getLargeur()> toRet) toRet = t1.getLargeur();
if(t2.getLargeur()> toRet) toRet = t2.getLargeur();
if(t3.getLargeur()> toRet) toRet = t3.getLargeur();
return toRet;
} | 3 |
public static void main(String args[]){
System.out.println( "-------------------------" );
System.out.println( "Test Case 1:" );
HopscotchHashTable<Integer> hash = new HopscotchHashTable<Integer>(9);
System.out.println( "Create a empty hashtable with table size: " + hash.getTableSize());
System.out.println... | 9 |
boolean upgradeWeapon(String weapon){
Debug.debug(username + " upgrading his " + weapon);
if(primaryWeapon.equals(weapon)){
Debug.stub("upgrading primary weapon (" + weapon + ")");
boolean success = subtractResourcesForWeaponUpgrade(weapon, primaryWeaponLevel);
if(success){
primaryWeaponLevel++;
De... | 4 |
public void actionPerformed (ActionEvent event) { // like simulate method of Assignment 1,
double nextStop=t+refreshPeriod; // the arguments are attributes here.
for (; t<nextStop; t+=delta_t){
for (PhysicsElement e: elements){
if (e instanceof Simulateable) {
... | 4 |
public int getImm() {
if(immediate)
return Integer.parseInt(inst[3]);
return 0;
} | 1 |
public void addToList(ArrayList<String> conceptRoleCollection, String shape, Object parent, mxGraph graph, int startPos,
ArrayList<Constructs> collections, int index, int shape1, int shape2) {
int ant = 0;
int newPos = 0;
String conceptRole = "";
String conname = collections.get(index).getConstructName();
... | 5 |
@Override
public String toString()
{
return String.format( "classNameMatches(%s)", this.pattern.toString() );
} | 0 |
public static int clampInt(int value, int min, int max)
{
return (value < min) ? min : (value > max) ? max : value;
} | 2 |
public IncreaseThread(SampleCalc sample)
{
this.SampleCalc = sample;
} | 0 |
private void search() {
if (isSearching) {
return;
}
isSearching = true;
new Thread(new Runnable() {
@Override
public void run() {
model.setComStatus(SafeModel.COM_STATUS_SEARCHING);
ArrayList<String> ports = model.getPorts();
String lastComPort = model.getLastSerialPort();
if (lastCo... | 9 |
public void tick() {
walkblock();
if (!getWalkBlock()) {
switch (iRandom.nextInt(4)) {
case 0:
aiUp();
break;
case 1:
aiRight();
break;
case 2:
aiDown();
break;
case 3:
aiLeft();
break;
}
}
setTexture(iTexture.ID_MOUSE_0 + face);
} | 5 |
@FXML protected void BackButton(ActionEvent event){
switch(operationMode){
case LauncherSelect:
listIndex--;
if(listIndex <= 0)
listIndex=launchers.size()-1;
lbLine2.setText(launchers.get(listIndex));
listIndex=0;
break;
case CitySelect:
listIndex++;
if(listIndex >= 0)
listIndex=citys... | 9 |
public FileProtocol getDefault() {
return defaultProtocol;
} | 0 |
public SongPlayer(int difficulty, ArrayList scores,String songName)
{
this.songName=songName;
this.scores=scores;
songCanPlay=true;
SongLibrary lib=new SongLibrary(difficulty);
setBackground(Color.WHITE);
if(songName.equals("SomeoneLikeYou"))
{
currentSong=lib.getSLO();
msbp=214*(3-difficulty);
... | 6 |
@Override
public MenuItem getAllMenuItem() {
Menu root = getRoot();
MenuItem itemRoot = new MenuItem(root);
if (!root.getMenuChildren().isEmpty()) {
itemRoot.setChildren(new ArrayList<MenuItem>());
for (Menu m1 : root.getMenuChildren()) {
MenuItem mi1... | 6 |
private void readStats(String path, DataModel dataModel) {
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File(path));
// normalize text representation
doc.g... | 6 |
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.translate(-getX(), -getY());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setStroke(new BasicStroke(5));
g2d.setColor(Color.black);
if (path_ != null) {
g2d.dra... | 4 |
private synchronized int re_count_users(int numberOfUsers, int servers) {
if ((numberOfUsers > 1 & servers > 0) && numberOfUsers % servers != 0) {
int usersPerEngine = numberOfUsers / servers;
usersPerEngine++;
return usersPerEngine * servers;
} else {
re... | 2 |
public void aktivoi(ArrayList<Pelaaja> pelaajat, int vuoro) {
for (String elementti : elementit) {
for (Pelaaja pelaaja : pelaajat) {
if (pelaaja.getRobotti().getRuutu().getRuudussa()!=null) {
if (pelaaja.getRobotti().getRuutu().getRuudussa().tyyppi().matches(... | 4 |
public static String writeBill(Object[][] tableData) {
try {
DocumentBuilderFactory dBfactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder dBuilder;
dBuilder = dBfactory.newDocumentBuilder();
Document doc = dBuilder.newDocument();
Element rootElement = doc.createElement("Bill");
... | 7 |
private Card[] getAllCards()
{
ArrayList<Card> cards = new ArrayList<>();
for (Card card : this.communityCards) {
if (card != null) {
cards.add(card);
}
}
for (PlayerProfile profile : th... | 6 |
@Test
public void lineOneTomorrowMoltkeExpl() {
LinkedList<String> meals = new LinkedList<String>();
LinkedList<String> price = new LinkedList<String>();
Canteen curCanteen = new Canteen(new CanteenData(CanteenNames.MOLTKE, 1));// 1 for "tomorrow"
for (MealData m : curCanteen.getCanteenData().getLines().get(0)... | 3 |
public void computeErrors(MyGraph reference, PrintWriter writer){
int misplacements=0;
int wrongoriented=0;
for(MyEdge e : this.edges){
MyNode a = reference.nodeFromId(e.getSource().getId());
MyNode b = reference.nodeFromId(e.getTarget().getId());
MyEdge edge = reference.getEdgeByST(a, b);
if(ed... | 7 |
private boolean isOnScreen(int x, int y) {
if (x >= 0 && x < this.width && y >= 0 && y < height)
return true;
else return false;
} | 4 |
public Boolean initialize() {
File dbFolder = new File(dbLocation);
if (dbName.contains("/") || dbName.contains("\\") || dbName.endsWith(".db")) { this.writeError("The database name can not contain: /, \\, or .db", true); return false; }
if (!dbFolder.exists()) {
dbFolder.mkdir();
}
File SQLFile = new F... | 4 |
public void todaysDealsTest(DriverGenerator dg){
// boiler plate
WebDriver wd = dg.generate();
LoggedOutPage pph = new LoggedOutPage(wd);
// setup
boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE);
boolean foundAndClickedOnElement = pph.clickOnVisibleElement(TODAYS_DEALS_LINK);
// assertions
if (made... | 2 |
public boolean exist2(char[][] board, String word) {
m = board.length;
n = board[0].length;
visited = new boolean[m][n];
for(int i = 0; i < m; ++i){
for(int j = 0; j < n; ++j){
if(exist2Rec(board, word, 0, i, j))
return true;
}
... | 3 |
public int readThrough() throws IOException {
//FILL IN HERE--no for or while loops
int letter,last_letter;
letter = consume();
last_letter = letter;
if(letter != -1){
String tempChar = ""+ (char)last_letter;
last_letter = readThrough();
if(... | 4 |
public PNGDecoderHelper(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if (!checkSignature(buffer)) {
throw new IOException("Not a valid PNG file");
}
... | 7 |
public static ResponseQuestion getQuestionByQuestionID(int questionID) {
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, questionID);
ResultSet rs = stmt.executeQuery();
rs.n... | 1 |
public int run()
{
qSortTreePart(aInt, 0, aInt.length-1);
return 0;
} | 0 |
public void visitLdcInsn(final Object cst) {
checkStartCode();
checkEndCode();
if (!(cst instanceof Type)) {
checkConstant(cst);
}
mv.visitLdcInsn(cst);
} | 1 |
@Override
public boolean onCommand(CommandSender cs, Command cmnd, String string, String[] args) {
String name = cs.getName().toLowerCase();
if (args.length > 0) {
if (args[0].equalsIgnoreCase("info")) {
this.plugin.alleBenutzer.get(name).sendInfo(cs);
ret... | 5 |
private String ValueVariable()
{
String value ="";
Random m_RandValue = new Random();
int rand = m_RandValue.nextInt(DepthValue);
if(typeTrace.equals("Numbers"))
{
value = String.valueOf(rand);
}
else if(typeTrace.equals("Letters"))
{
if(rand >= 25)
{
while(rand >=25)
... | 8 |
public static Digraph rootedOutDAG(int V, int E) {
if (E > (long) V*(V-1) / 2) throw new IllegalArgumentException("Too many edges");
if (E < V-1) throw new IllegalArgumentException("Too few edges");
Digraph G = new Digraph(V);
SET<Edge> set = new SET<Edge>();
// f... | 7 |
public String displayMoves(){
System.out.println("Select piece to move: ");
Scanner scan = new Scanner(System.in);
StringBuilder boardManip = new StringBuilder();
ArrayList list = new ArrayList();
for(Entry<Point, Piece> p : o.getBoard().entrySet()){
if(p.getValue().getColor() == o.isWhitesTurn() && ... | 7 |
private static void chainloader(Loader nl) {
synchronized (Resource.class) {
if (loader == null) {
loader = nl;
} else {
Loader l;
for (l = loader; l.next != null; l = l.next)
;
l.chain(nl);
}
}
} | 2 |
public void keyPressed(KeyEvent e)
{
//System.err.println (e.getKeyCode() + ">");
//Up
if(e.getKeyCode() == 87 || e.getKeyCode() == 38)
myInfo.setControls(0,true);
//Left
if(e.getKeyCode() == 65 || e.getKeyCode() == 37)
myInfo.setControls(1,true);
//Down
if(e.getKeyCode() == 83 || e.getKeyCo... | 8 |
private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 70
... | 8 |
public void toThreeD(){
double[] hold0 = (double[])this.point.clone();
double[] hold1 = new double[3];
if(this.nDimensions>3){
System.out.println("Method toThreeD: Dimensions are greater than three so instance cannot be convertd to a three D Point");
}
else{
... | 4 |
public void format(final String s, int n)
{
String text = s;
while (text.length()>0)
{
String rest = text;
int i = text.indexOf('\n');
if (i>=0)
{
rest = text.substring(0,i).trim();
text = text.substring(i+1,text.length());
}
else... | 4 |
private void plotImageBackground( Graphics2D g )
{
// Draw general background color
g.setColor( graphDef.getBackColor() );
g.fillRect(0, 0, imgWidth, imgHeight );
// Draw a background image, if background image fails, just continue
try {
File bgImage = graphDef.getBackground();
if ( bgImage != null )... | 5 |
public void handleCollision(GameEntity a, GameEntity b) {
if (a == null || b == null) {
return;
}
// make a few variables to make equations easier to read
Vector2 aPos = a.getPosition();
Vector2 bPos = b.getPosition();
Vector2 aV = a.getVelocity();
... | 5 |
private void countrySaveBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_countrySaveBTActionPerformed
String landcode = landcodeTextField.getText();
Integer region = -1;
String countryname = null;
boolean dbResult = false;
lblError.setText("");
String Erro... | 7 |
@Override
public void valueChanged( ListSelectionEvent event )
{
// On vérifie que la sélection a bien été effectuée sur le tableau
if ( event.getSource() == ptsTable.getSelectionModel() && event.getFirstIndex() >= 0 )
{
// On détermine la première ligne sélectionnée
... | 5 |
private void sendUpdates() {
LinkedList<UpdatePlayer> updates = new LinkedList<UpdatePlayer>();
LinkedList<AnimatePlayer> anims = new LinkedList<AnimatePlayer>();
for (HostedConnection each : getClients()) {
if ((each == null) || (!each.attributeNames().contains(AttributeKey.PLAYER))... | 7 |
public int convert_msgtobin(String msg)
{
int m = msg.length();
if (m < 14)
{
return -1; // Too short for a valid CAN msg
}
if (m > 30)
{
return -2; // Longer than the longest CAN msg
}
if ((m & 0x1) != 0)
{
... | 7 |
@Override
public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) throws InvalidHandshakeException {
if( !request.hasFieldValue( "Sec-WebSocket-Key" ) || !response.hasFieldValue( "Sec-WebSocket-Accept" ) )
return HandshakeState.NOT_MATCHED;
String seckey_answere = res... | 3 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext()... | 9 |
@SuppressWarnings("unchecked")
public static void load(String path) throws FroshProjectException {
// Create a Properties object
//
configurationData = new Properties();
// Load the file from the path specified as argument
//
try {
configurationData.loadF... | 9 |
public ArrayList<Integer> findSubstring2(String S, String[] L) {
ArrayList<Integer> result = new ArrayList<Integer>();
HashMap<String, Integer> needFind = new HashMap<String, Integer>();
HashMap<String, Integer> hasFound = new HashMap<String, Integer>();
int m=S.length(), n = L.length, len = L[0].length... | 9 |
public void writeNew(ArrayList<TeamObject> team) {
// before we open the file check to see if it already exists
boolean alreadyExists = new File(path).exists();
try {
// use FileWriter constructor that specifies open for appending
CsvWriter csvOutput = new CsvWriter(ne... | 3 |
private boolean checkEnd()
{
int size, i;
for (i=0; i<playersNo; ++i) if (players[i].isFinished() == false) {
size = players[i].getCastles().size() + players[i].getHeroes().size();
if (size == 0) {
QMessageBox.warning(WindowStack.getLastInstance(), "Przegrana", "Gracz "+players[i].getColor().name+" prze... | 3 |
public static void wheel(int dir) {
for (int i = 0; i < qSlots.length; i++) {
if (qSlots[i].selected) {
if(dir == 1 && i == 0 || dir == -1 && i == qSlots.length -1){
return;
}
if (qSlots[i - dir] != null) {
qSlots[i - dir].clicked("hud");
return;
}
}
}
} | 7 |
private static void compareGroups( MVD mvd1, MVD mvd2 )
throws MVDTestException
{
int numGrps1 = mvd1.numGroups();
int numGrps2 = mvd2.numGroups();
if ( numGrps1 != numGrps2 )
throw new MVDTestException(
"Number of groups in MVDs don't match" );
for ( short gId=1;gId<=numGrps1;gId++ )
{
String g... | 4 |
public static boolean checkUsername(String username) {
username = username.toLowerCase();
boolean hasallowedchars = false;
// first, check if it's empty.
if (username.trim().length() == 0) {
return false;
}
for (String e : evil)
if (username.contains(e)) return false;
for (String a : alpha)... | 6 |
private void updateMetrics()
{
height = text.length;
if(height == 0)
height = 1;
width = 0;
for(String line: text) {
if(line.length() > width)
width = line.length();
}
} | 3 |
@Override
public Class<?> getColumnClass(int columnIndex) {
Class<?> clazz;
switch (columnIndex) {
case 0:
case 3:
case 4:
clazz = Integer.class;
break;
case 1:
case 2:
clazz = String.class;
... | 7 |
public void checkWin() throws WhoWinException{
if (dealer.getValue()>21){
player.playerWin();
throw new WhoWinException("/photos/player_win.png");
}
if (dealer.getValue()>player.getValue()){
player.playerLose();
throw new WhoWinException("/photos/Dealer_win.png");
}
else if (dealer.getValue()<play... | 3 |
public Codec(String extension, Class<?> iCodecClass) {
extensionRegX = "";
// Make sure an extension was specified:
if (extension != null && extension.length() > 0) {
// We are only interested in the file extension. The filename
// can begin with whatever:
extensionRegX = ".*";
String c;
fo... | 4 |
@Override
public void loadRcon() throws DataLoadFailedException {
ConfigurationSection sec = getData(specialYamlConfiguration, "rcon");
YamlPermissionRcon permBase = new YamlPermissionRcon(sec);
load(PermissionType.RCON, permBase);
} | 0 |
public VectorTools() {} | 0 |
public void getListDetails(String id)
{
float total = 0;
float totalInterest = 0;
try
{
String tempQuery = "select membername,contribution,cash_amount,reg_amount,calamity_amount,educ_amount,emer_amount,goods_amount,mem_total from bill_dtl where billid='"+id+"'";
... | 6 |
public BufferedImage convert(BufferedImage src, int[] cols) {
if (cols.length != xcolors.length) {System.out.println("# of colors doesn't match"); return src;}
int w = src.getWidth();
int h = src.getHeight();
int type = Transparency.BITMASK;
BufferedImage dst = getCompatibleImage(w,... | 5 |
public BoardCell(int i, int numRows, int numCols) {
index = i;
// Initialize our links.
if((index - numCols) >= 0)
top = index - numCols;
if((index + numCols) < (numRows*numCols))
bottom = index + numCols;
if((index % numCols) > 0)
left = index - 1;
if(((index + 1) % numCols) > 0)
right = index ... | 4 |
@Override
public void configure(TestElement element) {
super.configure(element);
BmTestManager bmTestManager = BmTestManager.getInstance();
RemoteTestRunner remoteTestRunner = (RemoteTestRunner) element;
String userKey = remoteTestRunner.getUserKey();
TestInfo testInfo = null... | 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.