method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e976fd58-f4ec-4596-97b1-2f680fdc8d48 | 0 | public int value()
{
return value;
} |
5d6a802c-24b2-49aa-87e8-5fac86c8820a | 0 | @Test
public void runTestInheritedObjects1() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_InheritedObjects1.apk");
Assert.assertEquals(1, res.size());
} |
ab70eacf-a61a-40ac-b0b2-2aa807d5b4ce | 1 | public int getGravityDelay() {
if(frame == null) buildGUI();
return gravityDelay.getValue();
} |
1e413a5c-2ba2-43ec-8289-f4db9df9a490 | 7 | public String [] getOptions() {
String [] options = new String [14];
int current = 0;
if (m_noCleanup) {
options[current++] = "-L";
}
if (m_unpruned) {
options[current++] = "-U";
} else {
if (!m_subtreeRaising) {
options[current++] = "-S";
}
if (m_reducedErrorPru... |
c375b579-5478-418c-ba51-082f673a0559 | 4 | protected HashMap<String, Double> rankChild4StnByHybridPro(_Stn stnObj,
_ParentDoc pDoc) {
HashMap<String, Double> childLikelihoodMap = new HashMap<String, Double>();
double smoothingMu = m_LM.m_smoothingMu;
for (_ChildDoc cDoc : pDoc.m_childDocs) {
double cDocLen = cDoc.getTotalDocLength();
double stn... |
ec07c028-a665-4f47-9e33-f547e7770542 | 1 | public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals(Constantes.CLOSE)) {
this.setVisible(false);
}
} |
b216be7c-16f9-4e1a-8b5b-04ea610cf931 | 8 | protected void extractFile( File srcF,
File dir,
InputStream compressedInputStream,
String entryName,
Date entryDate,
boolean isDirectory )
throws Excep... |
57d07761-76a8-4065-b224-50e270e315ca | 8 | public String processInput(String theInput) {
String theOutput = null;
if (state == WAITING) {
theOutput = "Knock! Knock!";
state = SENTKNOCKKNOCK;
} else if (state == SENTKNOCKKNOCK) {
if (theInput.equalsIgnoreCase("Who's there?")) {
theOutpu... |
6184e6dc-b4c6-4693-bd9c-a534ff73d453 | 3 | public List<List<String>> partition(String s){
if(s.length() == 0){
result.add(new ArrayList<String>(list));
}
for (int i = 1; i <= s.length();i++){
if(isPalindrome(s.substring(0,i))){
list.add(s.substring(0,i));
partition(s.substring(i));
... |
39bf5a71-6d19-4cdf-b706-5d00c252fc42 | 3 | public ArrayList<String> letterCombinationsRec(String digits) {
ArrayList<String> res = new ArrayList<String>();
if(digits.isEmpty()) {
res.add("");
return res;
}
char c = digits.charAt(0);
String metas = map[c-'0'];
ArrayList<String> subRes = letterCombinationsRec(digits.substring(1));
for... |
f6e96f88-91b7-41ea-b62e-a96afdedb67f | 0 | public synchronized boolean isPressed() {
return (getAmount() != 0);
} |
43fff2dd-125e-4cb7-a013-977eb78c339b | 0 | public int getClientId() {
return this.clientId;
} |
d5cbdeaa-4b0a-4b40-a568-b04ee5c23340 | 5 | public static void main(String[] args) {
if(args.length != 3) {
printUsage();
}
short port = Short.parseShort(args[0]);
int window = Integer.parseInt(args[1]);
int timeout = Integer.parseInt(args[2]);
inputCheck(port, window, timeout);
System.out.println("Starting 740Ftp server...");
try {
... |
8d15a2f8-a06e-4123-b848-f0cd0baadfca | 4 | @Override
public boolean getPoint(int mouseX, int mouseY){
int newX = -1;
int newY = -1;
if (mouseX < 800){
int cx = Boot.getPlayer().getX();
int cy = Boot.getPlayer().getY();
newX = cx + (mouseX / Standards.TILE_SIZE) - 12;
newY = cy + ((Standards.W_HEIGHT - mouseY) / Standards.TILE_SIZE) - 12;
... |
f96edaa1-f315-4d98-8d11-c69808dd6c1f | 7 | @Override
public void unInvoke()
{
if(canBeUninvoked())
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((found!=null)&&(!found.amDead())&&(found.location()!=null)&&(!found.isInCombat()))
{
if(found.location()==mob.location())
moveFound();
found.location().delInhab... |
8d88f1a2-0cb0-4f67-b6e1-f6fd8903162f | 5 | private boolean skipTo(String toFind) throws IOException {
outer:
for (; pos + toFind.length() <= limit || fillBuffer(toFind.length()); pos++) {
if (buffer[pos] == '\n') {
lineNumber++;
lineStart = pos + 1;
continue;
}
for (int c = 0; c < toFind.length(); c++) {
... |
3645c17f-ccd9-476a-9eed-003299e8fd0b | 7 | public boolean containsClause(StateLiteralClause clause) {
for (StateLiteralClause c : clauses) {
boolean matches = true;
for (StateLiteral l : c.getLiterals()) {
if (!clause.containsLiteral(l)) {
//System.out.println("Clause " + clause + " does not contain " + l);
matches = false;
break;
... |
d5e15725-4dc6-4d7d-b43e-9dfb8d295686 | 8 | protected List<?> find(Session session,
String propertyName,
Object value,
String sortByPropertyName) throws InvalidHibernateSessionException,
InvalidCriterionException,
InvalidCriterionValueException,
InvalidSortByPropertyException,
DAOException {
if(sess... |
d3f5cd1c-30d8-45f0-bfbf-acfa940b20a4 | 8 | public static void main(String[] args) throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("transform.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter("transform.out")));
int N = Integer.parseInt(f.readLine());
String[] boa... |
6bdc458e-6f80-458f-993d-886a6211d572 | 3 | public Player getPlayerByFacebookID(EntityManager em, long facebookID) {
Player returnPlayer = null;
try {
TypedQuery<Player> query = em.createQuery(
"from Player p where p.playerInfo.facebookID = ?",
Player.class);
query.setParameter(1, facebookID);
List<Player> result = query.getResultList();
... |
0732703e-d4e1-41ad-8978-fc7d3d9ced66 | 9 | public boolean executeMove(Move move) {
boolean success = false;
//Check whether column is valid
if ((move.getPlayer() != this.turn) ||
this.winner != Counter.EMPTY ||
this.draw) {
success = false;
} else {
success = move.executeMove(this.board);
if (!success) {
System.err.println("I... |
605bbd46-669b-4803-ab24-1ec71ce942eb | 7 | public void map(Text key, Text value, Context context) throws IOException,
InterruptedException {
try {
if (!value.toString().contains("PRIVMSG #")) {
return;
}
RecentChange rc = RecentChange.parse(key.toString()+"\t"+value.toString());
//Don't incude anonymous edits, bots, minor edits, edits ... |
86cfc47d-1f24-4eab-8073-a469f2da9542 | 8 | private PickResult[] pickGeomAllIntersect(PickShape pickShape) {
SceneGraphPath[] sgp = null;
Node obj[] = null;
int i, cnt=0;
// First pass
if (pickRootBG != null) {
sgp = pickRootBG.pickAll(pickShape);
} else if (pickRootL != null) {
sgp = pickRootL.pickAll(pickShape);
}
if (sgp == null) return nul... |
54a7344d-c519-4187-a15c-820eb092f091 | 6 | @Override
public void fill(Graphics2D g){
boolean moveWithPlayer=false;
if(Display.player.me(0,1).intersects(phys)){
moveWithPlayer=true;
}
velocity*=bouncyness;
double prev = phys.getY();
phys=new Rectangle2D.Double(phys.getX(),phys.getY()+velocity,phys.getWidth(),phys.getHeight());
// if(phys.getY()... |
33670958-5a77-4cd5-847a-44c342687f3a | 2 | private void equalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_equalsActionPerformed
boolean mistake = false;
try {
operationManager(previousAction);
} catch (DivisionByZeroException exception) {
previousAction = startAction;
text.setTex... |
87b43dc7-5ae2-4972-94c8-5abc2af101ec | 9 | public int numOfLiberties()
{
// For each piece in pieces
for (Piece p : pieces)
{
// GEt the location
int row = p.where.row;
int col = p.where.col;
// check to see wether the pieces are in certain positions(edges of the board) and
// otherwise if there isnt anything next to that particular stone... |
bf7229f3-8b15-44ae-be45-c29412fb268a | 5 | private byte[] getFileContent(File file) {
//TODO test file size
byte[] buffer = new byte[(int) file.length()];
InputStream ios = null;
try {
ios = new FileInputStream(file);
if ( ios.read(buffer) == -1 ) {
throw new IOException("EOF reached while trying to read the whole file");
}
} ca... |
f6d2e49c-6570-42d1-b58a-2d6b74359005 | 5 | @Override
public void onEnable() {
FishMetrics.onEnabled(this);
this.api = new PluginApi();
FileConfiguration config = getConfig();
api.reloadMessages(config);
int delay = config.getInt("delay", 20);
setupPeriodicBroadcast(delay);
String locale = c... |
b38b1752-9457-41f1-8afa-7f5ebaa79d2f | 8 | public int findKth(int[] A, int aStart, int aSize,
int[] B,int bStart, int bSize, int k) {
if(aSize == 0) return B[bStart + k - 1];
if(bSize == 0) return A[aStart + k - 1];
if(k == 1)
return Math.min(A[aStart], B[bStart]);
if(aSize >= bSize){
int ib = Math.min(bSize, k/2);
int ia = k - ib;
if(... |
4a1568f9-656b-4e0f-b3a6-7b75979f0b2b | 5 | public void run()
{
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
int ticks = 0;
int frames = 0;
long lastTimer = System.currentTimeMillis();
double delta = 0;
init();
while (running)
... |
da4391d1-adb5-4fb8-860a-3d9f95506cf8 | 1 | private int evalState(State s) {
if (me.equals("red"))
return s.getnRed() - s.getnBlue();
return s.getnBlue() - s.getnRed();
} |
25d41cc7-b865-42b6-b80b-0d0170a4eb05 | 7 | @Override
public TableData checkIfTableExist(String tableName) throws IllegalArgumentException{
if(connexion == null && path == null)
return new TableData(ApiResponse.MYAPI_NOT_INITIALISE,null);
DatabaseMetaData databaseMeta = null;
try {
if(connect == null || connect.isClosed())
return new TableData(A... |
8e942c50-270e-4aa0-8e26-df5d52eea72b | 0 | public String getServeurBd() {
return serveurBd;
} |
8cf570ea-8a15-453c-866c-b0c0c3000b2d | 3 | public List<Onderwerp> getOnderwerpen() throws DataException {
List<Onderwerp> onderwerpen = new ArrayList<Onderwerp>();
Elements elements = doc.getRootElement().getChildElements();
for (int i = 0; i < elements.size(); i++) {
Element node = elements.get(i);
String naam = node.getAttribute("name").getValue... |
5da6de75-853c-4f52-a10d-feff56d06520 | 0 | @Test
public void NormiEste() {
assertTrue("Este ei ollut oikeassa paikassa",
t.onkoPisteessaEste(new Piste(150, 150)) == EsteenTyyppi.ESTE);
} |
14a10f97-b124-4c39-b6e8-fac670f8f913 | 9 | @Override
public synchronized void writeBit(int bit) throws BitStreamException
{
bit &= 1;
this.out.print((bit == 1) ? "1" : "0");
this.current <<= 1;
this.current |= bit;
this.lineIndex++;
if (this.mark == true)
this.out.print("w");
... |
247386d1-d8b7-4870-9fac-d27c3e34fd01 | 6 | public LauncherConsole() {
setTitle("Console");
setMinimumSize(new Dimension(800, 400));
setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/image/logo_ftb.png")));
getContentPane().setLayout(new BorderLayout(0, 0));
JPanel panel = new JPanel();
getContentPane().add(panel, Bord... |
4fbc35a9-cbf9-4b66-83bb-c2aa9539c737 | 6 | public static void encrypt(File inputFile, File keyFile, File outputFile) throws IOException {
FileInputStream in = new FileInputStream(inputFile);
byte[] input = new byte[(int) (inputFile.length())];
System.out.println(in.read(input));
//for (int i=0; i<inputFile.length(); i+=4096) {
// in.read(b)
// in... |
56282559-ffff-4403-b3f7-ae958c2eacec | 4 | public List<Claim> getSelfCounterClaimList() {
List<Claim> claimList = new ArrayList<Claim>();
Element claimE;
Claim claim = null, parentClaim = null;
ClaimDao claimDao = new ClaimDao(publicFileName);
List<Claim> counterClaimParentList = claimDao.getClaimList();
for (Iterator i = root.elementIterator("count... |
399305e4-f286-4b94-8d88-c86b262ab794 | 1 | public void writeComment(String content) throws IOException {
if (bStartTagOpen) {
w.write(">" + newLine);
bStartTagOpen = false;
}
writeIndent();
w.write("<!-- " + content + " -->" + newLine);
} |
32f7f94e-85e3-42a2-8ded-21049cb476fb | 5 | @EventHandler
public void playerCommandEvent(PlayerCommandPreprocessEvent event){
if(event.getMessage().equalsIgnoreCase("/stop")){
for(World world : Bukkit.getWorlds()){
if(world.equals(Bukkit.getWorlds().get(0)) || world.getName().endsWith("_nether") || world.getName().endsWith("the_end") ){
} else {
... |
2ca29a61-751d-4873-b544-5c13ff78ebe5 | 4 | public void processGameLoop() {
if (alreadyLoaded || loadingError || genericLoadingError) {
return;
}
Client.loopCycle++;
if (!loggedIn) {
processLoginScreenInput();
} else {
mainGameProcessor();
}
processOnDemandQueue();
} |
24d7d774-6ecf-47e4-9373-5c44a9ed62ee | 9 | private static void ensembleVotingEval() throws FileNotFoundException, ParserConfigurationException, Exception {
Scanner sc = new Scanner(System.in);
System.out.println("How many primary systems for the ensemble?");
int numPrimarySys = sc.nextInt();
System.out.println("How many secondary systems for the ensembl... |
ddfeba53-3162-4e01-9048-c5d1d23d9560 | 5 | public SecurityChallenge getDefaultSecurityChallenge(String username) {
for(LdapServer ldapServer : ldapServers) {
try {
SecurityChallenge challenge = ldapServer.getDefaultSecurityChallenge(username);
if(logger.isDebugEnabled()) {
if(challenge != null) {
logger.debug("Successfully got default... |
bd5e9d6f-7aa6-4533-8c73-deb57942bbc8 | 0 | public String getStartVariable() {
return start;
} |
6e355c05-8eed-4276-9287-c21a9c8ba727 | 7 | public void list(CommandSender sender, String[] args) {
if(!sender.hasPermission(Permission.LIST.toString())) {
sender.sendMessage(ChatColor.RED + "You don't have permission for the list command.");
return;
}
int pageNumber;
try {
pageNumber = Integer.parseInt(args[0]);
} catch(NullPointerExcepti... |
13ce0bc0-cd71-4de2-b357-f0bc30f85eed | 2 | private String valores(int max) {
String str = ") VALUES (";
for (int i = 0; i < max; i++) {
str += "?";
if (i != max - 1) {
str += ",";
}
}
str += ")";
return str;
} |
0c163813-fb54-4e7a-8a93-09bf9558ce4d | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o.getClass() == getClass())) return false;
final Rotation4D r = (Rotation4D) o;
/*
* See On Quaternions and Ocontions John H. Conway, Derek A. Smith page 42
* [-l,-r] = [l,r] and [-l,r]=[l,-r]=-[l,r]
*/
re... |
11d69484-538e-4dbf-b5d9-be48252a132e | 5 | private void readProgramText(ObjectModule module) throws SyntaxException {
int codeCount = 0;
char instrType = ' ';
int instr = 0;
calLocation();
if (scanner.hasNextInt()) {
codeCount = scanner.nextInt();
instrCount += codeCount;
if (instrCount > 512) {
throw new SyntaxException("Parse Error ... |
19744691-9063-4c47-b23b-789be11731ed | 2 | public void actionPerformed(ActionEvent e) {
LSystem lsystem = getEnvironment().getLSystem();
if (lsystem.getAxiom().size() == 0) {
JOptionPane.showMessageDialog(getEnvironment(),
"The axiom must have one or more symbols.",
"Nonempty Axiom Required", JOptionPane.ERROR_MESSAGE);
return;
}
try {... |
a50bb21f-0952-44d4-bce1-e8d211ded25a | 5 | private void actionButtons(){
addSong.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Config.songs.add(new File(CURL.getText()));
for(int i = 0; i < Config.songs.size(); i++)
{
songNum = i + 2;
}
if(songNum <= 25)
{
config.saveConfig("Song"+songNu... |
69f64789-ab41-4c4b-ae69-04f56a369b04 | 5 | @Override
public void startElement(String uri, String localName, String qName, Attributes attr) {
switch (localName) {
case TagConstants.ARTIFICIAL_FLOWER_TAG:
int id = getID(attr.getValue(TagConstants.ID_ATTRIBUTE));
currentFlower = new ArtificialFlower(id);
... |
60bb4e21-7c0d-4f98-b45f-ea26cbee82c4 | 8 | public CityNeighbors(CityGenerator generator, int chunkX, int chunkZ) {
super();
// find our center
floors = generator.getUrbanHeight(chunkX, chunkZ);
wallMaterial = generator.getWallMaterial(chunkX, chunkZ);
floorMaterial = generator.getFloorMaterial(chunkX, chunkZ);
roofMaterial = generator.getRoofMateri... |
f5612f62-18d8-4189-9b5f-b79611c0cb32 | 1 | public String resolveClassName(ASTList name) throws CompileError {
if (name == null)
return null;
else
return javaToJvmName(lookupClassByName(name).getName());
} |
71470fa6-71bb-4055-a46b-b5d401c98f40 | 0 | public boolean isNew() {
return id == 0;
} |
6287bcd9-e627-4d1b-9985-0f9f773ec234 | 6 | public static <T> T getValue(ThreadLocal<T> variable, Thread key) {
try {
Field field = Thread.class.getDeclaredField("threadLocals");
field.setAccessible(true);
Object entryMap = field.get(key);
if (entryMap == null)
return null;
Method getEntryMethod = entryMap.getClass().getDeclaredMethod("getEn... |
3f01ac4d-80d3-4bf4-a536-0c4059a63b36 | 1 | public TypeValue dequeue() throws EmptyQueueException {
if (head.getNext() == null) {
throw new EmptyQueueException("Queue is empty!!!");
} else {
QueueElement tmp = head.getNext();
head = tmp;
return tmp.getValue();
}
} |
6da1e8bc-16b4-4bb2-a1cd-114bdc358270 | 7 | private void generateMap(){
int width=(int)Math.round(Math.random()*50)+40;
int height=(int)Math.round(Math.random()*50)+40;
System.out.println("Size: " + width*height);
this.gMap=new Vertex[height][width];
char[][] generatedMap = new char[height][width];
for(int y=0; y<h... |
0420059a-4eca-4530-b17c-5e0ea64468bf | 8 | @Test
public void testCodageRZ() {
float min = 0;
float max = 4;
src = new SourceFixe("1");
ena = new EmetteurNumeriqueAnalogique(min, max, 4, TypeCodage.RZ);
src.connecter(ena);
try {
src.emettre();
ena.emettre();
} catch (InformationNonConforme e) {
}
int i = 0;
while(i <... |
316889e8-439a-4518-840c-9ef892fa7a3b | 4 | static VirtualMachineSnapshot getSnapshotInTree(VirtualMachine vm, String snapName) {
if (vm == null || snapName == null) {
return null;
}
VirtualMachineSnapshotTree[] snapTree = vm.getSnapshot().getRootSnapshotList();
if (snapTree != null) {
ManagedObjectReference mor = findSnapshotInTree(snapTree, snap... |
8c36fdbd-a816-4266-8454-ab2e644255c9 | 2 | @Override
void load(DataInput datainput, int depth) {
try {
int j = datainput.readInt();
this.data = new int[j];
for (int k = 0; k < j; ++k) {
this.data[k] = datainput.readInt();
}
} catch (IOException e) {
throw new NBTRead... |
581cfd96-d660-42fa-ac2a-86924cabfd8c | 1 | private boolean jj_3_70() {
if (jj_scan_token(SMALLEREQUAL)) return true;
return false;
} |
327f1dc8-4805-438f-951b-5db5ce20ec15 | 0 | public String getCar() {
return this._car;
} |
cb3f05aa-e089-4e48-b423-e6258299a74d | 9 | public void updatePrimaryAndForeignKeys(ArrayList<RelationSchema> relations,
ArrayList<ForeignKeyConstraint> foreignKeys) {
// set primaryKey for newly created relation
for (RelationSchema relation : relations) {
RelationUtils.getInstance().resetPrimaryKey(relation);
}
// set foreign keys
for (RelationSche... |
bed101af-8b8a-4834-8b1e-241906b6f4ec | 7 | static double perturbation(double stest, double dUtempt, double dLtempt, double Para_Perturb) {
double k1 = 0;
double k2 = 0;
double k5;
// Method 1:
// Standard Gaussian random number based upon Numerical recipes gasdev and
// Marsaglia-Bray Algorithm
double k3 ... |
d07f7505-2fda-4a9c-96c6-abb6984500eb | 1 | public static Random getRandom()
{
if(useShared) {
return rand;
}
else {
return new Random();
}
} |
71ae3424-68de-4633-a1e6-e5ca6f27f977 | 8 | public int getArrowProjectileGfxId(int weaponId, int arrowId) {
if (arrowId == 884) {
return 11;
} else if (arrowId == 886) {
return 12;
} else if (arrowId == 888) {
return 13;
} else if (arrowId == 890) {
return 14;
} else if (arrowId == 892)
return 15;
else if (arrowId == 11212)
return 1... |
7a6f3920-8caf-4f7b-8917-4f0babc47e3f | 6 | protected String getCommonSuperClass(final String type1, final String type2){
Class c, d;
try
{
c = Class.forName(type1.replace('/', '.'));
d = Class.forName(type2.replace('/', '.'));
}
catch(ClassNotFoundException e)
{
throw new RuntimeException(e);
}
if(c.isAssignableFrom(d))
{
return type1;
}... |
4980734b-4c12-414b-bb83-b83af6787a9c | 1 | public VehicleAcceptor getNextSeg(Vehicle c) {
if (c.getOrientation() == VehicleOrientation.East_West) {
return this.getEWRoad();
} else {
return this.getNSRoad();
}
} |
964876c3-e6f5-47d1-b874-d63b135c489b | 5 | public int simulate(AbstractAgent agent, int steps) {
int score = 0;
for (int t = 0; t < steps; t++) {
step(agent);
for (int x = 0; x < getWidth(); x++) {
for (int y = 0; y < getWidth(); y++) {
if (squares[x][y].isObstacle() || !squares[x][y].isDirty()) {
score++;
}
}
}
}
return... |
347baf8b-8d9f-493a-9c5f-750ff634ff6c | 8 | public int candy(int[] ratings) {
int[] candies = new int[ratings.length]; // store the candies
for (int i = 0; i < ratings.length; i++) {
if (i == 0) candies[i] = 1; // base case
else {
if (ratings[i] > ratings[i-1]) {
candies[i] = candies[i-1... |
d329ab6f-73e6-4d6e-ba00-37b462765a08 | 4 | public boolean execute(CommandSender sender, String[] args) {
String groupName = args[0];
GroupManager groupManager = Citadel.getGroupManager();
Faction group = groupManager.getGroup(groupName);
if(group == null){
sendMessage(sender, ChatColor.RED, "Group doesn't exist");
return true;
}
String senderN... |
9a396b7d-fbec-4252-8da5-1ac8c335e187 | 5 | public void mouseWheelMoved(int newValue) {
int newScrollY = scrollY - (newValue / Math.abs(newValue));
if (invertedScrolling) {
int limit = -(getInnerPanel().getCurrentHeight() - getInnerPanel().getInitialHeight())
/ lineHeight;
if (newScrollY >= 0) {
... |
07d1006d-e236-4416-a275-c2c1b8b04763 | 6 | public void updateProfile( Profile p ) {
ArrayList<AchievementRecord> newAchRecs = new ArrayList<AchievementRecord>();
newAchRecs.addAll( p.getAchievements() );
for ( Map.Entry<Achievement, JCheckBox> entry : shipAchBoxes.entrySet() ) {
String achId = entry.getKey().getId();
JCheckBox box = entry.getValue... |
bef65645-d259-4223-b012-69b23a8ef277 | 1 | public void addListener( ItemContextListener listener ){
if( listener == null ){
throw new IllegalArgumentException( "listener must not be null" );
}
listeners.add( listener );
} |
32585c02-7085-4bc2-b61f-a7ad3bcfae38 | 5 | @Parameters( { "STLBDataID", "STLBExpVal", "STRDataID", "STRExpVal", "STBCDataID"})
@Test
public void test_WidgetCreateAccountWithInvalidEmail(int STLBDataID,
int STLBExpVal, int STRDataID, int STRExpVal, int STBCDataID) {
STLaunchBrowser launchBrowser = new STLaunchBrowser();
launchBrowser.stLaunch(STLBDat... |
e8ad5bfe-4c6e-4f36-94ee-ac3fbab1332c | 8 | public static String calculateFullJavaType(Column column) {
String answer;
String javaType = fullTypeMap.get(column.getJdbcType());
if (javaType == null) {
switch (column.getJdbcType()) {
case Types.DECIMAL:
case Types.NUMERIC:
if ... |
904ee6d8-5e94-4437-b3e0-7870508508a4 | 8 | public static ArrayList<Category> getAllCategories(){
Statement stmt=null;
String searchQuery="SELECT * FROM categories";
categoryList = new ArrayList<Category>();
try{
dbManager=DBManager.checkInstance();
con=dbManager.getFreeConnection();
stmt=con.createStatement();
rs=stmt.executeQuery(searchQ... |
69bb090a-13dc-4a7c-a761-2f095aed0cfa | 7 | private static boolean isRoleAssignableByUser(Role role, UserToken verifiedUserToken) {
try {
if (role == null || role.assignableBy == null || role.assignableBy.length()<3 || verifiedUserToken == null) {
throw new RuntimeException();
}
UserAccount user = verif... |
1b58fccd-c554-4f4b-b217-a170d46043f4 | 2 | public void ensureCapacity(int minCapacity) {
int oldCapacity = attributeLists.length;
if (minCapacity > oldCapacity) {
Attributes oldData[] = attributeLists;
int newCapacity = (oldCapacity * 3)/2 + 1;
if (newCapacity < minCapacity) {
newCapacity = minCapacity;
}
attributeLists = new Attribute... |
483e4a9c-ddbf-41da-8c60-70ecfb96e333 | 5 | private boolean checkFor2Pair(List<Card> hand)
{
List<Card> newHand = new ArrayList<Card>();
boolean hasOnePair = false;
for(int i = 0 ; i < hand.size()-1 ; i++) {
if(hand.get(i).getValue() == hand.get(i+1).getValue())
{
newHand.add(hand.remove(i));
newHand.add(hand.remove(i));
hasOnePair = t... |
ac978712-a806-4d65-996f-61c1636a4f01 | 5 | public void loadFromFile(String fileName) throws FileNotFoundException {
Scanner in = new Scanner(new File(fileName));
String t = "";
// Przeskoczenie blablania
while (!t.equals("p")) {
in.nextLine();
t = in.next();
}
in.next();
int edges ... |
4cb9001c-addc-4f98-a142-c894207689e4 | 4 | public void RegraCadrasto(Cliente c) throws Exception,SQLException,ClienteException{
if(c.getCpf()== null){
throw new Exception(" O campo nao pode estar Nula");
}else if (c.getCpf() < 0){
throw new Exception(" O cpf não pode ser menor que zero");
}
... |
240b7e39-8a93-4893-bc7b-f57de4b49cdc | 7 | public static void guessYPropertyValues(YIComponent view, boolean guessNested, YFormatter formatter, Class upperClass, Object property) {
Class viewClass = view.getClass();
String viewName = viewClass.getName();
int pos = viewName.lastIndexOf('.');
if (pos > -1) {
viewName = ... |
9e35dce3-edc2-4c83-8861-f3a84cc588c5 | 2 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
IRCMainFrame frame = new IRCMainFrame();
frame.setVisible(tr... |
85760906-d124-4361-8cbb-974c5dbdabab | 1 | public void setLevel(int level) {
if (item != null) {
item.setLevel(level);
}
} |
1d30583a-6b20-42f2-a3f9-dac990e09d6c | 2 | public boolean matches(Identifier ident) {
for (int i = 0; i < matchers.length; i++) {
if (matchers[i].matches(ident) == isOr)
return isOr;
}
return !isOr;
} |
5ad8d05b-2d5f-4dbb-b399-35cf98e27cac | 8 | public void renderPlayer (int xPos, int yPos, Sprite sprite) {
xPos -= xOffset;
yPos -= yOffset;
for (int y = 0; y < 16; y++) {
int yAbs = y + yPos;
for (int x = 0; x < 16; x++) {
int xAbs = x + xPos;
if(xAbs < -16 || xAbs >= width || yAbs < 0 || yAbs >= height) break;
if(xAbs < 0) x... |
1f1b7631-f2c1-4626-807e-d33773dc28e5 | 6 | public void update() {
if(target == null)
look();
else
{
if(Util.lineOfSight(this, target) &&
Util.dist(x, y, getTarget().getX(), getTarget().getY())
<= getAttackRange()) {
if(attackDelay.isOver())
attack();
}
else {
if(Util.dist(x, y, getTarget().getX(), getTarget().getY()... |
45c758bd-6af2-461e-b496-b142c8fd85fd | 2 | public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
int[] rows = tabel.getSelectedRows();
if (rows.length != 0) {
delete.setEnabled(true);
modifyName.setEnabled(true);
modifyType.setEnabled(true);
modifyDefaultAmount.setEnabled(true);
} else {
... |
9859a9c4-f909-4b79-9836-6ee9d5dd58ee | 6 | private void prefixSpan(SequenceDatabase database, String outputFilePath) throws IOException{
// if the user want to keep the result into memory
if(outputFilePath == null){
writer = null;
patterns = new SequentialPatterns("FREQUENT SEQUENTIAL PATTERNS");
}else{ // if the user want to save the result to a fi... |
a3baaa56-4a98-4d15-8616-ffe08c6cfaef | 9 | public void dfs(char[][] board, int i, int j, String word, int index){
if(board[i][j] == '~') return;
if(index == word.length()-1 && word.charAt(index) == board[i][j]){
System.out.println(word);
return;
}
if(index == word.length()-1 && word.charAt(index) != board[i][j])
re... |
d9f7aa6e-fcb6-44aa-bc97-9bf7731daeff | 4 | private String handleConv(String cmd) {
String[] arg = cmd.split("\\s+");
if (arg.length == 1) {
return " usage: con <file>.[statvar|params|data]\n";
}
if (arg[1].endsWith("statvar")) {
return Convert.statvar(arg[1]);
} else if (arg[1].endsWith("params"))... |
f2324f43-86ce-43fc-8d6f-68295249a720 | 2 | private void loadGroups(String line) {
if(line.length() > 0){
String[] strs = line.split(Constants.COLUMN_SPLITTER);
for(String group : strs){
groups.add(group.trim());
}
}
} |
2aa0a83e-4492-44a4-a411-f333e5d0a307 | 0 | public void setInternalName(String s){ //just for trying to preserve old way of saving.
myInternalName = s;
} |
c66462ab-b6d2-4374-b1c9-c75beac0df36 | 6 | 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... |
ea9bc88c-fbeb-4d38-bae9-026f2e242a09 | 5 | public static int nGenerateCoords(List<Poi> oldPoiList, List<Poi> newPoiList){
HashMap<String, Poi> newPoiMap = new HashMap<String, Poi>();
for (Poi new_poi : newPoiList) {
newPoiMap.put(new_poi.getId(), new_poi);
}
int cnt = 0;
for(Poi old_poi : oldPoiList){
if(!old_poi.hasCoord()){ // old POI has no... |
8c8dd473-1cda-4cf6-9a17-265da8fe9889 | 8 | protected static Ptg calcDB( Ptg[] operands )
{
if( (operands.length < 4) || (operands[0].getComponents() != null) )
{ // not
// supported
// by
// function
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
double cost;
double salvage;
int life;
int period;
int month;
cost ... |
ba644c5e-43a5-412d-802f-3cddf412701f | 3 | public static int getItemType( String itemType ) throws BadDataTypeException {
int result = Data.NO_SELECTION;
int index;
for ( index = 1; index < ITEM_TYPES.length; index++ ) {
if ( itemType.equalsIgnoreCase( ITEM_TYPES[index] ) ) {
result = index;
break;
} // if
} // for
... |
e261d1c3-031a-4d8a-93d2-eac175d8d3d0 | 1 | public CfaslInputStream(InputStream in) {
super(in, DEFAULT_READ_LIMIT);
if (Log.current == null) {
Log.makeLog("cfasl.log");
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.