method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2101b462-6860-40ed-bb60-bec51a4abd67 | 2 | private void poll() {
KeyState state=null;
do {
state=keyMapper.poll();
if (state!=KeyState.NONE) {
keyAffected(state);
}
} while (state!=KeyState.NONE);
} |
00efc3a5-8f3d-457c-99ae-22d696e2a920 | 4 | private boolean isValid(List<Integer> perm){
for (int i = 0; i < perm.size(); ++i){
for (int j = i + 1; j < perm.size(); ++j){
if (i - j == perm.get(i) - perm.get(j) || i - j == perm.get(j) - perm.get(i)) return false;
}
}
return true;
} |
de6ab25e-d3f6-4b59-a33e-45ea90c6f677 | 7 | private String useLineVariables(String s) {
int n = view.getNumberOfInstances(LineComponent.class);
if (n <= 0)
return s;
int lb = s.indexOf("%line[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
LineComponent line;
while (lb != -1 && rb != -1) {
v = s.substring(lb + 6, rb);
... |
ef4dd4be-0099-4c20-8582-cfa163fe0c22 | 7 | protected void setCreatureDefaults() {
if (!isAPartner) {
if (requestedPlant != null) {
setRequestedPlant(null);
}
if (leader != null) {
setLeader(null);
}
}
if (!hasPartner()) {
if (partner != null) {
disPartner();
}
if (dPlant != null) {
removeDesiredPlant();
remove... |
56d28ebf-ddee-4281-b5f3-508f521d5b19 | 2 | public double returnRating(){
Boolean reject = false;
double pScore = 0;
double fScore = 0;
//end of variables to be created by database
pScore = personalScore();
if(!reject){
fScore = financialScore(reject);
}
double rating = pScore+... |
4f985f98-0a75-42c7-8a60-a89a1436831e | 5 | public void go() {
if (img != null) {
setDemarrer(true);
setArreter(false);
ArrayList<Carreaux> arr = new ArrayList<Carreaux>();
for (Carreaux[] c : carreaux) {
for (Carreaux b : c) {
arr.add(b);
}
}
... |
0485ab54-0124-4686-b85c-7213c9e115a4 | 2 | public int calcArgentTour(){
int pts = 0;
if (this.peuple != null) {
pts += this.peuple.calculerGain();
}
if (this.peupleDeclin != null) {
pts += this.peupleDeclin.calculerGain();
}
return pts;
} |
f64c19b0-be5d-4864-aa96-25d39353c2b8 | 9 | private void reformBlockShape() {
abstractBlockArea = blockShape.reformArea();
// TODO for zooming, create an AffineTransform to scale the block shape
AffineTransform at = new AffineTransform();
at.setToScale(zoom, zoom);
blockArea = abstractBlockArea.createTransformedArea(at);
// note: need to add twice t... |
f46e91ef-1a72-4105-9fa5-70c2443509d1 | 1 | public static void main(String[] args) throws Exception{
fc = new RandomAccessFile("test.dat", "rw").getChannel();
MappedByteBuffer out = fc.map(FileChannel.MapMode.READ_WRITE, 0, LENGTH);
for (int i = 0; i < LENGTH; i++)
out.put((byte)'x');
new LockAndModify(out, 0, 0 + LENG... |
6580b86f-2bba-4e32-8cad-0a12b2b1c00b | 9 | protected void calculatePrecisionRecallCurve(int index) {
if( this.dataset == null)
throw new RuntimeException("Error: impossible calculate precision-recall curves after the final calculation call");
// Sort the dataset
final String state = this.indexToValue.get(index);
Collections.sort( this.dataset, ... |
f2dbd4ee-b6ae-4f2f-b128-956081fa598c | 3 | public void play()
throws JavaLayerException
{
try
{
System.out.println("playing "+fFilename+"...");
InputStream in = null;
if (remote == true) in = getURLInputStream();
else in = getInputStream();
AudioDevice dev = getAudioDevice();
Player player = new Player(in, dev);
player.play();
}
... |
a53a7b4d-73cc-456e-b0a7-bd4407916f27 | 7 | private boolean detectSync(CircularDataBuffer circBuf,WaveData waveData) {
int pos=0,b0,b1;
int f0=getSymbolFreq(circBuf,waveData,pos);
b0=getFreqBin();
// Check this first tone isn't just noise the highest bin must make up 10% of the total
if (getPercentageOfTotal()<10.0) return false;
pos=(int)samplesPerS... |
6eeb5016-ebe9-4070-81aa-53f31ed638e4 | 4 | @Override
public void fromString(String text) {
String[] new_lines = text.split(eol);
int n_old = size();
int n_new = new_lines.length;
// Replace common lines
for (int i = 0; i < Math.min(n_old, n_new); i++) {
lines.get(i).setText(new_lines[i]);
}
... |
0ef76065-c29e-4a2e-a5de-85e941428a60 | 2 | List obtenerEmisionTemporada(Date dia, int numCapitulo){
List<Object> infoEmisionTemporada = null;
ArrayList<List> listaEmisionCapitulo = new ArrayList();
Capitulo capi = buscarCapitulo(numCapitulo);
if (capi != null){
List infoEmisionCapitulo = capi.obtenerEmisionCa... |
ad151d73-c05a-4dea-b8ca-c5d47cb9395c | 8 | public static TreeNode<?> findFirstCommonAncestor(TreeNode<?> root,
TreeNode<?> node1, TreeNode<?> node2) {
if (root == null || node1 == null || node2 == null) {
return null;
}
Result result = findFirstCommonAncestorHelper(root, node1, node2);
/*
* if one node belongs to the tree, the other doesn't,... |
cf8f06c2-1d25-4d59-bfad-1cc8fe378a29 | 4 | public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {
String href = null;
if (t == HTML.Tag.BASE) {
href = (String) a.getAttribute(HTML.Attribute.HREF);
baseURL = href;
}
if (t == HTML.Tag.IMG) {
href = (String) a.getAttribute(HTML.Attribute.SRC);
}
if (href != null) {
links.... |
afbea89f-865c-48d9-8bff-604e6ad9587b | 8 | public void performScan(List<RobotPeer> robots) {
if (isDead()) {
return;
}
turnedRadarWithGun = false;
// scan
if (scan) {
scan(lastRadarHeading, robots);
turnedRadarWithGun = (lastGunHeading == lastRadarHeading)
&& (gunHeading == radarHeading);
scan = false;
}
// dispatch messages
i... |
313e139d-8dd4-4437-b7ef-3cc67ac2ea34 | 4 | @Override
public Component getTreeCellRendererComponent(JTree jtree, Object o, boolean bln, boolean bln1, boolean bln2, int i, boolean bln3) {
super.getTreeCellRendererComponent(jtree, o, bln, bln1, bln2, i, bln3);
// Set ImageIcon
ImageIcon icon = null;
DefaultMutableTreeNode node ... |
8e926f0c-8690-4e50-ae35-1d0adf33aa72 | 2 | public static Phrase createNew(Connection con, int dic, Type type, String phrase1, String phrase2)
{
Phrase phrase = null;
try
{
PreparedStatement ps = con.prepareStatement(
"INSERT INTO " + tableInfo.tableName
+ " (Dic, Type, Phrase1, Phrase2) VALUES (?, ?, ?, ?)",
Statement.RETURN_GENERATED_K... |
ce070ef3-7f3e-4981-8393-31d98fad2e2d | 0 | public LighterDriver(Lighter swingLighter)
{
this.lighter = swingLighter;
} |
ab06cb6d-e58a-4e27-8bd6-eded5ed42046 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... |
ab86f583-109c-416a-a9b0-a97061836c9c | 1 | public CacheableNode popFront() {
CacheableNode cacheableNode = head.nextNode;
if (cacheableNode == head) {
return null;
} else {
cacheableNode.unlinkSub();
return cacheableNode;
}
} |
02c46884-8819-461a-8f79-0b9e7c314d85 | 8 | public boolean dispatchKeyEvent(final KeyEvent e) {
if (e.isConsumed() || e.getID() == KeyEvent.KEY_RELEASED) return false;
if (!boardHasFocus) return false;
switch (e.getKeyCode()) {
case KindleKeyCodes.VK_FIVE_WAY_RIGHT:
if (controller != nu... |
7ba63513-e2c3-416e-8830-58479949c061 | 4 | public boolean contain(Ticket ticket) {
if(!parkIsNull() && park.contain(ticket)) {
return true;
}
for(ParkBoy boy : this.parkBoyList) {
if(boy.contain(ticket)) {
return true;
}
}
return false;
} |
c7390224-cfa8-4d5a-a101-343804791328 | 7 | @Override
public String getString()
{
/* We may not want any text from this record.. */
init();
if( bitAttrIf > 0 )
{
return ""; //"IF("; this is already taken care of by another ptg.
}
if( bitAttrSum > 0 )
{
return "SUM(";
}
// if(bitAttrSemi > 0) return "SEMI(";
if( bitAttrVolati... |
c8cc361d-99c0-44a3-9fb1-0dbd696a3f4e | 1 | @Override
public void update(long deltaMs) {
Iterator<IScreenItem> it = screenItems.descendingIterator();
while(it.hasNext()) {
IScreenItem item = it.next();
item.update(deltaMs);
}
} |
38539227-98b5-467b-aeaa-b4660a461e99 | 8 | private String generatePlaybillText(Production prod) {
StringBuilder playbill = new StringBuilder();
playbill.append(prod.getPlay().getName());
playbill.append("\n");
playbill.append("Ein Stück in ");
playbill.append(prod.getPlay().getActs().size());
playbill.append(" Akten");
playbill.append("\n");
pl... |
38be7672-bf91-4789-8212-4faac9e24b27 | 2 | public boolean compare( String key, SemanticAction value )
{
List<SemanticAction> nodes = table.get( key );
for( SemanticAction tmp: nodes )
{
if( tmp.equals( value ) ){
return true;
}
}
return false;
} |
2bc1e761-5d97-4200-b1ae-ea5c31588445 | 5 | @Override
public Step execute(Algebra algebra) {
Equation eq = (Equation) algebra;
boolean fromRight = isNumeric(eq.left());
//set "from" and "to" to the sides of the equations we'll be moving from and to
Term from = (Term) (fromRight ? eq.right() : eq.left());
AlgebraicParticle to = (AlgebraicParticle) ... |
bddacdb5-994c-4581-a33f-6c118f644f37 | 3 | public static Integer last(Function<Boolean> f){
Integer last=null;
for(int i=2;i<=max;i++){
if(bitmap[i]){
if(f.apply(i)){
last = i;
}
}
}
return last;
} |
982c5498-7d1c-4c4a-9311-0610acec38fa | 5 | protected void fuehre_Angriff_durch(int angreifer_gestorben, int angreifer_ausgesandt,int verteidiger_gestorben, Land angreifer, Land verteidiger){
for (int i=0; i<angreifer_gestorben; i++) {
angreifer.decArmeen();
angreifer_ausgesandt--;
}
for (int i=0; i... |
ac777aff-889a-4781-b124-1cf2f8a62873 | 1 | public LeftPanel()
{
Panel = new Rectangle(0, Main.size.height/30, Main.size.width/6, Main.size.height-20);
Load = new Rectangle(Main.size.height/120, Main.size.height/15, Main.size.width/5, Main.size.height/15);
Save = new Rectangle(Main.size.height/120,Main.size.width/10 + Main.size.width/100, Main.size.width/... |
c1e8d61a-ae8e-4de1-a9d6-d785dec38d3b | 7 | public String getRuleAsString() {
char LITERAL_SEPARATOR = DomConst.Literal.LITERAL_SEPARATOR;
int c = 0;
StringBuilder sb = new StringBuilder();
if (ruleType == RuleType.FACT) {
// do nothing for the body part
} else {
if (body.size() > 0) {
c = 0;
for (Literal literal : body) {
if (c > 0... |
b09a8f2d-b669-4c1f-ba5f-df8eec36b845 | 2 | public K getMax(){
K maxKey = null;
Double maxValue = Double.valueOf(Double.MIN_VALUE);
for (Map.Entry<K, Double> entry : map.entrySet()){
//if this value is greater than the maxValue found so far
if (entry.getValue().compareTo(maxValue)>0){
maxValue = ent... |
09aa920f-4611-4992-ae4d-f1977d59eb89 | 2 | public static byte[] decompressRow(byte[] b) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int i = 0; i < b.length; i += 2) {
for (int j = 0; j < b[i] + 128; j++) {
baos.write(b[i + 1]);
}
}
return baos.toByteArray();
} |
53e4b513-36fb-4046-9fbd-ba1cd073ff2f | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String lavel, String[] args){
//TODO: Add message parsing.
//Kick command
if(cmd.getName().toLowerCase() == "kick"){
if(args.length > 0){
Player target = plugin.getServer().getPlayer(args[0]);
if (target == null){
sende... |
5d491b24-db2d-407b-bb73-1afb6665313c | 5 | public static String payRegister(Player p, int tier, double basepay, String job) {
double iTimes = tier;
double totalPay = PlayerCache.getEarnedIncome(p.getName());
String pLang = PlayerCache.getLang(p.getName());
String jobName = UpperCaseFirst.toUpperFirst(McJobs.getPlugin().getLanguag... |
eb0d2a9f-7b36-49ec-b08f-6b2f1688ab91 | 4 | public ArrayList<String> returnOutput() {
try{
openDatabase();
}catch(Exception e){}
String query = "SELECT * FROM t8005t2 .output";
ArrayList<String> output = new ArrayList<String>();
try {
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
Strin... |
d542f9dc-b52c-4809-ba7c-343280081ce7 | 2 | public String getCompleteNickname(String partialNick) {
String lowerNick = partialNick.toLowerCase();
for (User user : model) {
if ( user.getNickname().toLowerCase().startsWith(lowerNick) )
return user.getNickname();
}
return partialNick;
} |
6d5c668c-3cc9-452d-9f87-77ac80a5bb20 | 0 | public static Venue create(String name, int capacity) throws SQLException {
Venue rtn = new Venue();
rtn.name = name;
rtn.capacity = capacity;
rtn.save();
return rtn;
} |
c413e473-48c7-4128-9a5b-b1f9ad7e8e93 | 3 | protected int getInt(Element elt, String attribute, int defaultValue)
{
String value = elt.getAttribute(attribute);
if (value != null && value.length() > 0)
{
try
{
defaultValue = (int) Math.floor(Float.parseFloat(value));
}
catch (NumberFormatException e)
{
// ignore
}
}
return d... |
aefc7a69-5436-49d4-8565-5002dfa55bda | 2 | public String authenticate() {
User user = DataProvider.getUser(username, password);
if (user == null) {
if(session.containsKey(USER_OBJ))
session.remove(USER_OBJ);
addActionError(getText("error.login"));
return ERROR;
}
session.put(USER_OBJ, user);
return SUCCESS;
} |
c17f6269-f677-4bd9-850b-cdd7c0797c2b | 3 | Command matchCommand(String command, String[] args, boolean server){
Command matched = null;
int len = -1;
for(Command cmd : matchCommands(command, server)){
if(matchArgs(cmd.getSubcommand(), args) && len < cmd.getSubcommand().length) {
matched = cmd;
len = cmd.getSubcommand().length;
}
}
return... |
c4ad4fae-41e9-4dc5-b723-b888a4c61dc0 | 8 | private boolean scoreChecker() {
int hitCount = 0;
int mood = 0;
for (FaceData fd : testTrainingData) {
int[] acts = new int[4];
buildNetwork(fd);
for (int i = 0; i < 4; i++) {
double act = calculateActivation(i + 1);
if (act == 1) {
acts[i]++;
mood = i + 1;
}
}
if (!isOnly... |
7f09791f-472f-4ff2-b7cc-a2e05808fe53 | 3 | public void output() throws Exception {
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.OPEN)) {
OutputStragegy st = output.getOutputStrategy(getName());
File lastFolder = st.lastOutputFold... |
a44b681f-dc7a-4540-a3cf-907f77994ff6 | 4 | public void saleTicket(Ticket ticket) {
if (ticket == null) {
throw new CashOfficeManipulationException("Cannot sale NULL ticket");
}
if (ticket.getStatus() == TicketStatus.NOT_FOR_SALE || ticket.getStatus() == TicketStatus.SOLD) {
throw new CashOfficeManipulationException("Cannot sale ticket wi... |
83d4063b-a5eb-4e3e-8237-84fc240429aa | 6 | void regionsAddHit(HashSet<String> hits, Marker hit2add, Marker marker, boolean showGeneDetails, boolean compareTemplate) {
String hitStr = hit2add.getClass().getSimpleName();
if (compareTemplate) {
Gene gene = (Gene) hit2add.findParent(Gene.class);
if (gene != null) hitStr += (hit2add.isStrandPlus() == mark... |
39c277a0-5381-4071-bf6d-991184efc74e | 5 | private boolean solveThreeCardsReplied(Suggestion le)
throws UnknownPlayerException
, UnknownCardException
, ContradictionException {
boolean tableModified = ... |
8d4fb8e3-6bd4-43f4-bad0-b0306d0c29d2 | 8 | public Map<String, String> getTestResultMap() throws Exception {
Map<String, String> testResultMap = new LinkedHashMap<String, String>();
NodeList classNodes = configParser.getNodeList("class", testNode);
if (null != classNodes && classNodes.getLength() > 0) {
for (int i = 0; i < cla... |
87f0496c-af8c-4e7d-b858-49fd1a40453d | 3 | public int getMostSouth() {
for (int r = matrix.length - 1; r >= 0; r--) {
for (int c = matrix.length - 1; c >= 0; c--) {
if (checkSlot(r, c)) {
return r;
}
}
}
return -1;
} |
0c50ece7-1dd7-408f-aa9d-a40ed5606c80 | 0 | public FrameFileDataBaseEditor(){
super("Edit Base");
initialize();
} |
2da6b655-0210-491a-8b4c-11770917c1d6 | 6 | public void run() {
while (true) {
try {
String[] nextCommand = input.readLine().split(" ");
String commandName = nextCommand[0];
String[] arguments = Arrays.copyOfRange(nextCommand, 1,
nextCommand.length);
SystemCommand<Facade> command = commands.get(commandName);
if (command == null)... |
6240a85c-b523-4112-bb54-15bb579da5ab | 7 | protected String makeAchievmentHelp(Achievement A)
{
if(A == null)
return null;
@SuppressWarnings("unchecked")
Map<String,String> helpMap = (Map<String,String>)Resources.getResource("SYSTEM_ACHIEVEMENT_HELP");
if(helpMap == null)
{
helpMap = new Hashtable<String,String>();
Resources.submitResource("... |
df6f40bd-4519-4070-a7ea-616e33c130e2 | 9 | static final public void iteration() throws ParseException {
jj_consume_token(TANTQUE);
yvm.tantQue();
expression();
yvm.faire();expression.clotureIterationCondition();
jj_consume_token(FAIRE);
label_11:
while (true) {
switch ... |
deb7527c-4cf8-47c7-9284-931009a8055a | 8 | @SuppressWarnings("deprecation")
public static void main(String[] args) {
HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>();
HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>();
HashMap<Integer, String> stationIdName... |
03e91248-a09b-4a09-b9ad-68e4b198b94c | 7 | public List<KeyRegistrationRecord> getRandomPeers( final String inBase64Key, final int inDesired, final int inMax, boolean updateRefreshTime ) {
if( isRegistered(inBase64Key) == false ) {
return null;
}
if( updateRefreshTime ) {
updateRefreshTime(inBase64Key);
}
/**
* First retrieve any exis... |
43179c09-dbe4-4b77-b8ea-6da578b808b1 | 9 | private void decodeChunkHeader() throws IOException {
int control = in.readUnsignedByte();
if (control == 0x00) {
endReached = true;
return;
}
if (control >= 0xE0 || control == 0x01) {
needProps = true;
needDictReset = false;
... |
30da9233-c1db-40a0-9cfd-e38dd720ab9a | 4 | public boolean SetMatchFinder(int matchFinderIndex)
{
if (matchFinderIndex < 0 || matchFinderIndex > 2)
{
return false;
}
final int matchFinderIndexPrev = _matchFinderType;
_matchFinderType = matchFinderIndex;
if (_matchFinder != null && matchFinderIndexPr... |
9da66586-1be2-48f5-8a97-aca7d6f0287d | 4 | public void visitTableSwitchInsn(final int min, final int max,
final Label dflt, final Label[] labels) {
checkStartCode();
checkEndCode();
if (max < min) {
throw new IllegalArgumentException("Max = " + max
+ " must be greater than or equal to min = " + min);
}
checkLabel(dflt, false, "default label... |
5eb13bcd-dee5-4798-8189-90deedb8587a | 4 | public float getX() {
float newX = x;
if(parent!=null){
newX+=parent.getX();
}
if(horizontalAlignment.equals(HorizontalAlignment.center)){
return newX - ((width/2)) + (parent.getWidth()/2);
}
if(horizontalAlignment.equals(HorizontalAlignment.righ... |
372d13d8-2db3-4aac-8cc5-84fb17a9add8 | 0 | private boolean isValidStringToAdd(final String tString) {
return tString.substring(0,1).matches("[A-Z]");
} |
fb78ef70-66d7-40f6-97fd-f10a6ad13a27 | 1 | public TextFileIterator() {
// Open the file and read and remember the first line.
// We peek ahead like this for the benefit of hasNext().
try {
in = new BufferedReader(new FileReader(filename));
nextline = in.readLine();
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
} |
99761420-a0d2-424a-8bb6-d4ae3ca69095 | 0 | public String getPath() {
return this.path;
} |
6cc80fe8-a72b-4ebe-b757-b338243b5a98 | 8 | public String serialize(final Map<String, ?> map) {
final StringBuilder sb = new StringBuilder();
boolean start = true;
sb.append(this.startToken);
for (final Entry<String, ?> e : map.entrySet()) {
if (!start) {
sb.append(this.separator);
}
start = false;
sb.append(e.getKey());
sb.append(this... |
80ea70dc-3abe-4e53-983e-353097141839 | 2 | public String toString(){
String result = "";
for(boolean bit : this){
if(bit){
result += "1";
} else {
result += "0";
}
}
return result;
} |
f4cc343e-2036-4678-89db-9e1486127b26 | 1 | private byte[] toByteArray(long val, int bytecount) {
byte[] buffer = new byte[bytecount];
int highest = 8 * bytecount - 8;
for (int i = 0; i < bytecount; i++) {
buffer[i] = (byte) (val >>> (highest - 8 * i));
}
return buffer;
} |
222f55a9-f997-4041-9a3a-224e9fbc65aa | 6 | protected void parseImpl( BufferedReader reader ) throws IOException, ParsingException
{
String currentGroup = null;
String line = null;
int lineNr = 0;
boolean proceedParse = true;
while ( proceedParse && ( ( line = reader.readLine() ) != null ) )
{
... |
7abee0d7-0796-43b1-a733-4f97f2649b77 | 3 | public void sayTo(String sender, Phrase thePhrase) {
// If not already in phrase pool, add to global phrase pool.
if(!phrasesReceived.contains(thePhrase) &&
// you aren't this dweeb
!sender.equalsIgnoreCase("ponchitothegreat")) {
phrasesReceived.add(thePhrase)... |
642fac4d-01d7-4f88-a80a-de602244861d | 7 | public static void writeSentencesToDirectories(
ArrayList<Sentence> sentences, String directory) throws IOException {
File dir = new File(directory);
File posDir = new File(directory + "/pos");
File negDir = new File(directory + "/neg");
File allDir = new File(directory + "/all");
if (dir.exists()) {
if... |
bb691470-8ced-4733-8a04-509158b73e8d | 2 | public WorldView() {
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
if (!doSelectClick(evt))
doScroll(evt);
}
});
addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e) {
float newScale = m_camera.getScale() + e.getW... |
f7619f96-6e0d-4fe9-9363-119a1aa5bbc9 | 0 | public static String getPassword() {
return password;
} |
d3318336-cc0e-42cc-8f02-3de56b56dc10 | 3 | private void getSoundsPath(DefaultListModel<String> list) {
JFileChooser chooser = new JFileChooser();
if(ProjectMainView.actualFolder!=null)
chooser.setCurrentDirectory(ProjectMainView.actualFolder);
chooser.setDialogTitle("Chose MP3 file");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.s... |
476a7e66-4cb1-4010-93ae-7af30806e456 | 7 | @Override
public void setMiscText(String newText)
{
// this checks the input, and allows us to get mood
// lists without having the code in front of us.
if(newText.length()>0)
{
moodCode=-1;
if(CMath.isInteger(newText))
{
final int x=CMath.s_int(newText);
if((x>=0)&&(x<MOODS.length))
{
... |
254cdfd8-1684-4153-8db2-bc701770a1c2 | 9 | public String getPrefix(String namespace, boolean generatePrefix)
{
//assert namespace != null;
if(!namesInterned) {
// when String is interned we can do much faster namespace stack lookups ...
namespace = namespace.intern();
} else if(checkNamesInterned) {
... |
5ac1c694-7ebe-426f-b26c-f38cc22d5784 | 8 | protected void initGUI(int dialogType) {
Vector<ExtensionFileFilter> list;
int i;
boolean acceptAll;
// backup current state
acceptAll = isAcceptAllFileFilterUsed();
// setup filters
resetChoosableFileFilters();
setAcceptAllFileFilterUsed(acceptAll);
if (dialogType == LOADER_... |
227e388a-74e6-435a-a307-1768460eb1b1 | 8 | public void runGrader() throws FileNotFoundException {
printer.open(assignment);
for (AssignmentSubmission submission : assignment) {
for (AssignmentProblem problem : assignment.getProblems()) {
AssignmentProblemGrader grader = graders.get(problem);
double grade = grader.gradeQuestion(assignment, problem... |
ddcd6b22-c901-4475-824c-a2b04edb51f6 | 1 | public boolean EliminarActividad(Actividad p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
c9aa155c-2cba-4eda-81ce-067e6ba38266 | 1 | @Override
public void add_child(Sentence_tree child){
Sentence_tree[] new_children = new Sentence_tree[this.children.length + 1];
for(int i = 0; i < this.children.length; i++){
new_children[i] = this.children[i];
}
new_children[this.children.length] = child;
child.parent = this;
this.children = new_chil... |
5ded7f8c-3e5a-4058-82c0-4951f74f6ece | 8 | @Override
public void run() {
while (true) {
String msg = null;
try {
msg = chat.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
... |
3f9a4b93-5412-4ea3-89ff-5770c81269ae | 9 | public String getResponse(String statement)
{
String response = "";
if (statement.length() == 0)
{
response = "Say something, please.";
}
else if (findKeyword(statement, "no") >= 0)
{
response = "Why so negative?";
}
else if (findKeyword(statement, "mother") >= 0
|| findKeyword(statement, "f... |
a78d4214-fb4a-47e3-bdf5-ab3be38b07ce | 8 | public static void scanFolader(String appPath) throws ESBBaseCheckedException {
log.info("线程", Thread.currentThread().getName(), "开始扫描", appPath, "目录");
try {
// 解决路径中含空格、中文问题
appPath = java.net.URLDecoder.decode(appPath, "UTF-8");
} catch (UnsupportedEncodingException e... |
3eeeceda-6fb4-42ef-bf57-2855a06448b3 | 6 | private boolean straightCheck() {
//Stops if there are any pairs, returns false
for (int r = 0; r<4; r++) {
if (hand[r].getRank()==hand[r+1].getRank())
return false;
}
//By this point, know there are no pairs and the hand is sorted, so this block just compares the
//first and last rank for their sp... |
adec51e7-2b07-4349-9851-681aba7016a9 | 5 | public void draw(Graphics g, ImageObserver io){
if(waittime > 0){
waittime = waittime - 1;
return;
}
g.drawImage(bimage1, char_x, char_y, io);
char_x = char_x - 4;
if(char_x < -48){
syutsugen();
}
if(spkey == true){
speed = speed - 0.15;
}else{
speed = speed + 0.15;
}
if(speed >... |
69584016-02d6-42c7-9061-17873815a3ae | 1 | private void jackpot(String msg, String ttl) {
if (JOptionPane.showConfirmDialog(this, msg, ttl,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
reset();
else {
parent.dispose();
System.exit(0);
}
} |
6fd36547-b3c3-4466-a47e-ed759a8709f8 | 7 | public static void main(String args[]){
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("MessagePasser Testing Interface\nPlease specify configuration file location:");
config_file = br.readLine();
System.out.println("Please specify your name:");
loc... |
d4bf9505-daaa-49c3-afe5-750ad1db367f | 5 | public DataStore onodigaforflytt(DataStore ds2) {
//Det här är bra skit, tar bort onödiga förflyttningar
boolean plockatorder = false;
for (int i = 0; i < ds3.orders; i++) {
System.out.println("\n\n\n" + "i " + i);
for (int j = i + 1; j < ds3.orders; j++) {
... |
ee12ed2c-1f57-4c9e-9dc0-6bfeb286f117 | 4 | public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
if(this != Block.stairSingle) {
super.shouldSideBeRendered(var1, var2, var3, var4, var5);
}
return var5 == 1?true:(!super.shouldSideBeRendered(var1, var2, var3, var4, var5)?false:(var5 == 0?true:... |
ca7caf48-81aa-4e3a-a8d0-02d4d6047398 | 5 | public Base baseWithName(String title, boolean create, boolean primal) {
for (Base base : bases) if (
base.title != null &&
base.title.equals(title) &&
base.primal == primal
) {
return base ;
}
if (! create) return null ;
final Base newBase = Base.createFor(this, primal) ;
... |
0d472cb7-d3ec-4296-8095-244bb1063470 | 7 | synchronized public void checkClipboard() {
if (ClipboardDialog.systemClipboard != null &&
cc.viewer.sendClipboard.getValue()) {
Transferable t = ClipboardDialog.systemClipboard.getContents(this);
if ((t != null) && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
try {
Stri... |
0cdf3a42-4a5a-4af9-925d-8d701218bbcd | 8 | public BeanSerializer (Kryo kryo, Class type) {
this.kryo = kryo;
BeanInfo info;
try {
info = Introspector.getBeanInfo(type);
} catch (IntrospectionException ex) {
throw new KryoException("Error getting bean info.", ex);
}
// Methods are sorted by alpha so the order of the data is known.
PropertyDe... |
56544190-8c72-474b-a7d9-aa510d3be711 | 3 | @Override
public void visitEnd() {
MethodVisitor methodVisitor = cv.visitMethod(Opcodes.ACC_PUBLIC, getterName, "()" + getterDescriptor, null, null);
methodVisitor.visitCode();
if (!isStatic) {
methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
}
methodVisitor.visitFieldInsn(isStatic ? Opcodes.GETSTATIC : Opco... |
2e495aa1-90f0-4e9d-b92a-b87614b14d0e | 1 | public Land getLandByID(int id) {
if (containsID(id)) {
return laenderMap.get(id);
}
return null;
} |
24f5e3aa-421a-4792-ac17-fdfad6e37805 | 7 | public List<Integer> GetIds(String tempTable, String klassName)
{
tempTable = tempTable.replace("<", "_").replace(">","_");
try
{
File cacheDir = new File("cachedir");
if( !cacheDir.exists())
{
cacheDir.mkdir();
}
File cache = new File("cachedir/_"+tempTable+"___"+klassName);
CachedRowSe... |
878f6506-8252-4174-b27e-626c92870049 | 7 | public void onUpdate()
{
if (!this.worldObj.isRemote && this.worldObj.difficultySetting == 0 && this.getSlimeSize() > 0)
{
this.isDead = true;
}
this.field_768_a += (this.field_40139_a - this.field_768_a) * 0.5F;
this.field_767_b = this.field_768_a;
boole... |
077f3471-0291-4096-9015-abb3a30e2687 | 7 | private static void initSequencer(javax.sound.midi.Sequence s, float t) {
if (sequencer != null) {
// if the sequencer is already running, wait for it to stop
while (sequencer.isRunning()) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
System.err.println("Error: (play) failure w... |
8870adbd-fa22-4bc4-a7ec-17c229d21747 | 3 | public void excludeRecord(String id) throws Exception {
if (null == notid) {
notid = new ArrayList<String>();
} else if (999 == notid.size()) {
throw new Exception("Too many exclusions. 1000 max.");
}
if (!notid.contains(id)) {
notid.add(id);
}
} |
2d586eeb-93d8-4d3c-b286-8bfed4c63e13 | 7 | public static void main(String[] args) throws Exception {
System.out.println("Testing...");
int passed = 0, failed = 0, count = 0, ignore = 0;
Class<TestExample> obj = TestExample.class;
// Process @TesterInfo
if (obj.isAnnotationPresent(TesterInfo.class)) {
Anno... |
bc9cda76-2164-4a8a-ba47-9fac826c04d5 | 3 | public SameWordsFinder(TextComponent text) throws BookException {
if (text == null) {
throw new BookException("Text is null");
} else if (text.getType() != EComponentType.TEXT
&& text.getType() != EComponentType.PARAGRAPH) {
throw new BookException("Text type is incorrect");
}
this.text = text;
} |
3711a7b0-a1fd-4815-99d3-34f095023d64 | 1 | @Override
public boolean interpret(String context) {
return expression1.interpret(context) || expression2.interpret(context);
} |
88090b3c-e2b1-41fd-b93f-e697bd6d9d1f | 0 | public LinkedList<String> getChecked() {
return checked;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.