method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a8d0742f-b699-4a68-a44c-5cc4a9e0cdc4 | 2 | public void resultOfVouting(){
int max=0;
String user=null;
for (Map.Entry<String, Integer> entry : vouting.entrySet()) {
if(entry.getValue()>max){
max=entry.getValue();
user=entry.getKey();
}
Map <String,String> voteResp = new HashMap <String, String>();
voteResp.put("action", "voteResult");
... |
bb2d09c7-0d61-4a02-8aa2-cc74b24727fd | 5 | public static void main(String... args)
{
try
{
int width = Integer.parseInt(args[0]);
int height = Integer.parseInt(args[1]);
int numberOfCheese = Integer.parseInt(args[2]);
int duration = 0;
if (width < 5 || height < 5 || numberOfCheese < 1)
{
printHelp();
return;
}
if ... |
1c9ae82c-32f2-40b9-9c2c-cac4a9f83f52 | 7 | @Override
public boolean activate() {
return (!validate(Constants.WAITFOR_WIDGET)
&& !validate(Constants.SELECTION_WIDGET)
&& Inventory.contains(Settings.bar.getFirstId())
&& !Bank.isOpen()
&& (
!Constants.FALADOR_FURNACE_AREA.contains(Players.getLocal())
&& !Constants.EDGEVILLE_F... |
f87a47bb-66e5-4e5c-ac50-e5e5c6533342 | 1 | public double get() {
double val = _channel.getAverageVoltage();
return val > 0.05 ? val : 0;
} |
f852658e-9681-471f-ad62-f95c095179fd | 8 | public void slow() {
int scrollMove = num > 0 ? Move.DOWN: Move.UP;
if (num < 0)
num = -num;
if (num == 0 && withMove != 0)
seqEflButtonNoDelay(withMove, initialButtonMetric);
if(num > 0)
seqEflButtonNoDelay(scrollMove | (num == 1 ? withMove : 0), initialButtonMetric);
for (int i=1; i<num; i++) {... |
a46aa11d-51af-43b7-a1be-917204093017 | 9 | public void eventTextDescription(Event e){
//by Budhitama Subagdja
String desc = "";
desc = desc + "At (" + e.x + "," + e.z +") ";
desc = desc + "Health: " + e.curHealth + " ";
if(e.emeDistance<1){
desc = desc + "Enemy Detected! Distance: " + e.emeDistance;
}
jTextArea3.append(desc);... |
355fc42e-7598-4128-b4b9-c68c4566cdf2 | 1 | public boolean getBit(Integer bitNr) {
if((this.getWert() & (1 << bitNr)) != 0) {
// The bit was set
return true;
}
else {
return false;
}
} |
ddeb7258-789d-4b78-b72b-4f739e511b1d | 4 | private boolean isJunction(Pacman player){
int x= player.getX();
int y= player.getY();
if ((board[x][y-1] == 0) && (board[x][y+1] == 0))
return false;
if ((board[x-1][y] == 0) && (board[x+1][y] == 0))
return false;
return true;
} |
d05fbcb5-8059-4df7-bea2-b53fd693f728 | 4 | public void launchMinecraft(String[] args) {
this.setVisible(false);
if (loginPanel1.forceUpdate()) {
DisplayFrame displayFrame = new DisplayFrame();
displayFrame.setVisible(true);
displayFrame.downloadFiles();
displayFrame.setVisible(false);
}
... |
3f2f0160-b953-4382-9f7b-4bcb1bf739c0 | 5 | public static void deleteFromFile(String file, String name) {
try {
BufferedReader r = new BufferedReader(new FileReader(file));
ArrayList<String> contents = new ArrayList<String>();
while(true) {
String line = r.readLine();
if(line == null) {
break;
} else {
line = line.trim();
}
... |
c689c7c3-7e4c-47cf-bddc-4555fa41dbb7 | 4 | public boolean isPrevious(VertexInterface pere, VertexInterface fils) {
if (fils instanceof EBox && pere instanceof EBox) {
if (pere.isPrevious(fils))
return true;
else if (fils.isPrevious(pere))
return true;
else
return false;
} else
return false;
} |
ea1bf7c3-944a-4839-841b-442cc3aa80c2 | 0 | public boolean containsID(int id) {
return laenderMap.containsKey(id);
} |
ed1dd42e-f3e5-4299-8f20-6a9de5090950 | 2 | private Player getNewPlayer(String title) {
NewPlayerView dialog = new NewPlayerView();
JOptionPane.showMessageDialog(null, dialog.getInputs(), title,
JOptionPane.PLAIN_MESSAGE);
Player player = new Player(PieceColor.WHITE, dialog.getName());
if(dialog.getType().equals("Random CPU")) {
... |
ade29c70-293b-411f-a15e-5cba06a447fb | 6 | private boolean lineIsInFrame(int x1, int x2, int yValue, int xSize, int ySize)
{
int compareX = getLeftBorder();
if ( yValue <= 0 )
return false;
if( yValue >= ySize)
return false;
if( x1 <= compareX && x2 <= compareX)
return false;
if( x1 >= xSize && x2 >= xSize)
return false... |
80d88d09-fe05-4222-9c11-d7f730dc866c | 9 | private String[] tokenize(String query) {
int position = 0;
boolean inQuotes = false;
ArrayList<String> words = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
while (position < query.length()) {
char c = query.charAt(position++);
if (inQuotes) {
if (c == '"') {
words.ad... |
61bb6a99-af3a-42c4-b24d-5c0f6e1735b0 | 6 | public void updateAsScheduled(int numUpdates) {
commerce.updateCommerce(numUpdates) ;
paving.distribute(Economy.ALL_PROVISIONS) ;
dangerMap.updateVals() ;
for (Mission mission : missions) mission.updateMission() ;
//
// Once per day, iterate across all personnel to get a sense of citizen
//... |
78e92a37-9f20-4d3d-9b47-06391fbd0a0e | 7 | @Test
public void testEvaluate() {
short credits = prof.getCredits();
Student[] result = prof.evaluate();
for (int k = 0; k < result.length; k++) {
assertTrue("GPAs must be between 0.0 and 4.0!", result[k].getGPA() >= 0.0 && result[k].getGPA() <= 4.0);
assertTrue("Student GPAs must be equal to one of... |
a72bf451-0617-4fa5-9e2b-eee2b1d1b327 | 6 | private void setPrimaryUser(String channel, String state) {
int ch = new Integer(channel);
ArrayList<Integer> unsensed = new ArrayList<Integer>();
if(state.equals("1")) {
// On
int currUsers = primaryUsers.containsKey(ch) ? primaryUsers.get(ch) : 0;
primaryUsers.put(ch, currUsers + 1);
} else {
// O... |
d1f917b7-565b-4fd6-8ef6-939a0092ff29 | 1 | @Override
protected void compute() {
// Better use Runtime.getRuntime().availableProcessors()
if (end-start < 10)
awardBonus();
else {
invokeAll(new AwardBonus(accounts,start,(start+end)/2),
... |
fc09c41d-02a6-4341-b722-51df6c26607f | 9 | public Object getObjectInstance(Object obj, Name name,
Context nameCtx,
Hashtable<?,?> environment)
throws Exception
{
Reference ref = (Reference) obj;
String api = null;
String url = null;
String user = null;
String password = null;
for (int i = 0... |
bf78d363-682b-4651-9c5c-62ac16230df0 | 9 | public static void main(String[] args) {
if (!ApplicationHelper.SHOW_ERROR) {
System.err.close();
}
DocumentIndexer indexer = new LuceneIndexer();
boolean forceIndex = args.length > 0 && args[0].equals("-f");
if (forceIndex || !indexer.hasIndexData(Settings.get("INDE... |
a80e90fc-817e-4791-9c17-bd7d623d9a65 | 8 | private void hentPersoner(boolean ignoreError) {
String value = person_textField.getText();
ArrayList<Person> personer;
if (!value.isEmpty()) {
personer = sLEPHandler.getPersonV2(value);
if (!personer.isEmpty()) {
personer_table.setEnabled(true);
... |
6e553ad8-1c31-4f1b-9156-1fd7f3c4569d | 5 | private void startServer() throws IOException {
this.selector = Selector.open();
ServerSocketChannel serverChannel = ServerSocketChannel.open();
serverChannel.configureBlocking(false);
// retrieve server socket and bind to port
serverChannel.socket().bind(listenAddress);
... |
dd458f01-f682-43d8-b8a8-06d981edb409 | 7 | public void printEverything(final boolean selectedDataTableObjectsOnly) {
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
if(_printFrame != null) {
_printFrame.getFrame().dispose();
_printFrame = null;
}
initPrintFrame(selectedDataTableObjectsOnly);
}
... |
514b13f1-bf10-4a19-a1d9-9d1907747b67 | 7 | void selfTrain(Instance testInst) {
int maxInstances = this.maxInstancesOption.getValue();
int poolSizeRatio = poolSizeOption.getValue();
int poolLimit = maxInstances / poolSizeRatio;
int poolCount = 0;
VotedInstancePool vInstPool = SelfOzaBoostID.getVotedInstancePool();
... |
53ce7fd6-027c-4fae-8ea7-eebfa78cbe55 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Estado)) {
return false;
}
Estado other = (Estado) object;
if ((this.id == null && other.id != null) || (this.i... |
9fd7a2ed-1b9e-4c83-a5ff-95636c7a23c1 | 0 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
} |
6ad85e4f-2e76-460f-97f0-3b36a536ac06 | 3 | public final Runnable runMaster() {
this.master.setName("master");
this.master.start();
final Runnable workerRun = new Runnable() {
@Override
public void run() {
while (true) {
if (!runTask()) {
return;
}
}
}
};
final int nMax = Math.max(NUM_CPUS, 2);
for (int n = 0; ++n < ... |
64e49910-a8d9-44be-9a6f-4beda3cd77a0 | 3 | public static short[] toShortA(byte[] data) {
if (data == null || data.length % 2 != 0) return null;
// ----------
short[] shts = new short[data.length / 2];
for (int i = 0; i < shts.length; i++) {
shts[i] = toShort( new byte[] {
data[(i*2)],
data[(i*2)+1]
... |
97d476b2-815c-4397-8e4d-7eec32bfe767 | 7 | @Override
public void run()
{
JLabel lab = MyFrame.instance.screen.getStatusLabel();
lab.setForeground(Color.green);
FuzzTest.parent = this;
long timeStarted = System.currentTimeMillis();
for(int i = 0 ; i < maxExecutions && canRun ; i++)
{
if(FuzzTest.running < this.maxThreads)
{
new FuzzTest(... |
ae032eb9-b458-4c20-9bb0-14fd9f28b7cc | 5 | public void resetSuperPermission(String gatePerm) {
PluginManager pm = plugin.getServer().getPluginManager();
gatePerm = "XcraftGate.use." + gatePerm;
if (pm.getPermission(gatePerm) == null) {
pm.addPermission(new Permission(gatePerm, PermissionDefault.TRUE));
}
Permission superPerm = pm.getPermissio... |
726e6132-0294-4840-9c3e-2ff40f3c2ee0 | 3 | public HotelsConfig(JavaPlugin plugin, String fileName) {
if (plugin == null)
throw new IllegalArgumentException("plugin cannot be null");
if (!plugin.isInitialized())
throw new IllegalArgumentException("plugin must be initiaized");
this.plugin = plugin;
this.file... |
d23e26ee-3e99-446e-87ed-00523df01ff6 | 1 | public void visitAttribute(final Attribute attr) {
buf.setLength(0);
buf.append(tab).append("ATTRIBUTE ");
appendDescriptor(-1, attr.type);
if (attr instanceof Traceable) {
((Traceable) attr).trace(buf, null);
} else {
buf.append(" : unknown\n");
}
text.add(buf.toString());
} |
d5b664eb-a43d-4549-9bdd-5177aadc1574 | 4 | private void paivitaMaxX(){
double maxX = Double.NEGATIVE_INFINITY;
for (KentallaOlija osa : osat){
if (osa.getMaxX() > maxX){
maxX = osa.getMaxX();
}
}
if (getSuojakilpi()){
if (getX()+getSuojakilvenHalkaisija()/2 > m... |
9fb3c8c4-c187-483b-b7f9-5fc0d21ab923 | 6 | public static void loadModelHeader(byte modelData[], int modelId) {
if (modelData == null) {
ModelHeader modelHeader = modelHeaders[modelId] = new ModelHeader();
modelHeader.vertexCount = 0;
modelHeader.triangleCount = 0;
modelHeader.texturedTriangleCount = 0;
return;
}
Buffer stream = new Buffer(m... |
d14a6f80-8e4f-4cf3-b4ae-2d33a8380e88 | 8 | @Override
public void onPovUpdate(int controllerID, float hatSwitchPosition, Component component)
{
if(Float.compare(hatSwitchPosition, Component.POV.UP) == 0)
{
player.incrementSelectedHotbar(-0.075f*2f);
}
else if(Float.compare(hatSwitchPosition, Component.POV.DOWN)... |
752ac1ae-a979-4cb3-9918-61f7e2e78391 | 5 | public void putCharacter(int x, int y, ScreenCharacter character)
{
synchronized(mutex) {
if(y < 0 || y >= backbuffer.length || x < 0 || x >= backbuffer[0].length)
return;
//Only create a new character if the
if(!backbuffer[y][x].equals(character))
... |
e8a20f98-b82d-4bee-963e-7fe28f495bcd | 7 | private Request endGameBlockRequest(Peer peer) {
RequestExtended reToReturn = null;
for (RequestExtended re : allPendingRequests) {
if (peer.hasPiece(re.getIndex()) && !re.getPeers().contains(peer) &&
(reToReturn == null || reToReturn.getPeers().size()>re.getPeers().size(... |
a5407b51-b666-4b2e-be89-0c6037152cf2 | 3 | public synchronized boolean setItem(FieldItem item, Position position){
if ((position.getX() <= this.getXLength()) || (position.getY() <= this.getYLength())) return false;
if (field[position.getX()][position.getY()] == null) {
field[position.getX()][position.getY()] = item;
retur... |
568c82f7-824a-49af-9439-2285d8ad42e1 | 4 | public Map<String, String> grab() throws MalformedURLException, IOException {
Document doc = Jsoup.connect(link).get();
Elements ids = doc.select("#offers_table td > table");
Map<String, Integer> map = new HashMap<>();
String line, line2;
StringBuilder builder;
int idPos... |
35df9f4c-6076-422c-914b-e1bfac6ff2c8 | 8 | private static byte[] unicode(String string) {
final BBAOS stream = new BBAOS();
for (final char c : string.toCharArray())
if ((c >= '\u0001') && (c <= '\u007f'))
stream.write(c & 0x7f);
else if ((c == '\u0000') || ((c >= '\u0080') && (c <= '\u07ff')))
stream.write(((c & 0x7c0) >> 6)... |
4367f484-b4fc-449f-b688-132feeff157d | 4 | private void readMapper(String mapperDf) {
File file = new File(mapperDf);
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String title = reader.readLine();
mTitles = title.trim().split("\\s+");
String line;
while((line = reader.readLine()) != null) {
String[] s = line... |
bd740325-2886-4c16-8f49-7cfee01c227d | 8 | private double desiredDirection() {
if (directions.contains(Direction.UP)) {
if (directions.contains(Direction.RIGHT)) {
return 45;
}
if (directions.contains(Direction.LEFT)) {
return 315;
}
return 0;
}
if (directions.contains(Direction.DOWN)) {
if (directions.contains(Direction.RIGHT)) ... |
a1aa31ee-9a4c-4aee-b69c-97a2a991641b | 7 | public void createResearchItem(Node item) {
String name = "";
String description = "";
ResearchEvent event = null;
String sprite = null;
int cost = 0;
Node attr = item.getFirstChild();
while(attr != null) {
if(attr.getNodeType() == Node.ELEMEN... |
5c1b5baf-12a1-4144-a781-be6f991da554 | 4 | @Override
public Tipo validarSemantica() throws Exception {
Tipo izq,der;
izq=izquierdo.validarSemantica();
der=derecho.validarSemantica();
if (izq instanceof TipoInt || der instanceof TipoFloat){
if (der instanceof TipoInt || der instanceof TipoFloat ){
r... |
b5362e34-930b-48bd-a8ba-4476345030b9 | 9 | public void givePickaxeIntervalReward(Player p, int breaks) {
if (pickaxeIntervalRewards == null || pickaxeIntervalRewards.isEmpty()) {
return;
}
for (Reward r : pickaxeIntervalRewards.values()) {
if (breaks % r.getBlocksNeeded() == 0) {
if (r.getCommands() == null || r.getCommands().isEmpty()) {
... |
cdd51421-d5f2-42f7-9255-ffef8863e3fb | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((commands.size()==0)||(CMath.s_int(CMParms.combine(commands,0))==0))
{
mob.tell(L("You must specify how big of a pile of gold to create."));
return false;
}
final int amount=CMath.s_int(... |
1129f876-f78e-4e5b-ac13-756bc827f364 | 0 | public Boolean getHasTicket() {
return this._hasTicket;
} |
5eae40b9-b66f-4b5d-aeff-a4ec8ead0a2d | 0 | public AbstractFacade(Class<T> entityClass) {
this.entityClass = entityClass;
} |
b14a0f8c-0413-41ae-9d28-480fe56913d1 | 9 | private List<Mapper> estimateMappers() {
List<Mapper> newMapperList = new ArrayList<Mapper>();
if(isSplitSizeChanged || isMapperConfChanged) {
MapperEstimator mapperEstimator = new MapperEstimator(finishedConf, newConf);
//split size is changed
if(isSplitSizeChanged) {
//List<Long> splits... |
045e747f-f50f-45a6-b7ab-aabc4e006ad0 | 0 | public GrammarEnvironment(GrammarInputPane input) {
super(null);
this.input = input;
input.getTable().getModel().addTableModelListener(
new TableModelListener() {
public void tableChanged(TableModelEvent event) {
setDirty();
}
});
} |
6a0e9da8-b385-41d2-976d-1e3d0ed4bc3f | 9 | @Override
public void whatToDo(Character character) {
Game currentGame = Game.getInstance();
int rollResult = currentGame.rollDice(character.getCurrentKnowledge());
if (rollResult >= 6) {
return;
}
if (rollResult >= 3 && rollResult <= 5) {
Trait mentalTraitChosen = currentGame.chooseAMentalTrait();
... |
7043dba8-d635-41c2-844a-f07ce061ef56 | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Position other = (Position) obj;
return this.x == other.x && this.y == other.y;
} |
ab484343-30fd-449d-aa38-2d3eb1a6a7a2 | 3 | public String getKeywords() {
Object value = library.getObject(entries, "Keywords");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
else if (val... |
f0ccc462-c1de-4c75-92da-1bbdfd054678 | 4 | static String compress(String s) {
if (countCompress(s) >= s.length()) {
return s;
}
StringBuffer sb = new StringBuffer();
char[] charArray = s.toCharArray();
char currentChar = '\0';
int count = 0;
for (char ch: charArray) {
if (ch == cur... |
0bb22039-866f-4302-9f5e-98e9dabf3906 | 8 | public List<Fornecedor> buscar(Fornecedor filtro) {
try {
String sql = "select * from pessoa p join Fornecedor f on p.IdPessoa = f.IdPessoa where ativo = 1 ";
String where = "";
if (filtro.getNome().length() > 0) {
if (where.length() > 0) {
... |
5b659fd6-4ce2-41da-b3d6-def6e1edb1b1 | 7 | private static void readGroups( Element groupsElement, MVD mvd )
throws Exception
{
TreeMap<Short,Group> groups = new TreeMap<Short,Group>();
NodeList nl = groupsElement.getChildNodes();
for ( int i=0;i<nl.getLength();i++ )
{
Node groupNode = nl.item( i );
if ( groupNode.getNodeType() == Node.ELEMENT_N... |
e9ea31b8-649c-4650-9ad1-c7451ab669a1 | 2 | @Override
public void fireClick() {
for (ClickListener listener : this.clickListeners) {
if (listener != null) listener.onClick(this);
}
} |
c0698755-421a-4f38-8ad1-6720baba06b7 | 0 | public ArrayList <Month> getMonths()
{
return months;
} |
85cdb0e7-655b-4c91-babc-6628fc06d0b4 | 4 | public static final int lowNeighbour(int[] v, int x) {
int max=-1, n=0;
for(int i=0; i<v.length && i<x; i++) {
if(v[i]>max && v[i]<v[x]) {
max=v[i];
n=i;
}
}
return n;
} |
f216f20f-e473-4391-aeb6-c39a69e7280d | 7 | private File createDirectoryListing(File requestResource)
throws IOException {
for (File file : requestResource.listFiles()) {
for (String item : Configuration.getConfig().getDirectoryIndex()) {
if (file.getName().equals(item)) {
return file;
}
}
}
String style = "ul li:nth-child(2n) {back... |
69c7788f-cde1-4a81-84fc-a99525117283 | 5 | public Object getValueAt(int row, int col) {
// Fermentable m = (Fermentable) data.get(row);
try {
switch (col) {
case 0: // steep
return data.getFermentStepType(row);
case 1: // mash
return new Integer(data.getFermentStepTime(row));
case 2 :
return new Double(data.getFermentStepT... |
fe95928f-4682-4335-9492-dd30df5cc2a9 | 9 | @Override
public void run() {
init();
setIconImage(config.getJetrisIcon());
keyHandler = new KeyAdapter(){
@Override
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
Move move = Move.DOWN;
if... |
90fed60a-67e4-438c-ad6b-461286d518e2 | 8 | public void run()
{
while (true)
{
try
{
byteArray = new byte[1024];
receivePacket = new DatagramPacket(byteArray, byteArray.length);
ds.receive(receivePacket);
String data = new String(receivePacket.getData(), "UTF-8")
.trim();
st = new StringTokenizer(data, Protocol.DELIMITER);
... |
9c19febe-cabc-475b-a046-7d08f0480982 | 0 | public void setMsgFormat(int msgFormat) {
MsgFormat = msgFormat;
} |
6f308fb7-7b03-4d38-9e27-a65422aef718 | 8 | public final static String replaceFirst(final String str, final String thisStr, final String withThisStr)
{
if((str==null)
||(thisStr==null)
||(withThisStr==null)
||(str.length()==0)
||(thisStr.length()==0))
return str;
for(int i=0;i<str.length();i++)
{
if(str.charAt(i)==thisStr.charAt(0))
{
... |
429d97ea-3277-41d4-beaa-5152b0f1d6a6 | 6 | @Override
public void update(MiniGame game)
{
if (calculateDistanceToTarget() < INTERSECTION_RADIUS)
{
stopMovingToTarget();
if (pathIndex < path.size() - 1 && currentIntersection.open)
{
Road roadInBetween = ((pathXDataModel)ga... |
bb4172b5-48a9-4a6b-b34a-2077510c9621 | 1 | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: java Dump <class file name>");
return;
}
DataInputStream in = new DataInputStream(
new FileInputStream(args[0]));
... |
22104bf2-c378-4c68-9527-89dc6e72b606 | 1 | public void redirectOutput(Writer w) {
if (w == null) {
throw new NullPointerException("w");
}
stdout = w;
} |
89a0a06f-9097-4180-babb-a2756aba0c7a | 7 | @POST
@Path("/{repoName}/{fileName}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public String submitFile(
@PathParam("repoName") String repoName,
@PathParam("fileName") String fileName,
@FormDataParam("commitMessage") String commi... |
d8a71972-cd75-4385-8e99-2a0f85bf243f | 7 | protected Document createDefaultModel() {
return new PlainDocument() {
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
char[] old = IntegerTextField.this.getText().toCharArray();
char[] source = str.toCharArray();
char[] result = new char[source.length];
... |
389c19b4-791c-4a94-94f1-52dc38d04339 | 1 | public Sprite create(Owner owner, Resource res, Message sdt) {
CommonPlant spr = new CommonPlant(owner, res);
spr.addnegative();
Random rnd = owner.mkrandoom();
for(int i = 0; i < num; i++) {
Coord c = neg.bc.add(rnd.nextInt(neg.bs.x), rnd.nextInt(neg.bs.y));
Tex s = strands[rnd.nextInt(strands.... |
cfff0675-8e3a-4100-81df-3d2b4933c521 | 1 | @Override
public AbstractDescriptionPanel getDescription() {
if ( owner.getSelected() ) {
return new DescriptionPanelCityAll( this );
/*
switch (state) {
case normal:
return getStatsPanel();
case build:
... |
e4ab00ab-509b-43e6-8323-80b1fbcf529e | 0 | public T getFromKit(int index){
return kit.get(index);
} |
c5094eb6-819b-4800-a36e-2fe0eb9ab9c4 | 3 | public void TakeMisc(String message1, String message2, String message3, int reqSkillNum, int lvlReq, int XPskillnum, int XPamount, int item, int itemAmount, int delay, int emote) {
if(TakeMiscTimer == 0) {
if(playerLevel[reqSkillNum] >= lvlReq) {
setAnimation(emote);
sendMessage(message1);
sendMessage(messag... |
1e5bccb8-f890-4b88-8a42-268f68f31e96 | 4 | public void componentResized(ComponentEvent e) {
if(Debug.gui)System.out.println(e.getComponent().getClass().getName() +
" --- Resized ");
//if the JFrame state is normal & it isn't maximised, save the size of
//the Jframe
if(frame.getExtendedState()==JFrame.NORMAL && !fullScreenOn) {
pr... |
08784437-759c-443e-a2f6-fd58f915c5c9 | 8 | @SuppressWarnings("unused")
public static Course constructCourseObject(String cID) {
// Method variables
Course course = null;
ResultSet rs = null;
// Course variables
String courseName = null, courseID = null, instructorName = null;
int instructorID;
Date startDate = null, endDate = null;
Instructor i... |
25e268ee-e3f5-4e11-9db2-cc46d26bcab3 | 1 | public void update( float delta )
{
for ( GameComponent component : components )
component.update( delta );
} |
e8af8019-55d7-4e7f-9d64-a1b50cdeaafa | 5 | public static LLParseTable generate(Grammar grammar) {
LLParseTable table = new LLParseTable(grammar);
Map first = Operations.first(grammar), follow = Operations
.follow(grammar);
Production[] productions = grammar.getProductions();
for (int i = 0; i < productions.length; i++) {
String alpha = production... |
01f27661-9676-4373-915e-67b03366eb16 | 0 | public void setDepartment(int department) {
this.department = department;
} |
aad7687a-65c1-4337-8a4d-ceecd16d4364 | 7 | @Override
public List<String> getFilesList() {
final List<String> files = new ArrayList<String>();
if (isConnect()) {
sendPackage(new Package(Mode.GET_FILES_LIST, new ArrayList<Object>()));
Object obj;
while (true) {
try {
obj = ois.readObject();
} catch (final IOException e) {
System.... |
35dbc036-d3ee-4b4e-9a43-6ca60128ae0a | 6 | @EventHandler
public void PigZombieHeal(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.getPigZombieConfig().getDouble("PigZombie.H... |
d4304c08-f156-422d-b708-29cbcef102b8 | 2 | public ResultSet startQuery(String query) throws ClassNotFoundException, SQLException
{
ResultSet rstResultSet = null;
try
{
connect();
rstResultSet = _statement.executeQuery(query);
}
catch (SQLException e)
{
_logger.fatal(e.getMessage());
e.printStackTrace();
}
catch (ClassNotFoundExcepti... |
1e5fb04c-88e9-450f-a9ba-885e9a31ac4d | 7 | public final void namespace_decl() throws RecognitionException {
CommonTree id=null;
try {
// C:\\Users\\Timo\\EclipseProjects\\GalaxyX\\build\\classes\\com\\galaxyx\\treewalker\\GalaxyXDefinitionWalker.g:38:2: ( ^( NAMESPACE id= IDENTIFIER ( class_decl )* ) )
// C:\\Users\\Timo... |
58f2f2ba-9d43-48e9-a4a0-3e71ac358dbd | 8 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int times = 1;
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
int ntimes... |
ce3a1e73-454a-4bdb-9d52-69dc78e6f622 | 7 | public void createPanel() {
contentPanel.setLayout(null);
setTitle("New Team");
setSize(Constants.STD_DIALOG_WIDTH, 225);
setLocationRelativeTo(getParent());
setIconImage(Images.ADD_TEAM_ICON);
lblTeamName.setBounds(31, 34, 64, 14);
contentPanel.add(lblTeamName);
teamName = new JTextField();
tea... |
3a43ec00-5099-47f9-aef3-71c98e8a2e7f | 2 | public void addDefaultType(AccountTypes accountTypes) {
JournalType defaultType = new JournalType("default");
defaultType.setDebetTypes(accountTypes.getBusinessObjects());
defaultType.setCreditTypes(accountTypes.getBusinessObjects());
try {
addBusinessObject(defaultType);
... |
30baf421-d3a8-40f4-8c63-cb437c294587 | 6 | protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
org... |
f174ad3a-43d4-4a98-ac00-0d5cdadc5e21 | 9 | private boolean isStuck(MapLocation location, MapLocation forbidden){
for(Direction direction : Direction.values()){
if(direction.equals(Direction.OMNI) ||
direction.equals(Direction.NONE)){
continue;
}
if(direction.opposite().equals(myInitialDirection) ||
direction.opposite().equals(myIni... |
542edd6a-c8ef-4b0f-a193-32ec9379ab0b | 9 | final protected int require (int required) throws KryoException {
int remaining = limit - position;
if (remaining >= required) return remaining;
if (required > capacity) throw new KryoException("Buffer too small: capacity: " + capacity + ", required: " + required);
int count;
// Try to fill the buffer.
if ... |
63de48ff-fb3e-4c34-a1d6-ba4fbce3e5f0 | 1 | public void visit_i2l(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
46b787ef-7916-4af8-a440-3108f709bc53 | 3 | public Tree equalityExpressionPro(){
Tree firstConditionalExpression = null, secondConditionalExpression = null;
Symbol operator = null;
if((firstConditionalExpression = relationalExpressionPro()) != null){
if((operator = accept(Symbol.Id.PUNCTUATORS,"===?")) != null){
if((secondConditionalExpression = ... |
238768f9-c821-4db5-97b7-86a76fd6078b | 3 | @Test
public void testSingleWriterManyReads()
{
final int MESSAGES = 10000;
final int READERS = 10;
final int MESSAGES_PER_READER = MESSAGES / READERS;
final AtomicInteger nullCounter = new AtomicInteger();
final BlockableQueue<Integer> q = new BlockableQueue<Integer>();
q.setBlocking(true);
Runnabl... |
f1fc70c7-fd96-4a3b-8056-8e1136c9ab9d | 7 | public TaskManiaGUI() {
final XMLParser parser = new XMLParser();
graphic = new Job("root", "");
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
Component node = (Component) jTree1.getLastSelectedPathComponent();
... |
5a448380-2bc2-45c5-a868-bdbba0e630e8 | 1 | protected void addDocumentStart() {
try {
h.startDocument();
} catch (SAXException ex) {
throw new RuntimeException(ex.getException());
}
} |
4680c9e9-0040-4fa6-89a0-fbf3e02e4ce7 | 3 | public int getPocketMoney(final Student student) {
if(student instanceof HighSchoolStudent) {
HighSchoolStudent hsStudent = (HighSchoolStudent)student;
if(hsStudent.getScore() < mOutstandingScore) {
return getPocketMoneyForHighSchoolStudent();
} else {
return getPocketMoneyForOutstandingHighSchoolStu... |
0b9276f5-e2b5-4eda-98b1-e26858f60dfc | 5 | public boolean hasChanged()
{
if (changed) return true;
for (ConfigCategory cat : categories.values())
{
if (cat.hasChanged()) return true;
}
for (Configuration child : children.values())
{
if (child.hasChanged()) return true;
}
... |
f8fd45e9-daf6-409e-9d8d-c66d67e44761 | 6 | public boolean estPrenable(Piece p)
{
boolean prenable = false;
Vector<Position> destinationPossibleAdverse;
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
if(this.tableau[i][j] != null && this.tableau[i][j].getCouleur() != p.getCouleur())
{
destinationPossibleAdverse = destina... |
4fb1274f-2221-49ce-83d2-46d89c92e5a9 | 9 | public static void main(String[] args)
{
/*
* Run startup and check for arguments
*/
File midiFile = null;
int startIndex = 0;
int endIndex = Integer.MAX_VALUE;
int maxScore = 1500;
try
{
if(args.length == 0)
throw new Exception("No arguments Exception");
else
{
midiFile = new File... |
531c34ad-f6b3-4312-a8dc-7b83eb58eafa | 0 | private String createFileName(){
return this.dirPath + getRightNowTimeStr("-", "-", "_");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.