method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ebec7dfe-141a-432d-a872-4966f9769231 | 6 | private Point[] getPossibleMoves(int x, int y)
{
ArrayList<Point> moves = new ArrayList<Point>();
for (Point p : moveRules)
{
int newX = x + p.x,
newY = y + p.y;
if (newX >= 0 && newX < columns && newY >= 0 && newY < rows && !board[newY][newX])
moves.add(new Point(newX, newY... |
a0093541-5434-4781-80b7-2d4de70acae6 | 4 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(args.length==1){
BansManager.ipBanPlayer(sender.getName(),args[0], "");
return true;
}
if(args.length>1){
String msg = "";
for(String data: args){
if(!data.equals(args[0])){
m... |
77112b62-b4e5-4a63-a6cb-d334a3a6023a | 7 | private void sendRequest(DefaultHttpClient client, HttpContext httpContext, HttpUriRequest uriRequest, String contentType, AsyncHttpResponseHandler responseHandler, Context context) {
if(contentType != null) {
uriRequest.addHeader("Content-Type", contentType);
}
Future<?> request = ... |
24640e76-a4ba-4010-953c-0cc0aa9b40fe | 3 | public Position jumpStep(double time) throws IllegalArgumentException, IllegalStateException {
if (time < 0)
throw new IllegalArgumentException("The time can't be negative.");
if (time == 0)
return this.getPosition();
double mass = this.getMass(); //efficiency.
if(mass <= 0)
throw new IllegalS... |
a889d814-cf04-4395-8421-ef51c2053e92 | 9 | public Object readObject()
throws IOException {
final int cfaslOpcode = readCfaslOpcode();
Object o = null;
if (trace == API_TRACE_DETAILED) {
debugNote("reading opcode = " + cfaslOpcode + " ("
+ CFASL_OPCODE_DESCRIPTIONS.get(cfaslOpcode) + ")");
}
if (cfaslOpcode >= CF... |
bf0cff3d-ea26-4bf6-9d7a-fbc133126085 | 9 | public Server() {
frame = new JFrame("伺服器");
// 更改JFrame的图标:
//frame.setIconImage(Toolkit.getDefaultToolkit().createImage(Client.class.getResource("qq.png")));
//frame.setIconImage(Toolkit.getDefaultToolkit().createImage(Server.class.getResource("qq.png")));
contentArea... |
4992290a-e05c-41a1-b58f-28eaee6dbda0 | 0 | public void setArtists(List<Artist> artists) {
this.artists = artists;
} |
6cd7b883-ed01-432a-beb8-de96752140aa | 3 | public SingleTreeNode expand(StateObservationMulti state) {
int bestAction = 0;
double bestValue = -1;
for (int i = 0; i < children.length; i++) {
double x = m_rnd.nextDouble();
if (x > bestValue && children[i] == null) {
bestAction = i;
... |
2d097c64-70ed-46ab-b28c-2c85a21f2c31 | 3 | public List<Double> process(List<Double> inputs) throws NNException {
resetNeurons();
if (inputs.size() != numberOfInputs()) {
throw new NNException("Number of inputs doesn't match the number of input neurons");
}
for (int i = 0; i < inputs.size(); i++) {
double inputSignal = inputs.get(i);
inputLayer.... |
243e7272-182e-41da-83f5-7b1feddc41ac | 7 | public boolean PointInLineRect(Vector2 point)
{
return (((point.X >= mPoint1.X && point.X <= mPoint2.X)
|| (point.X <= mPoint1.X && point.X >= mPoint2.X))
&& ((point.Y >= mPoint1.Y && point.Y <= mPoint2.Y)
|| (point.Y <= mPoint1.Y && point.Y >= mPoint2.Y)));
} |
c7237d3f-9022-4006-ac52-67c3db2b5082 | 0 | public JButton getjButtonValider() {
return jButtonValider;
} |
0af82688-8eca-4616-9458-8dcfcab404a7 | 4 | @Override
public boolean activate() {
return (Inventory.isFull() || (Global.eatFood && !Methods.haveFood(Global.foodId)) || !Inventory.contains(983) || Methods.getHpPercent() <=25);
} |
571adda4-5613-4850-b5db-7bb22dd625e7 | 0 | @Override
public String toString() {
return super.toString().concat(" - Live States: " + liveStates);
} |
3dd99cbb-8884-42da-ab91-31585107bfd6 | 7 | void countSamFile(String fileName) {
// Open file
int readNum = 1;
SAMFileReader sam = new SAMFileReader(new File(fileName));
sam.setValidationStringency(ValidationStringency.SILENT);
for (SAMRecord samRecord : sam) {
try {
if (!samRecord.getReadUnmappedFlag()) { // Mapped?
Chromosome chr = genom... |
c99c73d0-6af4-4ab3-8272-47f888337cbe | 4 | public void readFromScanner(Scanner inputSource)
{
if(inputSource == null)
{
System.out.println("no source file found; exiting readFromScanner()");
return;
}
HousePet newHP = new HousePet();
boolean allAttributesFound = newHP.readFromScanner(i... |
580a9b62-eb5a-4fac-aa2a-53ce6004aac8 | 5 | public void run() {
while(model.GRAVITY) {
Point location = model.getRobotLocation();
boolean inTheAir = location.y < 175;
boolean aboveAHole = model.getHoles().contains(new Rectangle(location.x,
location.y + 25, 25, 25));
if(inTheAir || aboveAHole) {
if(model.canRobotMove(Direction.DOWN)) {
... |
dccb1619-b7c1-44af-839f-a0c8c7e7945b | 9 | public static DatabaseType databaseType(String url)
{
Validate.isTrue(isNotBlank(url));
if (url.contains(POSTGRESQL_FRAGMENT)) { return POSTGRESQL; }
if (url.contains(MYSQL_FRAGMENT)) { return MYSQL; }
if (url.contains(HSQL_FRAGMENT)) { return HSQL; }
if (url.contains(H2_FRA... |
6a362368-0f64-4765-9960-1498a02e2487 | 6 | public static boolean containsAllChordTones(Note[] notes, Chord chord) {
// Assume none of these exist, to start.
boolean root = false;
boolean third = false;
boolean fifth = false;
// Iterate through all notes, checking to see what chord tone they are.
// If a chord tone exists, set its flag to true.
... |
bd699d74-b23f-4428-9efe-7de963f9c563 | 7 | final void method3771(byte i, Class258 class258) {
try {
anInt7673++;
if (i > -74)
A(38, null, 4, -3);
Class258 class258_156_ = aClass258Array7828[anInt7876];
if (class258_156_ != class258) {
if (class258 == null)
OpenGL.glDisable(((Class258) class258_156_).anInt4849);
else {
if (... |
dd1ac556-1a9e-4d08-9bb9-b1551bda49f9 | 7 | @Override
public boolean canApplyAbilities(LivingEntity entity)
{
if (entity == null)
return true;
final boolean async = !P.p().getServer().isPrimaryThread();
for (Entry<Plugin, Protector> entry : protectors.entrySet())
{
if (!entry.getKey().isEnabled())
continue;
Protector protector = ... |
fa2c33c6-abec-4df0-8ac9-dac351fff0bc | 9 | private void createContentPane() {
if (contentPane != null)
return;
contentPane = new JPanel(new BorderLayout());
ActionListener okListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
confirm();
dialog.dispose();
cancel = false;
}
};
JPanel bottomPanel = new ... |
c837f8eb-704c-4105-88a9-9665bd4437dd | 9 | final void method615(int i, int i_19_, CacheNode_Sub15 cachenode_sub15, int i_20_, int i_21_, int i_22_, CacheNode_Sub15 cachenode_sub15_23_, CacheNode_Sub15 cachenode_sub15_24_, int i_25_, boolean bool, int i_26_, CacheNode_Sub15 cachenode_sub15_27_, boolean[] bools, int i_28_, int i_29_) {
anInt912++;
if ((i_19_ ... |
dbc993da-476b-4389-88d5-ec461d33f89b | 7 | @EventHandler
public void SkeletonInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Skeleto... |
f2cbc768-20d8-4f78-86e9-fcca05509bb6 | 2 | @Override
public Usuario procurarUsuario(String nome) {
UsuarioDAO usd = new UsuarioJPADAO();
//usd.beginTransaction();
List<Usuario> usuarios = usd.find();
for(Usuario u : usuarios){
if(u.getNome().equals(nome))
return u;
}
return null;
} |
0b0b1604-a4f3-4c3a-b742-2dff1ed97747 | 9 | public static boolean isArrayClassData(ClassData classData) {
if (classData == boolArrayClassData) {
return true;
} else if (classData == byteArrayClassData) {
return true;
} else if (classData == charArrayClassData) {
return true;
} else if (classData... |
b6fda4e7-6460-49c8-9fca-08ae208504c3 | 4 | private String expandString(String str, Map<String, String> inferedProperties) {
if (str == null) {
return null;
}
int pos;
while ((pos = str.indexOf("${")) >= 0) {
int end = str.indexOf('}', pos);
String property = str.substring(pos + 2, end);
... |
a7f58910-1521-4fbf-8d57-111c57af7e7b | 1 | public ItemKey<? extends Box> getTarget() {
return target;
} |
d1ea3b46-a7d9-4f06-a621-4cfc0d562469 | 3 | public static String right(String str, int len)
{
if (str == null)
{
return null;
}
if (len < 0)
{
return EMPTY;
}
if (str.length() <= len)
{
return str;
}
return str.substring(str.length() - len);
... |
792114d0-5a98-4f5f-aa65-0bf45877fceb | 8 | public void traverse(
ASTVisitor visitor,
BlockScope blockScope) {
BlockScope visitScope= (this.scope!=null)?this.scope :blockScope;
if (visitor.visit(this, blockScope)) {
if (initializations != null) {
int initializationsLength = initializations.length;
for (int i = 0; i < initializationsLength; i+... |
3bd51e8d-bf65-494b-b998-51e6a9658077 | 4 | public String format(int var1) {
double var2 = (double)var1 / 20.0D;
double var4 = var2 / 60.0D;
double var6 = var4 / 60.0D;
double var8 = var6 / 24.0D;
double var10 = var8 / 365.0D;
return var10 > 0.5D?StatBase.getDecimalFormat().format(var10) + " y":(var8 > 0.5D?StatBase.getDecimal... |
2d04a793-468e-439d-8193-b0faeebbe0ff | 4 | public String execute(CreateCalendarObject createCalendarObject) throws SQLException{
doesExist = authenticateNewCalender(createCalendarObject.getCalendarName());
if (doesExist == false){
String [] keys = {"calendarName","imported","privatePublic"};
String [] values = {
createCalendarObject.getCale... |
2c25cd21-f170-49cf-a52a-d0e658dbbf0f | 2 | public List<Level> getLevelList()
{
List<Level> list = new ArrayList<Level>();
try {
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM level");
while(rs.next())
{
list.add(getLevelFromRS(rs));
}
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
... |
a6069887-3ee1-49d4-b3b5-65e366f224d4 | 1 | protected JCheckBox createCheckBox(String title, String tooltip, boolean checked) {
JCheckBox checkbox = new JCheckBox(title, checked);
checkbox.setOpaque(false);
checkbox.setToolTipText(tooltip);
if (this instanceof ItemListener) {
checkbox.addItemListener((ItemListener) this);
}
add(checkbox);
return... |
6ee5ebd6-94f5-4bcd-8241-1b1cb132cef1 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(msg.amITarget(this))
switch(msg.targetMinor())
{
case CMMsg.TYP_WRITE:
{
final String adminReq=getAdminReq().trim();
final boolean admin=((adminReq.length()>0)&&CMLib.masking().maskCheck(adminReq,msg.source(),true))
... |
c2477e14-c162-465e-843b-bb5dc5d39a8e | 6 | @EventHandler
public void SlimeWither(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.Wither.Dodg... |
4b51b45e-f75a-4c6a-b147-093149ee40f7 | 9 | public void render(Screen screen) {
int xTile = 0;
int yTile = 27;
int walkingSpeed = 4;
int flipTop = (numSteps >> walkingSpeed) & 1;
int flipBottom = (numSteps >> walkingSpeed) & 1;
if (movingDir == 1) {
xTile += 2;
} else if (movingDir > 1) {
... |
0359463b-07be-42bc-8383-b24efd44a89b | 2 | private void stepForward() {
index = Math.min(index + 1, nodes.length - 1);
modelingTimeText.setText(nodes[index] + "ns");
status("Step forward to node #" + index + " at " + nodes[index] + "ns");
displayer.updateUITables();
if(tableEvents.getItemCount() == 0){
showMes... |
a644fd92-77e4-40c0-ab39-999e87fd2ce9 | 8 | private void score(Decision decisionA, Decision decisionB) {
if (decisionA == Decision.COOPERATE && decisionB == Decision.COOPERATE) {
scoreA += 3;
scoreB += 3;
}
if (decisionA == Decision.DEFECT && decisionB == Decision.COOPERATE) {
scoreA += 5;
}
if (decisionB == Decision.DEFECT && decisionA == Dec... |
5ce8c6bc-40bb-4c73-912a-56357ba460b0 | 5 | public void addOpcode(final int opcode) {
if (ClassEditor.DEBUG || CodeArray.DEBUG) {
System.out.println(" " + codeLength + ": " + "opcode "
+ Opcode.opcNames[opcode]);
}
lastInst = codeLength;
addByte(opcode);
if ((opcode == Opcode.opc_tableswitch)
|| (opcode == Opcode.opc_lookupswitch)) {
... |
ba89153b-6553-43b4-ac8f-e50b96ea02af | 3 | public static ProtocolResultFromServer getProtocolResultFromServer(
String inString) throws JDOMException, IOException,
TagFormatException {
ProtocolResultFromServer result = new ProtocolResultFromServer();
SAXBuilder mSAXBuilder = new SAXBuilder();
Document mDocument = mSAXBuilder.build(new StringReader(in... |
1220b7c7-0e7d-42c3-a529-18a640857cbc | 2 | public static void getAuthorizationCodeFromUserInput() {
boolean goodInput = false;
Scanner scanSelection = new Scanner(System.in);
String input = null;
while (!goodInput) {
// prompts for authorization code and gets user input as String
System.out.print("PROMPT:\tPaste in your authorization code: ");
... |
171d8033-c220-4c2b-a63d-215509480360 | 7 | @EventHandler
public void GhastInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Invi... |
0bf7c656-154c-4025-bff6-29ca986e5e72 | 9 | private void readModulesFromXML(File file){
try {
String zipFilename = ""; //null module filename is okay. Module comes up blank.
String val = "";
int row = 1; //default
int col = 1; //default
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
D... |
4a62b7ea-6510-4834-8369-754b3a61a138 | 1 | public static ArrayList<Tank> getTanks(String tsS){
ArrayList<Tank> tanks = new ArrayList<Tank>();
String data[] = tsS.split(":");
for(int i=0;i<data.length;i++){
tanks.add(getTank(data[i]));
}
return tanks;
} |
60b44d8b-d463-4709-89e1-b391557b309d | 6 | public boolean attemptToMergeOtherNodeToThisNode( ENode otherNode ) throws Exception
{
if( this.level != otherNode.level )
throw new Exception("Two nodes must be at same level " + this.level + " " + otherNode.level);
ProbSequence possibleSeq = ProbNW.align(this.probSequence, otherNode.probSequence);
if(... |
0b1669cd-3ee2-474d-84bb-521af971706a | 7 | public static void main(String[] args) {
BigInteger max = BigInteger.ZERO;
int maxD = 0;
for (int D = 2; D <= 1000; D++) {
double root = Math.sqrt(D);
if (root != (int) root) {
List<BigInteger> continued = getContinuedFraction(D);
BigInteger x = BigInteger.ZERO, y = BigInteger.ZERO;
BigInteger[... |
15b2ef30-a9a5-433c-a7b9-8b29f8e0d60a | 1 | public void award_bonus(BigInteger threshold, BigInteger bonus) {
if (getBalance().compareTo(threshold) >= 0)
deposit(bonus);
} |
581619ad-15e8-454f-a890-3e9249e803ea | 9 | private void processGridletReturn(Sim_event ev)
{
if (trace_flag)
{
System.out.println(super.get_name() +
": received an GRIDLET_RETURN event. Clock: " + GridSim.clock());
}
Object obj = (Object) ev.get_data();
Gridlet gl = null;
Random ra... |
67dd50af-58a0-4300-a372-6a9e57fc5b57 | 6 | @EventHandler
public void SilverfishFireResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble(... |
673fad43-d7f8-42e2-a320-7baeaea9bf29 | 9 | private boolean isDrawByAxis ( char currentValue, int index, boolean onRow, boolean onColumn ) {
boolean enemyExists = false,
currentExists = false;
int rowIndex = onRow ? index : MIN_SIZE;
int columnIndex = onColumn ? index : MIN_SIZE;
Cell cell = new Cell( ro... |
ba85e7b5-240d-4449-8efb-7db96ec064aa | 2 | public List tools(AutomatonPane view, AutomatonDrawer drawer) {
List list = new java.util.ArrayList();
list.add(new ArrowTool(view, drawer));
list.add(new StateTool(view, drawer));
list.add(new TransitionTool(view, drawer));
list.add(new DeleteTool(view, drawer));
list.add(new UndoTool(view, drawer));
lis... |
23cd866b-83b9-4fc0-abbc-24b69337b14e | 8 | public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(imageFondo,0,0,this);
if(tortuga.getPosicion()>=Pista.META){
tortuga.setPosicion(Pista.META-1);
}
else if(liebre.getPosicion()>=Pista.META){
liebre.setPosicion(Pista.META-1);
}
g.drawImage(imageTortuga, (int)pista.getPos... |
55eba270-9f37-49d4-9612-b8e8b38215db | 6 | protected static double grad(int hash, double x, double y, double z) {
hash &= 15;
double u = hash < 8 ? x : y;
double v = hash < 4 ? y : hash == 12 || hash == 14 ? x : z;
return ((hash & 1) == 0 ? u : -u) + ((hash & 2) == 0 ? v : -v);
} |
7a208beb-86b4-40fe-a099-4dd314327da4 | 2 | public void visitArrayRefExpr(final ArrayRefExpr expr) {
if (expr.array() != null) {
expr.array().visit(this);
}
print("[");
if (expr.index() != null) {
expr.index().visit(this);
}
print("]");
} |
108507fe-c2d6-4a20-bb2c-95e1e5e2d168 | 6 | public ArrayList<Object> selectPath() {
if (paths.size() == 0) {
System.out.println("Path not found.");
} else {
if (paths.size() == 1) {
System.out.println("One path founded.");
printPaths();
return paths.get(0);
} else {
Scanner scanner = new Scanner(System.in);
boolean val = true;
... |
a7768c97-a6dd-4b3b-9bc1-fd2c2b87c993 | 4 | public SongParserForOneGenre(Long genreId) {
this.genreId = genreId;
try {
authorDAO = new AuthorDaoMysql();
musicInfoDAO = new MusicInfoDaoMysql();
} catch (MusicInfoException e) {
logger.error("Constructor exception DAO", e);
try {
... |
65fa432c-39e8-4b84-aaa5-117ae744e74c | 5 | private void deleteTask() {
while (true) {
try {
Future<Path> path = deletePathStorage.get();
if (path.isDone()) {
Files.deleteIfExists(path.get());
logger.debug("File '{}' was deleted", path.get());
} else {
logger.debug(
"File '{}' still parsing. put it back to storage!!!",
... |
c7cdb32c-e30e-47a4-8a05-bc711631a9c7 | 9 | @SuppressWarnings("unused")
private void c(String input[]) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException,
SecurityException, NoSuchMethodException {
if (inspObject.isNull() || inspObject.isPrimitive() || input.length < 2) {
InfoPrinter.printNothingToDo();
return;
}... |
63a39010-4859-467e-afb4-2d2300e5fd72 | 7 | public void reset()
{
for (int i=0; i<13; i++)
scores[i] = -1;
scores[13] = 0;
scores[14] = 0;
scores[15] = 0;
yahtzeeBonus[0] = false;
yahtzeeBonus[1] = false;
upperBonus = false;
printedBonus = false;
for (int i=2; i<numGridRows; i++)
{
switch(i)
{
case 8:
cLabels[player][i].set... |
0b8fb596-38ec-4069-965d-46dc5d5451ee | 7 | public void buildClassifier(Instances data) throws Exception {
m_saveMemory = false;
if (data.classAttribute().isNumeric()) {
throw new Exception("Can only handle nominal class!");
}
if (m_backwardWithDelete == null) {
setUpSearch();
m_search = m_backwardWithDelete;
}
/* ... |
fcea31f5-1416-46f5-8f22-2d9bf533acaf | 4 | private static boolean isSomethingWillBeEaten(ArrayList<String> list) {
boolean wolfAndSheetTogether = list.contains(WOLF)
&& list.contains(SHEET);
boolean sheetAndCabbageTogether = list.contains(CABBAGE)
&& list.contains(SHEET);
return list.size() == 2
&& (wolfAndSheetTogether || sheetAndCabbageToget... |
fdde2e5c-6b19-4750-9a0a-e92d6ea22f22 | 4 | private void handleSourcePathSet(int source, int dst, ArrayList<Walk> pathSet) {
HashMap<String, Integer> pathDist = new HashMap<String, Integer>();
for(Walk w : pathSet) {
String pathType = getPathType(w);
if (pathDist.containsKey(pathType)) {
pathDist.put(pathTy... |
95f7a9b0-0d05-43fb-9345-2d325854bec1 | 8 | public static void main( String [ ] args )
{
DSL t = new DSL( new MyInteger( 100000000 ) );
final int NUMS = 4000;
final int GAP = 37;
System.out.println( "Checking... (no more output means success)" );
for( int i = GAP; i != 0; i = ( i + GAP ) % ... |
cb27019b-26bb-44ea-84bc-e61793728b3e | 9 | private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
Names names = tsym.name.table.names;
if (searched.contains(this)) {
return null;
}
searched.add(this);
for (Scope.Entry e = tsym.members().lookup(names.fromString(fieldName)); e.scope !=... |
e32df71a-f88b-4687-b1d0-9628a0f122f1 | 5 | @Override
public Usuario login(String usuario, String senha) {
Usuario usuarioLogado = null;
try {
Connection conn = ConnectionManager.getInstance().getConnection();
UsuarioDAO dao = new UsuarioDAO();
Map<String, Object> criteria = new HashMap<String, Object>();
... |
f3b85492-01e0-485b-97a4-ceb00680f944 | 8 | private boolean evaluateExpression(StringBuilder line, Environment env) {
String args = getArgs(line);
if (args.charAt(0) == '$') {
Variable v = getVariableAt(env, args, 0);
if (args.length() > v.key.length()) {
// check for boolean stuff
int keyEnd = v.key.length();
if (args.charAt(keyEnd+1... |
98846f7f-589c-4ea9-88ef-30ab59e24a60 | 8 | protected void pruneChanges() {
for (int i = 0; i < changes.size(); i++) {
Change c = changes.get(i);
if (c.getType() != Change.DELETE)
continue;
boolean keep = false;
// Do not delete universities that have at least one course.
if (c.getObject() instanceof DescRec) {
DescRec dr = (DescRec) c.... |
a53b25d7-aa8b-4cf5-ac49-9494c81e0168 | 8 | protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetTokenStatus()) {
if (!first) json.append(", ");
json.append(quoteJSON("TokenStatus"));
json.append(" : ");
json.append(quoteJSON(getTokenStat... |
68b57a13-e0eb-422a-a46d-db38a3be54a2 | 5 | public void rebuild() {
// Rebuild data
getData().updateViewStructure();
// fire table
DataTableModel model = ((DataTableModel) getModel());
model.fireTableStructureChanged();
// Common table properties
setFillsViewportHeight(true);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setInterce... |
a8965d15-d8c4-40b6-8ab1-a9789b45028c | 8 | private void afficherMenuPersonnel() {
try {
System.out.println("=======================================================");
System.out.println("Bienvenue dans votre espace personnel. Vous pouvez :");
System.out.println("1. Ajouter une personne");
System.o... |
848e4713-1faf-472e-a237-c88199f6bc9b | 7 | public boolean checkUsername(String username)
{
if (username.isEmpty())
return false;
for (char c : username.toLowerCase().toCharArray())
{
int tmp = c;
if (!(tmp > 96 && tmp < 123) || tmp == 230 || tmp == 248
|| tmp == 229) // Checking username letters
return false;
}
return true;
} |
cbc8050a-ca85-4b6f-88f4-e60210818b10 | 8 | private SpriteType loadSpriteType(String pathOfMan)//String type_man,
{
// WE'LL USE THESE TO INITIALIZE OUR SPRITE TYPE
ArrayList<AnimationState> listOfAnimationStates = new ArrayList<AnimationState>();
//Adds all of those animation states in Animation St... |
259ec351-8a24-4170-9acc-1fd4f5615f79 | 9 | private long readLong_slow (boolean optimizePositive) {
// The buffer is guaranteed to have at least 1 byte.
int b = buffer[position++];
long result = b & 0x7F;
if ((b & 0x80) != 0) {
require(1);
byte[] buffer = this.buffer;
b = buffer[position++];
result |= (b & 0x7F) << 7;
if ((b & 0x80) != 0) ... |
08ffd830-ea65-4a9e-995d-ec6b04b280c7 | 0 | @Override
public void setSector(String sector) {
super.setSector(sector);
} |
b04f2bf9-54be-4903-b877-ba6d04b8e5ef | 9 | public String[] getOverallPast() throws Exception {
String[] overallPast = new String[2];
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
new URL(MakeURL.pastOverallURL(zip)).openStream()));
// FileWriter fileWriter = new FileWriter("test.html", false);
// PrintWriter out = new Pr... |
3bbb70a3-7cf2-42bb-ba1b-682af41b5101 | 9 | protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
AutoTotaalDienst atd = (AutoTotaalDienst) getServletContext()
.getAttribute("atdRef");
klusNaam = req.getParameter("klusNaam");
klusOmschrijving = req.getParameter("klusOmschrijving");
String st... |
fdc17351-c753-4fee-835a-0b8438edeaa4 | 3 | @CaseHandler(routine = ENTRY, reqType = RequestType.GET)
public String handleEntry() {
if (this.userSession != null) {
//ожидаем пока AccountService вернет данные
if (this.userSession.isComplete()) {
//проверяем, что пользователь существует
if (! this.... |
f8acda6f-88a5-4c31-a3ae-39538a95acb4 | 2 | public boolean needsBraces() {
return isDeclaration || (declare != null && !declare.isEmpty());
} |
325de05e-854d-4b3a-a586-3c7ecf3b584b | 6 | public static synchronized boolean createGrammarInASingleLine(String text){
boolean isGrammarCreatedSuccessfully = false;
// Only proceed if the data is valid
if(text != null){
// Only leave text and numbers
text = FileUtils.getTextAndDigits(text);
// Create t... |
1513c4b2-14e0-430f-93c6-4d8c53a5dc40 | 8 | public void attackPower(int attackPosition) {
if (attackPosition <= 3) {
if (GameFile.pokemon1MoveSet[attackPosition].equals("Tackle")) {
// Changed base atk of tackle from 50 to 40
atkPower = 40;
atkType = "Normal";
} else if (GameFile.pokemon1MoveSet[attackPosition].equals("Growl")
|| GameFil... |
8278b26d-4568-4bb4-9dcb-a44812501bd7 | 9 | public UserInterface(){
final Controller controller= new Controller( this );
UIManager.put( "nimbusBase", new Color( 59, 140, 47 ) );
UIManager.put( "nimbusBlueGrey", new Color( 170, 190, 184 ) );
UIManager.put( "control", new Color( 214, 223, 220 ) );
try {
for ( LookAndFeel... |
cc90d1e8-cbb4-43ab-ac90-9db0fcc0d5b0 | 8 | private void remove(){
for(int i = 0; i < entities.size(); i++){
if(entities.get(i).isRemoved()) entities.remove(i);
}
for(int i = 0; i < projectiles.size(); i++){
if(projectiles.get(i).isRemoved()) projectiles.remove(i);
}
for(int i = 0; i < particles.size(); i++){
if(particles.get(i).isRemoved()) p... |
ee31c893-778a-4807-a40e-9d89fe07d61e | 2 | @Override
public void startSetup(Attributes atts) {
// Set Border Style
String style = atts.getValue(A_STYLE);
if (style.equals(STYLE_BEVELED)) {
setBorder(new CompoundBorder(new BevelBorder(BevelBorder.RAISED), new EmptyBorder(insets)));
} else if (style.equals(STYLE_TITLED)) {
setBorder(new TitledBorde... |
eb4bcfb3-3da8-4154-8d23-d40611021ff6 | 3 | public void pausedHelper() {
// Pressing escape again quits the game. Enter, space or P unpauses.
if (input.get("enter") || input.get("action")) {
unpause();
} else if (input.get("escape")) {
gameOver();
}
} |
1a46f15e-5736-4f03-88ca-48f79607c80f | 4 | public ChunkGenerator getChunkGenerator(XcraftGate plugin) {
switch (id) {
case 0: return (ChunkGenerator)null;
case 1: return new GeneratorFlatlands();
case 2: return new GeneratorIsland(plugin);
case 3: return new GeneratorHills(plugin);
}
return null;
} |
477da251-f918-4c0b-b361-f9b0992d825d | 1 | @RequestMapping(value = "/logout", method = RequestMethod.GET)
public ModelAndView logoutUser(@RequestParam String userId,
HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
Cookie[] cookies = request.getCookies();
for(Cookie cookie : cookies... |
0833cbe0-95f2-4b99-8f01-d15d08cdc6c2 | 4 | public void drawHealthMouse(Graphics graphics){
BufferedImage mousePicture = null;
try {
mousePicture = ImageIO.read(getClass().getClassLoader().getResource("pictures/MouseLife.gif"));
} catch(Exception e){
System.out.println("No image found");
}
... |
87a8b611-0a20-4b2c-b81f-13d8d58a2e82 | 1 | private void storeAndRoundDiag (int color) {
Matrix diagMat = diag.getMatrix(color);
for (int i = 0; i < diagMat.getRowDimension(); i++) {
diagList.get(color).offer((int)diagMat.get(i,0)); // int cast results in precision loss
}
} |
683e608f-2224-40f6-b3fc-e6ff50e5f574 | 7 | @Override
public void run() {
while (true) {
try {
synchronized (com) {
connection.setSoTimeout(10000);
dos.writeInt(Constants.PROBE);
dis.readInt();
if(!connection.isConnected... |
d5a8a00a-3cc3-486a-9aff-c39334011ef2 | 0 | public static void main(String[] args) {
HashMap<String,String> map1 = new HashMap<String,String>();
putMap(map1,"firstName", "Kevin");
System.out.println("Number of times put() used: "+ putMap(map1,"lastName", "Dragon"));//get the total number of put() on Map
getMap(map1,"firstname");
System.out.println("... |
eb92dc92-1978-43e8-a787-1e5770764e77 | 3 | void onEntityRemoved( final long someId ) {
//get all processors and the entities they're interested in
final TLongObjectMap<TLongList> processorIntrestedEntityTable =
_dataCore.getProcessId_interestedEntity_Table();
//create an emtpy list, to fill with all processors having inte... |
b6a2ae94-1838-4b62-b418-15c98e55d92c | 3 | public boolean removeItem(FieldItem item, Position position) {
if (!isOccupied(position)) {
return false;
}
if (!isInField(item)) {
return false;
}
if (!item.getPosition().equals(position)) {
return false;
}
field.remove(positio... |
0a8994d9-dfc9-4a77-abcf-029de6ab4b9d | 5 | private Widget creerListeSallePanel() {
setWidth("100%");
setHeight("100%");
listSallePan.isVisible();
listSallePan.setTitle("Liste des salles");
final CellTable<Salle> table = new CellTable<Salle>();
// RECUPERER LES INSTANCES DES SALLES
SalleService.Util.getInstance().getToutesSalles(new AsyncCallback... |
c8329e19-a977-488e-8135-d2297683bca1 | 7 | @Override
public boolean switchFile(String newFile, long startPoint) {
logger.info("Switch binary log file now, from " + currentFileName + " to " + newFile);
logger.info("Previous end point is " + currentFileName);
if (logFileStream != null && currentFileName != null) {
try {
... |
85549e20-b145-43cb-ad55-23d304414134 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
db1812b1-743e-48e6-aa44-5926b041449f | 0 | @Override
public boolean isEmpty() {
return everyPlay.isEmpty();
} |
7a400103-d5a4-4de3-8420-67efa10ee272 | 6 | public static RuleSet GenerateRuleSets(TransactionSet transSet, TransactionSet finalLargeItemSet,double minConfidenceLevel) {
Timer timer = new Timer();
timer.startTimer();
RuleSet allRuleSets = new RuleSet(new ArrayList<Rule>());
for (Transaction itemset : finalLargeItemSet.getTransactionSet()) {
Arr... |
d75525df-b279-41b3-ad55-004b36eff6fa | 1 | public static Handshake craft_standard(byte[] torrentInfoHash,
byte[] clientPeerId) {
//> obfuscated handshake extension
try {
ByteBuffer buffer = ByteBuffer.allocate(
Handshake.BASE_HANDSHAKE_LENGTH +
Handshake.BITTORRENT_PROTOCOL_IDENTIFIER.length());
byte[] reserved = new byte[8];
ByteBuffer ... |
398cd046-9565-4bd7-a8bd-28b82f297e12 | 0 | @AfterClass
public static void tearDownClass() throws Exception {
} |
c71dcda2-6754-4d99-87b4-784a529e21c3 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.blue);
G.fillArc((int)(X-radius/2)-viewX, (int)(Y-radius/2)-viewY, radius, radius, 0, 360);
G.setColor(Color.cyan);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.