method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d053039f-7319-40f5-b8bc-f7544e841350 | 2 | public void setCurOption(int curOption) {
this.curOption = curOption;
for(int i = 0; i < options.get(curPage).length; i++) {
if(i != curOption) options.get(curPage)[i].setSelected(false);
else options.get(curPage)[i].setSelected(true);
}
} |
82f18a0b-182c-461b-a11f-1486150c3804 | 1 | private static String executeDropTableCommand(DataBaseManager dbManager, Command command) {
List<String> args = command.getArgs();
String tableName = args.get(0);
String msg = "";
boolean result = dbManager.dropTable(tableName);
if (result) {
msg = "table " + tableNa... |
0f9c252b-3243-4b3f-9fc8-58efa615b2a3 | 0 | SearchPanel() {
this.setLayout(new BorderLayout());
this.setBorder(new TitledBorder("分类检索"));
firs_container.setLayout(new FlowLayout(FlowLayout.LEFT));
firs_container.add(src_startLabel);
firs_container.add(src_start);
firs_container.add(src_endLa... |
4330dad6-44b6-4e19-8b9a-230ee1a12eb2 | 0 | public int getVariableB()
{
return B;
} |
4d7024e2-2916-4398-90c1-cab96babad4d | 3 | private Position getSubImagePosition() {
Position position = new Position();
switch (currentType) {
case IN:
position.x = 1;
position.y = 1;
break;
case OUT:
position.x = 26;
position.y = 1;
... |
602286b6-07ab-43bb-b0d8-b78781d9c44c | 7 | private boolean blockBlocksFlow(World par1World, int par2, int par3, int par4)
{
int i = par1World.getBlockId(par2, par3, par4);
if (i == Block.doorWood.blockID || i == Block.doorSteel.blockID || i == Block.signPost.blockID || i == Block.ladder.blockID || i == Block.reed.blockID)
{
... |
98fc2766-c7bd-4318-8bf7-f2b5a8cc8b2e | 5 | public void ShuffleCards()
// Shuffles deck of cards using Random Selection
{
int selector;
for(int index = 0; index < 100; index++)
{
while(!deckStack.isEmpty())
{
currentCard = (String) deckStack.top();
rStack.push(currentCard);
... |
a809d2f9-808b-47d3-aa17-28d78a0847b4 | 4 | private void pickEmptyPos(int x[], int i) {
int max=maze.getSize();
char[][] auxmaze=maze.getMaze();
do {
x[0]=generator.nextInt(max);
x[1]=generator.nextInt(max);
} while (auxmaze[x[0]][x[1]]!=' ');
for(int j=0; j<i; j++) {
if(dragons[j].getX()==x[0] && dragons[j].getY()==x[1])
pickEmpt... |
4fd97296-4a4d-4f35-a985-d2494084422f | 7 | public boolean doDerivationGeneration(int depth, String parseTableFile) {
DerivationGenerator dg = null;
switch (config.derivGenMethod) {
case PG:
dg = new ScannerlessDerivGen2(config.threads);
((ParallelDerivationGenerator) dg).setDealerLength(config.derivGenDealLength);
break;
}
dg.setScannerless(g... |
6feb653c-2d21-41af-a403-354c57207bb8 | 7 | @Override
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
if (main.isGameOver()) {
return;
}
if (player.getX() < 0) {
player.setX(0);
}
if (player.getX() > Assign8.APPLET_WIDTH - player.getWidth()) {
player.setX(Assign8.APPLET_WIDTH - player.getWidth());
}
if (e.getKeyCod... |
98f8f3c7-2463-4633-81ec-58e8cdaef98d | 7 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int L = scan.nextInt();
int N = scan.nextInt();
int[] arr = new int[L+1];
Arrays.fill(arr, 0);
int[] k = new int[N];
for(int i=0;i<N;i++){
k[i] = scan.nextInt();
}
for(int i=0;i<N;i++){
int f = scan.nextInt();
arr... |
ce9a3870-5742-4093-813c-133e99fe7bba | 2 | public void load(File filepath){
try {
XMLReader xr = XMLReaderFactory.createXMLReader();
LoadingHandler handler = new LoadingHandler();
xr.setContentHandler(handler);
xr.parse(new InputSource(new FileReader(filepath)));
} catch (FileNotFoundException e1) {
System.out.println("ERROR: "+e1.getMessage(... |
45a06113-e191-45fd-bafa-5ca5ff81c7e2 | 4 | private int calcCost(List<Integer> moves, boolean caseSwitchNeeded) {
int cost = 0;
for(int i=0;i<moves.size()-1;i++)
if(moves.get(i).equals(moves.get(i+1)))
cost++;
if(caseSwitchNeeded && cost == 0)
cost++;
return cost + moves.size();
} |
66b7e131-4e13-4726-91ff-300576fe5271 | 4 | public boolean isOperators(String operator){
if(operator.equals("+")||operator.equals("-") || operator.equals("*")||operator.equals("/"))
return true;
else
return false;
} |
31eb9e6f-c627-442a-a028-d1e8c0fb86be | 4 | @Override
public Map<String, String> validateForCreate(Map<String, Object> properties) throws Exception {
Map<String, String> errors = new HashMap<String, String>();
if (properties != null) {
String nome = (String) properties.get("nome");
if (nome == null || nome.isEmpty()) {... |
14bfaac9-88a5-4161-aed0-6a7a5030d027 | 3 | public void end() {
continueLoop = false;
interrupt();
//Log.getInstance().logDebug("ServerConnectionHandler", "Closing for new Connections");
for(Socket cl : clientSocketList) {
try {
cl.close();
} catch(IOException e) {
e.printStackTrace();
}
}
MH.getConnections().stream().filter(ica -... |
a9cfa4cb-77a6-414a-8deb-025f591af164 | 0 | public EventCommentListResponse(
final Boolean success, final String errorMessage, final List<EventComment> eventCommentList
) {
super(success, errorMessage);
this.eventCommentList = eventCommentList;
} |
e6f8d7b5-e2ec-4973-b84d-974a96d80aa8 | 1 | public void draw(GOut g, Coord c) {
Coord sz = text.sz();
if(sz.x < 10)
sz.x = 10;
Coord tl = c.add(new Coord(sx, sb.bsz().y + sz.y + svans.sz().y - 1).inv());
Coord ftl = tl.add(sb.tloff());
g.chcolor(Color.WHITE);
g.frect(ftl, sz);
sb.draw(g, tl, sz.add(sb.bsz()));
g.chcolor(Color.BLACK);
g.image(text.t... |
ea594b6a-27d9-43db-bbda-7e49fb8ef1b2 | 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 Receptionist_1)) {
return false;
}
Receptionist_1 other = (Receptionist_1) object;
if ((this.id == null && othe... |
9954b91f-4de4-4156-882b-fdfcc2471150 | 3 | private static void getMsg
(
InputStream isIn
, int iCLen
, EzimContact ecIn
, String strSbj
)
throws Exception
{
byte[] bBuf = new byte[iCLen];
int iTmp = 0;
int iCnt = 0;
String strTmp = null;
while (! (iTmp < 0) && iCnt < iCLen)
{
iTmp = isIn.read();
if (! (iTmp < 0))
{
bBuf[i... |
5ce575a3-1a80-4884-ba3d-04d4ef032fe8 | 0 | public void setCategory(String category) {
this.category = category;
} |
74e460ac-2f46-4095-abcc-77189b598727 | 2 | public static boolean putModChat(Player p, String pName) {
if (!PlayerChat.plugin.ModChat.containsKey(pName)) {
PlayerChat.plugin.CustomChat.remove(pName);
PlayerChat.plugin.AdminChat.remove(pName);
PlayerChat.plugin.ModChat.put(pName, true);
Messenger.tell(p, Msg.MOD_CHAT_ENTERED);
return true;
} el... |
8165cbb8-1f72-44bb-9800-e69beca6bf81 | 6 | void connect(Object from, String from_out, Object to, String to_in) {
// add them to the set of commands
if (from == to) {
throw new ComponentException("src == dest.");
}
if (to_in == null || from_out == null) {
throw new ComponentException("Some field arguments are null");
}
ComponentAccess ca_from ... |
c50f8840-8949-4285-b74b-432de46d265e | 5 | public void keyPressed(KeyEvent kEvent) {
if(kEvent.getKeyCode() == kEvent.VK_ESCAPE){
System.exit(0);
}
if (kEvent.getKeyCode() == kEvent.VK_LEFT){
if(playSpeed> 0.25){
playSpeed = playSpeed/2;
}
}
if (kEvent.getKeyCode() == kEvent.VK_RIGHT){
if (playSpeed < 4){
playSpeed = playSpeed*2;
... |
07456d9c-409b-4b2f-98f9-57ba796739ce | 5 | private List<DirectionStayHotel> getHotelInfo(AbstractDao dao, List<DirectionStayHotel> stays) throws DaoException {
for (DirectionStayHotel st : stays) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_HOTEL, st.getHotel().getIdHotel());
List<Hotel> hotels = dao.findHot... |
45efdce9-57b6-4c38-a4d1-601c84042f72 | 4 | public static void editReservation(Reservation r){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
Prepa... |
0ba9b24b-ed5a-4bc4-8ec1-09aa89de42c9 | 2 | @Test
public void sort() {
// create a copy, shuffle it, sort it and then compare to original
@SuppressWarnings("unchecked")
ArrayList<String> copy = (ArrayList<String>) samples.clone();
Collections.shuffle(copy);
Collections.sort(copy);
Iterator<String> itra, itrb;
itra = samples.iterator();
itrb =... |
d642c59b-fab9-43b5-b6ae-fd646905e22d | 0 | public AIAsset(String assetPath) {
this.assetPath = assetPath;
} |
bf7c686f-1eee-4cb3-b51f-e8ba4ebadd33 | 7 | private void drawEntitiesToScreen(Graphics2D graphics)
{
for (int i = 0; i < getSnakes().size(); i++)
{
Color c = getColorForSnake(i);
graphics.setColor(c);
Snake e = getSnakes().get(i);
boolean isPhased = e.isPhased();
LinkedList<SnakePiece> pieces = e.getSnakePieces();
for (SnakePiece piece :... |
24f4fee2-eb44-42d8-8973-68d10e101b60 | 0 | @Override
public int compareTo(Node o) {
return this.value - o.value;
} |
ff472af8-636c-4dfe-93d1-c527c47b8552 | 1 | public void testFormatSuffixSimple4() {
try {
builder.appendSuffix(" hours");
fail();
} catch (IllegalStateException ex) {}
} |
1f54dc5b-c4a4-44e0-b4dd-16637f58c92a | 3 | private int readID3v2Header(InputStream in) throws IOException
{
byte[] id3header = new byte[4];
int size = -10;
in.read(id3header,0,3);
// Look for ID3v2
if ( (id3header[0]=='I') && (id3header[1]=='D') && (id3header[2]=='3'))
{
in.read(id3header,0,3);
int majorVersion = id3header[0];
int revisi... |
eac54c7c-afe5-4faf-a620-89244049b62e | 8 | protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetTotalBalance()) {
if (!first) json.append(", ");
json.append("\"TotalBalance\" : {");
Amount totalBalance = getTotalBalance();
json.append... |
1e581cb3-af79-43b3-98ed-97e737c30425 | 3 | public void visitClassType(final String name) {
if ("java/lang/Object".equals(name)) {
// Map<java.lang.Object,java.util.List>
// or
// abstract public V get(Object key); (seen in Dictionary.class)
// should have Object
// but java.lang.String extends ... |
b7c922bd-9c31-4ea8-b3c0-60a9dffc4132 | 6 | public static void calculateTFandIDF(String docContents, String docName, int collectionSize,
double docLength) {
ArrayList<String[]> currentPostingsList;
String[] posting = new String[6];
int position = 0;
boolean documentMatch = false;
for (int j = 0; j < tokens.si... |
8dbfc7f3-0452-4e54-bd9f-4be3fa8b3d94 | 8 | public static void main(String[] args) {
Display.setAppName("HyberCube");
final Display display = Display.getDefault();
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
if (System.getProperty("os.name").contains("OS X")) {
// Menu bar
System.setProperty("apple.laf.useScree... |
950cd1ac-0f82-4984-843a-052f8dd0f1dc | 3 | public void mouseEntered(MouseEvent evt) {
if (evt.getSource()==newspaper){
mousein = 1;
}
if (evt.getSource()==map){
mousein = 2;
}
if (evt.getSource()==close){
mousein = 3;
}
} |
22658a45-7cdf-47a3-b8a5-8763219122fa | 5 | public static Map loadMap(BufferedReader reader) {
try {
String line;
String tileName;
Point start = new Point();
boolean auto;
ArrayList<Tile> tiles = new ArrayList<Tile>();
line = reader.readLine();
Boolean tempTown = Boolean.parseBoolean(line);
while(!(line = reader.readLine()).matches("<EN... |
d1f19e7b-82c2-413d-a2a7-71b90fe416a5 | 8 | void deleteServerInfoFromDatabase(ServerInfoDAO serverInfoDAO){
if (serverInfoDAO.queryAll().size() == 0){
HelpPrompt.printNoDataInDataBase();
} else {
HelpPrompt.printSpecifyIPOrGroupOrAllForDelete();
String ask_delete_ip_or_group = getInputContent();
if ... |
383e5bc2-1be2-417f-863e-43a8c1395493 | 6 | public boolean tarkistaViistot(int kuka) {
if (poyta[0][0] == kuka && poyta[1][1] == kuka && poyta[2][2] == kuka) {
return true;
}
if (poyta[0][2] == kuka && poyta[1][1] == kuka && poyta[2][0] == kuka) {
return true;
}
return false;
} |
f84fc0b4-0959-41ba-ae8e-755956dddb71 | 3 | public void deleteUserByName(final String name) {
User userToDelete = null;
for (User u : userList.getUserList()) {
if (name.equals(u.getName())) {
userToDelete = u;
}
}
if (userToDelete != null) {
userList.getUserList().remove(userToDe... |
477ff19d-f712-405c-b2fe-ed105f4a9e3e | 8 | public void doLoop() throws IOException {
int nEvents;
processRegistrationQueue();
while (dontStop) {
nEvents = selector.select(timeout);
if (nEvents > 0) {
for (Iterator<SelectionKey> i = selector.selectedKeys()
.iterator(); i.has... |
24c08d87-fc5e-4af6-944e-53db31ed2ff3 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did the attack twice!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
79e0ca91-20ad-41e7-91ee-a04c9050eeb9 | 8 | public String correct(String s) {
if (!s.contains("(")) return s;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '(') {
int fp, ep;
if (s.substring(0, i).contains(",")) {
fp = s.substring(0, i).lastIndexOf(",") + 1;
... |
6bdd291f-f02f-49f7-a8fb-7010781127f5 | 7 | @Override
public int attack(NPC npc, Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
boolean distant = false;
int size = npc.getSize();
Familiar familiar = (Familiar) npc;
boolean usingS... |
62639129-80f3-45b9-b893-453f14488d5a | 9 | public void testPlace() {
while (hitTestPoint(0, 0, width / 2, height / 2)) {
x -= xvel;
y -= yvel;
}
if (hitTestPoint(0, 0, width / 2, 0)) {
place();
}
if (hitTestPoint(0, 0, width, height / 2)) {
place();
}
if (hitTestPoint(0, 0, 0, height / 2)) {
place();
}
if (hitTestPoint(0, 0, wid... |
b1289ac1-96a6-4085-9223-2edf50538f94 | 4 | @Override
public void run()
{
String format = "%d: Translate \"%s\" to %s\n > ";
String question, input, answer;
boolean correct;
Vocab vocab;
while (running)
{
// Send question
question = Vocab.nextQuestion();
vocab = Vocab.getQuestionVocab();
answer = vocab.getAnswer(question);
French.pr... |
556e0c5d-71a5-4082-8e5f-c13f086d91cd | 3 | private String quote(String string) {
if (string == null) {
return null;
}
StringBuilder builder = new StringBuilder();
for (int i = 0; i < string.length(); i++) {
char ch = string.charAt(i);
if (ch == '\'') {
builder.append(ch);
... |
461f7e2b-acb2-421d-beb0-ba101ec84c9d | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LayoutField other = (LayoutField) obj;
if (field == null) {
if (other.field != null)
return false;
} else if (!field.equals(other.field)... |
f9bfd629-33de-4ffd-90b3-73d78257e244 | 1 | public String getValueString(int row, int clums, int sheetat) {
String s = null;
try {
hSheet = hWorkbook.getSheetAt(sheetat);
hRow = hSheet.getRow(row - 1);
hCell = hRow.getCell(clums - 1);
hCell.setCellType(Cell.CELL_TYPE_STRING);
s = hCell.getStringCellValue();
} catch (Exception e) {
}
ret... |
739514d0-9d0e-4049-b765-790be66340cb | 0 | @Test
public void itShouldSerializeWithHole() throws Exception
{
Polygon polygon = new Polygon(MockData.EXTERNAL);
polygon.addInteriorRing(MockData.INTERNAL);
assertEquals("{\"coordinates\":"
+ "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+ "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100... |
e02ebe6b-4f80-4d7f-9064-e51295697310 | 8 | protected int partition(int attIdx, int[] index, int l, int r) {
double pivot = m_Instances.instance(index[(l + r) / 2]).value(attIdx);
int help;
while (l < r) {
while ((m_Instances.instance(index[l]).value(attIdx) < pivot) && (l < r)) {
l++;
}
while ((m_Instances.instance(in... |
b08b1f84-8190-41c0-bd41-bd766c0c16c5 | 8 | @Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = IntCache.getIntCache(par3 * par4);
int dee... |
f380cbf7-4db7-487b-b3a8-3be148146b75 | 2 | @SuppressWarnings("unchecked")
public void stop() {
System.out.println("try to stop");
// threadPool.shutdown();
Vector<BTHandler> clonedHander =(Vector<BTHandler>) this.handler.clone();
for(BTHandler h:clonedHander){
h.stop();
}
active = false;
try {
streamConnectionNotifier.close();
} cat... |
14fcc028-ed97-49c6-b88b-c3cc3ccae7ed | 8 | void loadChunkData(boolean newDataOnly)
throws vslStorageException, vslInputException
{
if (newChunkDataLoaded && newDataOnly) {
vslLog.log(vslLog.WARNING,
"Calling loadChunkData() for new data when the latter already loaded. Doing nothing.");
}
if (id == null) {
vslLog.log(vslLog.ERROR, "Calling l... |
73702f17-4a7f-4ceb-b93a-009f8403af72 | 9 | public void parse(String instruction) {
String[] instArray = instruction.split(" ");
switch (instArray[0]) {
case "JMP":
jmpParser(instArray);
break;
case "BEQ":
alu.beq(instruction);
break;
case "JALR":
jalrParser(instArray);
break;
case "RET":
retParser(instArray);
break;
case "A... |
a3c00686-fb67-4d6f-a4fd-0c439028abdb | 6 | public boolean isAdministrativo(UsuarioDTO u) {
Connection co = null;
PreparedStatement pst = null;
ResultSet rs = null;
String bandera = null;;
String sql = null;
try {
co = EscolarConnectionFactory
.getInstance().getConnection();
sql = "SELECT link_id, usuario, contrasena FROM usuarios where... |
043ad836-4c6b-4335-a06c-45a08571279c | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int times = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line.tri... |
bbb0f3dc-0dc6-4057-abd6-9d33c32c7724 | 3 | @Test
public void testSetThenGet() {
int HEARTBEAT = 30;
List<String> keys = new ArrayList<String>();
List<String> args = Arrays.asList("set", "heartbeat",
String.valueOf(HEARTBEAT));
String scriptResult = "";
try {
scriptResult = (String) _luaScript.callScript("config.lua", keys,
args);
Lis... |
11b66632-02ca-4277-ab4f-07da8a3a9aa5 | 1 | @BeforeTest
public void isSkip()
{
Page.initconfigration();
if(!TestUtil.isExecutable("ImportContactTest",Page.excel)){
throw new SkipException("Skipping the test case as the Run mode is not Y");
}
} |
187ebf9a-bcb3-461c-875b-4f0ea88a1a7e | 3 | @Override
public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException {
if (args[0].toLowerCase().equals("p")) {
game.getPlayer().hidden = false;
} else if (args[0].toLowerCase().equals("t")) {
target.hidden = false;
} else {
Entity e = game.getWorld().getEntity... |
9a1fad0c-d870-4eeb-900c-0cfd345dcdbd | 0 | public MessageTypes getType() { return Type; } |
7a7ff4a9-3078-4a3a-90b5-6f284de7fa29 | 4 | public void toggle(int k){
switch(k){
case KeyEvent.VK_SPACE:
isLightOn = !isLightOn;
break;
case KeyEvent.VK_M:
showPicture = !showPicture;
break;
case KeyEvent.VK_L:
isLinesOn = !isLinesOn;
break;
case KeyEvent.VK_C:
isCursorOn = !isCursorOn;
break;
}
} |
451f05ab-5b0b-415f-8044-3134364f8e9d | 5 | @EventHandler(priority = EventPriority.MONITOR)
public void onSign(SignChangeEvent event){
Player player = event.getPlayer();
String playername = player.getName();
World world = player.getWorld();
Boolean staff = false;
String[] lines = event.getLines();
String worldname = world.getName();
int x = event... |
8522cf56-0e3f-4c90-9c36-62b526ae6a85 | 8 | public Set<java.util.Map.Entry<Long, V>> entrySet() {
return new AbstractSet<java.util.Map.Entry<Long,V>>(){
protected java.util.Map.Entry<Long,V> newEntry(Long k,V v){
return new SimpleEntry<Long,V>(k,v){
public V setValue(V arg0) {
throw new UnsupportedOperationException();
};
}... |
0944da59-2044-45ba-940e-d178e3a8f6aa | 0 | protected String processContents(String contents) {
return StringTools.replace(contents, match, replacement);
} |
94f9ffec-a2e5-4b27-983c-fd7141696185 | 5 | @Override
public MapOutput call() throws FileNotFoundException, IOException{
MapOutput mapResult = new MapOutput(fileName);
String word = "";
Float freq = new Float(0);
for (int i = 0; i < fragment.length(); i++) {
if(fragment.charAt(i) >= 'a' && fragment.charAt(... |
9b461550-ae60-4a5b-8508-ad083a249eb1 | 3 | public static Frame getAnyFrame() {
Frame frame = AppWindow.getTopWindow();
if (frame == null) {
Frame[] frames = Frame.getFrames();
for (Frame element : frames) {
if (element.isDisplayable()) {
return element;
}
}
return getHiddenFrame(true);
}
return frame;
} |
d92aea9d-356e-4ceb-bf62-75e3ac88bb46 | 9 | public static String minWindow(String S, String T) {
int NUM_CHAR = 260;
int[] hasFound = new int[NUM_CHAR];
int[] needToFound = new int[NUM_CHAR];
for(int i = 0; i < NUM_CHAR; i++) {
hasFound[i] = 0;
needToFound[i] = 0;
}
for(int i = 0; i < T.leng... |
b1ebbf4b-bd92-4470-972c-ed81a8e6dee2 | 1 | public void visitCastExpr(final CastExpr expr) {
// ClassCastException
if (expr.castType().isReference()) {
sideEffects |= SideEffectChecker.THROW;
}
expr.visitChildren(this);
} |
7d6f49c5-67df-4da0-a169-1acf9c22e98c | 2 | @Before
public void setUp() {
p = new Player(1);
Tile[][] MapTemplate = new Tile[5][5];
// int TotalTiles = SizeOfMap * SizeOfMap;
// assign grass
for (int j = 0; j < 5; j++) {
for (int k = 0; k < 5; k++) {
MapTemplate[j][k] = new Tile();
}
}
map = SafeMap.getInstance(5);
... |
5fa9bf74-d507-4496-be62-770d37508d24 | 3 | private void cutText(String text){
copyToClipboard(text);
if(activField.equals("textArea")){
}
if(activField.equals("fieldNameFile")){
}
if(activField.equals("fieldCommandLine")){
}
} |
01ae3f0f-309f-4763-8597-17f7a756469b | 8 | @SuppressWarnings("rawtypes")
@Override
public void prepare(Map stormConf, TopologyContext context,
OutputCollector collector) {
super.prepare(stormConf, context, collector);
_topWords = new SpaceSaving<String>(_numWords * 50);
// Setup output writing at a fixed interval.
Timer outputToFileTimer = new... |
b35f62d8-e17e-4c1c-87c3-59852ac82737 | 7 | public GameSpota(String type, String content){
spotArray = new String[10];
spotType = type;
spotContent = content;
if (spotContent!="") changeable = false;
else changeable = true;
spotArray[0]="";
if (spotType.equals("sudoku")){
for (int i=1; i<10; i++){
spotArray[i] = String.valueOf(i);
}
... |
73e84694-3b66-4aa7-ba7c-f52636e47486 | 2 | public void lostfocus() {
if (focusctl && (focused != null)) {
focused.hasfocus = false;
focused.lostfocus();
}
} |
dce8a03d-ad27-4e31-ae5b-37ceb4b80e2d | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Keks other = (Keks) obj;
if (form == null) {
if (other.form != null)
return false;
} else if (!form.equals(other.form))
return false;... |
961c955a-a7ef-4925-aaec-1bee1f3cd475 | 5 | static void fillBoardFromFile (BufferedReader input, char[][] board) throws Exception{
int x = 0;
int y = 0;
//If the line read is not an empty line,
if (input.readLine() != "\n") {
//scan each consecutive character into the sudoku puzzle skeleton
for (y = 0; y < 9; y++) {
for (x = 0; x... |
fbeb01a6-7a3a-447a-ba40-0c4e891f310a | 2 | private static void compileReturn(Bytecode code, CtClass type) {
if (type.isPrimitive()) {
CtPrimitiveType pt = (CtPrimitiveType)type;
if (pt != CtClass.voidType) {
String wrapper = pt.getWrapperName();
code.addCheckcast(wrapper);
code.addI... |
a4c7af0e-230b-4353-b970-da36190ba176 | 1 | private int addPNoise(int pixel, Random random) {
// init:
double L = Math.exp(-noiseFactor * MEAN_FACTOR);
int k = 0;
double p = 1;
do {
k++;
// Generate uniform random number u in [0,1] and let p ? p � u.
p *= random.nextDouble();
} while (p >= L);
double retValue = Math.max((pixel + (k - 1) / ... |
536b0c19-6b51-406f-a337-73f5ad83d219 | 9 | public double pointToObstacle(Polygon polygon, Point2D centre, Point2D front, boolean first) {
int j = 0;
double minDistance = -1.0;
double dist = -1.0;
double px, py;
double x1, y1, x2, y2;
double m1, q1, m2, q2;
// Draws the laserbeam
Line2D.Double beam = new Line2D.Double(centre, front);
// Che... |
a0009a94-9df6-4d57-8580-0d18834ea8de | 1 | public void setEdgeWeight( Vertex<T> v1, double newWeight,
Vertex<T> v2 ) {
if ( newWeight < 0.0 ) {
throw new IllegalArgumentException( "Edge weight "
+ "must be >= 0.0" );
}
int v1Pos = super.getVerticesIndexFor( v1 );
int v2... |
8503b26f-6555-497e-b30c-230498165a2f | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
0400286a-c249-49b1-b331-8a6df22b3c83 | 0 | public BlockManager getBlockManager(){
return blockManager;
} |
0fc048ff-fe6e-4e35-b0a8-0d8cfaa2d49e | 5 | private GameResult checkBoardState() {
boolean hasEmpty = false;
for (int y = 0; y < BOARD_SIZE; y++) {
for (int x = 0; x < BOARD_SIZE; x++) {
if (board[y][x] == GAME_WIN_NUMBER) {
return GameResult.WIN;
}
if (isEmpty(y, x)) {
hasEmpty = true;
}
}
}
return hasEmpty ? GameResult.U... |
1cf6f043-9429-45d7-a90e-d8a59f9176d8 | 8 | private void parseHead(String line) throws PuzzleFormatException,
PuzzleException {
//"puzzle name" puzzleSetName xDimension yDimension
if (preferredDimension != null) {
throw new PuzzleFormatException("The puzzle seems to have two headers.");
}
String xDimension ... |
55a60fbd-b352-4fb8-b89e-13c81436363e | 0 | @AfterClass
public static void testCleanup() {
// Teardown for data used by the unit tests
((AbstractApplicationContext) context).registerShutdownHook();
} |
1635a610-d842-4d92-b52f-a11887e639e1 | 1 | public static void main(String[] args) {
JobClient client = new JobClient();
JobConf conf = new JobConf(WordCountDriver.class);
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(Text.class);
FileInputFormat.setInputPaths(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(... |
bdbfcf2a-f058-4a25-b648-26c0b747d980 | 5 | public ResultSetMapper(Class<T> clazz){
this.clazz = clazz;
methods = clazz.getMethods();
//hashmap to store the setters
setters = new HashMap<String,Method>();
for( int i=methods.length -1; i>= 0; i--){
Column col = methods[i].getAnnotation(Column.class);
Class<?>[] parameters = methods[i].getParame... |
d80bef69-ca69-4a5b-9bdf-66c60eb99e0c | 0 | @Override
public String getGUITreeComponentID() {return this.id;} |
ffba86c9-c052-4dd3-a12b-b0e59e841cd9 | 7 | private void executeCallStack(Stack<IndexPair> call_stack, List<ISection> sections) {
//loop until all instructions have ben executed
while(!call_stack.empty()){
IndexPair curr_pair = call_stack.pop();
int curr_section_idx = curr_pair.getIndex1();
int c... |
7e9f9b26-faa9-4fa4-8148-54804038e984 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if(msg.amITarget(this))
{
final MOB mob=msg.source();
switch(msg.targetMinor())
{
case CMMsg.TYP_DRINK:
if((msg.sourceMessage()==null)&&(msg.othersMessage()==null))
{
drinkIfAble(mob,mob);
mob.tell(L("@x1... |
1023cc32-6bae-4be7-b7f1-359efc5f823d | 0 | private void reset(){
btnStart.setText("Start");
listModel.clear();
cl = new ClockListener();
t.stop();
t = new Timer(10, cl);
btnAdd.setEnabled(false);
txtCountUpTimer.setText(title + appendex);
System.out.println(appendex);
btnReset.setEnabled(false);
} |
f011c433-161a-4f55-ad42-1081003fc5e9 | 5 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Random rand = new Random();
try {
do {
int secret = randomRange(rand, 1, 100);
boolean success = false;
do {
int guess = getGuess(scan, ... |
57b65bb3-a494-41c5-bb1b-57bca3ada930 | 3 | private void tokenize(String s, int fileId) {
StringTokenizer st = new StringTokenizer(s);
String[] tokens = new String[st.countTokens()];
for (int i = 0; i < tokens.length; i++) {
tokens[i] = st.nextToken();
}
int lastIndex = 0;
for (String t : tokens) {
... |
f2c91f9c-23ba-4418-9c28-ac2bc6bc2ca9 | 9 | public Token nextToken() throws ParseException {
if (currentChar == -1) {
return new Token(TokenType.EOF, "");
}
if (isWhitespace(currentChar)) {
if (ignoreWhitespace) {
parseWhitespace();
return nextToken();
} else {
return parseWhitespace();
}
}
for ... |
267be377-5418-4008-a518-d6c4d3515fb1 | 1 | public void createStatesForConversion(Grammar grammar, Automaton automaton) {
initialize();
StatePlacer sp = new StatePlacer();
State initialState = automaton.createState(sp
.getPointForState(automaton));
automaton.setInitialState(initialState);
State intermediateState = automaton.createState(sp
.ge... |
5e799e22-1a3a-4316-bbb7-d62d0f8224ad | 2 | @Override
public void fill(Parameter parameter, Type type, Annotation[] annotations)
{
for (Annotation annotation : annotations)
{
if (annotation instanceof Complete)
{
parameter.offer(Properties.COMPLETER, ((Complete)annotation).value());
... |
58da82a5-942f-4423-b1f0-d56e4a69583d | 4 | public boolean deleteSubForum(User invoker, String subForumId) {
if (!invoker.hasPermission(Permissions.DELETE_SUB_FORUM)) return false;
boolean found = false;
for (int i=0; i<subForums.size() && !found; i++) {
if (subForums.get(i).getId().equals(subForumId)) {
found = true;
subForums.remove(i);
s... |
bd3f4035-86d5-4362-90c9-19ce47ffef1e | 3 | public void setInteiro(TInteiro node)
{
if(this._inteiro_ != null)
{
this._inteiro_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this... |
fcb2b7c9-7380-423f-b401-6a951287974e | 9 | public void rulesView(String fileName) {
Document doc;
String objectPath;
if (browseFolder.isRootFolder()) {
objectPath = browseFolder.getPath() + fileName;
} else {
objectPath = browseFolder.getPath() + "/" + fileName;
}
try {
doc = (D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.