method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f337c046-c872-4477-bc94-f5a49a3489eb | 3 | public final static void main( String[] args )
{
if( args.length < 3 ){
usage("Not enough arguments.");
} // end if: args.length < 3
else {
String flag = args[0];
String infile = args[1];
String outfile = args[2];
if( flag.equals(... |
eb299362-65ca-4580-a496-6959ddbf9a0e | 3 | public static synchronized ICodec getCodec( String filename )
{
if( codecs == null )
return null;
ListIterator<Codec> i = codecs.listIterator();
Codec codec;
while( i.hasNext() )
{
codec = i.next();
if( filename.matches( codec.extensionRe... |
28201405-8da7-49c9-bd41-5b853ddd691a | 0 | public int getY(){
return ul.getY();
} |
f9e262c4-c1e6-4938-9931-7e3566aed0f1 | 7 | public static boolean aSubsumesB(RuleItem a, RuleItem b){
if(!a.consequence().equals(b.consequence()))
return false;
if(a.accuracy() < b.accuracy())
return false;
for(int k = 0; k < ((a.premise()).items()).length;k++){
if((a.premise()).itemAt(k) != (b.premise()).itemAt(k)){
if(((a.premis... |
a577991e-1ff6-4f44-b8dc-0fdf9421f3ba | 9 | public void animateGraph(int start, int end, float interpolation){
ArrayList<Integer>edges = new ArrayList<Integer>();
ArrayList<Integer>edgesToHighlight = new ArrayList<Integer>();
for (int i=0;i<this.aggregatedNodes.size();i++){
edges=this.nodes.get(this.aggregatedNodes.get(i)).incidentEdges;... |
6ff1118d-8c0c-4798-8f95-75d0be762879 | 4 | private void preCheck() throws DynmapInitException {
/**
* The Dynmap must contain:
* standalone/dynmap_config.json
*/
try {
dynmapConfigFile = getFile("standalone/dynmap_config.json");
} catch (IOException e) {
throw new DynmapInitException(e);... |
3345373c-3b95-4ae3-b011-c355a18f0239 | 4 | public void align() {
if(endian==BIG_ENDIAN && bitIndex>=0) {
bitIndex=7;
byteIndex++;
}
else if(endian==LITTLE_ENDIAN && bitIndex<=7) {
bitIndex=0;
byteIndex++;
}
} |
8c35015a-5f05-476c-9def-42f154162014 | 5 | @Override
public Grid createGrid() throws GridFactoryException{
FileInputStream fstream;
try {
fstream = new FileInputStream(filename);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
Stri... |
a518889d-af52-440c-88f5-ff8fe51d6ada | 7 | public final void and_test() throws RecognitionException {
try {
// Python.g:295:10: ( not_test ( AND not_test )* )
// Python.g:295:12: not_test ( AND not_test )*
{
pushFollow(FOLLOW_not_test_in_and_test2387);
not_test();
state._fsp--;
if (state.failed) return;
// Python.g:295:21: ( AND not_te... |
46bc8059-932e-43a9-8fb7-d6c3913670b6 | 6 | public static int scorePath(AIUnit aiUnit, PathNode path) {
Location loc;
if (path == null
|| !((loc = extractTarget(aiUnit, path)) instanceof Tile))
return Integer.MIN_VALUE;
final Tile tile = (Tile)loc;
final Player player = aiUnit.getUnit().getOwner();
... |
5844ad8d-c26e-4489-bfe2-12b92a601ec9 | 5 | public void drawMob(Graphics g) {
if (finalx + Engine.cam.x >= 0 - finalw) {
if (finalx + Engine.cam.x <= def.Frame.WIDTH) {
if (finaly + Engine.cam.y >= 0 - finalh) {
if (finaly + Engine.cam.y <= def.Frame.HEIGHT) {
g.drawImage(IMG_TO_DRAW, finalx + Engine.cam.x, finaly
+ Engine.cam.y, fina... |
cd03dd0c-fdfd-4c99-9897-dd85fa2c7825 | 1 | public void clear() {
for (int i = 0; i < pixels.length; i++) {
pixels[i] = 0; // sets screen to black
}
} |
6ca8a78b-95d7-42cf-9bf1-21b93de0d936 | 3 | protected void renderTable() {
parent.clearChildren();
String[] header = model.getHeaders();
TR headrs = new TR();
for(int i = 0; i < header.length; i++) {
TH td = new TH(header[i]);
headrs.addObject(td);
}
addObject(headrs);
String[][] data = model.getData();
for(int i = 0; i < data.length; i++) ... |
4c65551e-fadb-4e81-819e-2496eafcdc41 | 5 | public void update(GameContainer container, StateBasedGame game, int g)
throws SlickException {
PistolCaveGame PC = (PistolCaveGame) game;
Input input = container.getInput();
//detect click of the connect button
if(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)
&& input.getAbsoluteMouseX() <= connec... |
66ffe7e4-3f05-4d48-8578-e7a0abd0cc96 | 5 | public void unlockFile(URI uri, String lockToken) throws IOException {
if (lockToken == null || lockToken.isEmpty()) {
return;
}
String url = decodeURI(uri);
UnLockMethod unlockMethod = new UnLockMethod(url, lockToken);
client.executeMethod(unlockMethod);
if (unlockMethod.getStatusCode() !... |
705f09f1-6604-4f11-a24a-d0a73e26e124 | 5 | protected static Ptg calcType( Ptg[] operands )
{
if( operands[0] instanceof PtgArray )
{
return new PtgNumber( 64 ); // avoid value calc for arrays
}
if( operands[0] instanceof PtgErr )
{
return new PtgNumber( 16 );
}
// otherwise, test value of operand
Object value = operands[0].getValue();... |
e605af21-e8e0-46f4-95ba-307f63a5b2a2 | 2 | private boolean jj_3R_92() {
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_15()) { jj_scanpos = xsp; break; }
}
return false;
} |
5d16a434-81b3-41fe-bac9-03d999fac108 | 6 | private static void printInternal(int[][] matrix, int index, int length) {
if(length <= 0) {
return;
}
if(length == 1) {
System.out.print(matrix[index][index]);
return;
}
for(int i = index; i < index + length - 1; i++) {
System.out.... |
0e2f6e04-60c7-40f4-a498-4d1c3413fa74 | 7 | private int[] removePedinaMangiata(int y, int x, int nextY, int nextX) {
int[] posPieceEat = new int[3];
if (y > nextY) {// sta salendo
if (x < nextX) {//sta andando verso destra
if (campo[y - 1][x + 1] instanceof Pedina) {
posPieceEat[2] = 0;
... |
19e7f95c-c097-4490-b4e1-b368cda534ed | 2 | public Cheeser(TileMap tm) {
super(tm);
moveSpeed = 0.7;
maxSpeed = 0.7;
fallSpeed = 0.2;
maxFallSpeed = 10.0;
width = 30;
height = 30;
cwidth = 20;
cheight = 20;
health = maxHealth = 20;
damage = 0;
try {
BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/E... |
0dd65b9c-c5ea-4087-b362-2a05a11fe496 | 8 | private void GenerateFileList()
{
//ClientFolderPath = Utils.getWorkingDirectory() + File.separator + GlobalVar.itemsServers[GlobalVar.CurrentServer] + File.separator;
ClientFolderPath = Utils.GetCurrentClientDir() + File.separator + ".minecraft" + File.separator;
File dir = new File(ClientFolderPath);... |
a75cf1c1-d45d-4f6b-9d9d-96b188dfb414 | 8 | public static void Chain(Set<Route> routes, Route route, SootMethod start, SootMethod last)
{
//if no path found..ie exit statement encountered!
if(start==null)
return;
if(graph.getTails().contains(start)){
return;
}
//List l = graph.getTails();
if (st... |
ec8a7bb4-dd1d-46d3-9268-e7ee14e7e17c | 8 | public Item getPossibility(MOB mobTarget)
{
if(mobTarget!=null)
{
final Vector<Item> goodPossibilities=new Vector<Item>();
final Vector<Item> possibilities=new Vector<Item>();
for(int i=0;i<mobTarget.numItems();i++)
{
final Item item=mobTarget.getItem(i);
if((item!=null)
&&((item.materia... |
51b0f7ea-50f4-4d9a-a91a-bb3dd1f2c864 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
3b6f277d-7261-474c-abd0-1fce3753432d | 4 | public static void saveRentalMeetingRoom(int rentId, int prodId, String type){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
conn.s... |
ddaf9e88-e11b-4730-9431-675377283672 | 3 | public int[] countSort(int[] tmpArray, int[] tmpRems){
// the c[] is defined by the maximum number among tmpArray
int[] count = new int[10];
int[] sortArray = new int[tmpArray.length];
// count
for(int i=0; i<tmpRems.length; i++){
count[tmpRems[i]]+=1;
}
// accumulate
for(int i=0; i<count.length-1; i... |
c7293908-4fe5-49d1-8cd8-fd484a04cbe5 | 0 | public Producto getProducto() {
return producto;
} |
919d2fbc-89d7-4c81-9c3f-6bcf1623e036 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
9b532f9f-f776-4ed8-acdc-e080622699cd | 4 | private static int getFontStyle() {
int fontStyle;
if(boldBox.isSelected() && italicBox.isSelected()) {
fontStyle = Font.BOLD + Font.ITALIC;
}
else if(boldBox.isSelected()) {
fontStyle = Font.BOLD;
}
else if(italicBox.isSelected()) {
fo... |
a7043a36-e426-45e7-b9cf-8ea8e792ba1d | 0 | public int getMapWidth() {
return this.map[0].length;
} |
b57178db-a877-40b9-a609-3714b565c315 | 6 | @Override
public boolean satisfiesParameters(GetParameter params)
{
/* Check that owner id matches */
if ((params.getOwnerId() != null) && (!params.getOwnerId().equals(this.ownerId)))
{
return false;
}
/* Check that type matches */
if ((params.getType... |
19d7fe56-ee45-4bb5-9c74-822806ed86b8 | 7 | public static ContactAcctDetails getContactAccDetails(Contact contact,int index){
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("getContactAccDetails - addressBook returns null");
return null;
}
for(int i=0;i<ad... |
5005efa8-c54d-47d8-9380-5f25716e29b8 | 3 | private void validateHouses() {
//go through each house
for(int i = 0; i < houseList.size(); i++)
{
//set zombie positions
if(!houseList.get(i).setZombiePositions())
{
errorFlag = 1;
errorString = "Couldn't place 'zombie' in house " + i + ".";
return;
}
if(!houseList.get(i).setPlayer... |
1482ab4c-26a4-4d1d-8dd0-2e52968fe2da | 0 | private static void printMenu() {
System.out.println("What will you like to have?");
System.out.println(" 1. Coffee");
System.out.println(" 2. Tea");
System.out.println(" 3. Lemonade");
} |
1df6ca19-51ba-48fa-8600-8747dd8a42fa | 1 | public static double err_sum(double[] obs, double[] sim) {
double volError = 0;
for (int i = 0; i < sim.length; i++) {
volError += (sim[i] - obs[i]);
}
return volError;
} |
482e1dbd-66b3-46d6-9bab-efdee6cd51ca | 0 | public TMTransitionCreator(AutomatonPane parent) {
super(parent);
machine = (TuringMachine) parent.getDrawer().getAutomaton();
} |
c2a88d12-ad9b-4db3-ad36-a2aaebf5aa0b | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
3cbbfcc5-a2c2-4a5e-abf2-77b4ea3d379f | 7 | public State[] getNondeterministicStates(Automaton automaton) {
LambdaTransitionChecker lc = LambdaCheckerFactory
.getLambdaChecker(automaton);
ArrayList list = new ArrayList();
/* Get all states in automaton. */
State[] states = automaton.getStates();
/* Check each state for nondeterminism. */
for (int... |
e8b93a8a-7893-4a5d-9f1d-bb8768fd183e | 9 | private void printTypeInfo(int tag, int data) {
String msg = null;
switch (tag) {
case TOP :
msg = "top";
break;
case INTEGER :
msg = "integer";
break;
case FLOAT :
msg = "float";
... |
be9af1ea-83db-4c51-b2a1-77dd41cab50a | 5 | public Brick8(int gameAreaStartX, int gameAreaStartY, int brickSize, int brickIndex, BufferedImage brickImage)
{
super(brickSize, brickIndex, brickImage);
switch(brickIndex)
{
case 1:
this.row = 0;
this.column = 10;
this.relativeRow ... |
e75dd640-6317-4b70-8eb1-c4b926c2a1f5 | 7 | public boolean canConvert(VariableType b){
if(this.equals(b)) return true;
if(this.equals(VariableType.STRING_LENGTH1)) {
if(b.equals(VariableType.CHAR)) return true;
if(b.equals(VariableType.CHAR_ARRAY)) return true;
}
if(b.equals(VariableType.STRING_LENGTH1)) {
if(this.equals(VariableType.CHAR)) ret... |
d5741199-49ac-46c0-95dc-8b9b250d412b | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
ddf00cf8-bd09-4b64-8422-c9f80f4d301c | 7 | private void setRelated(Screen s){
//System.out.println("setReslated()");
FsNode node = (FsNode) s.getProperty("mediaNode");
String topic = node.getProperty(FieldMappings.getSystemFieldName("topic"));
if(topic != null){
String uri = "/domain/euscreenxl/user/*/*";
FSList fslist = FSListManager.get(ur... |
a797bb11-b414-4323-9aad-06aa1416c760 | 0 | public String getEmail2() {
return email2;
} |
b093334f-3120-4c72-864c-d376846c0339 | 6 | public void validate() throws MappingNotCorrect {
if(_id == null || StudentName == null || collection == null || qid == null || qSeq == null || optSeq == null) throw new MappingNotCorrect();
} |
f73df9c0-fa19-42ca-81bb-7a5468d263d8 | 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 AreaConhecimento)) {
return false;
}
AreaConhecimento other = (AreaConhecimento) object;
if ((this.id == null &... |
81637b6e-6123-4c46-b4d8-85bfc7b4e29f | 2 | @Override
public String toString() {
String itemSetContents = "";
int num = this.itemSet.size();
for (int i = 0; i < this.itemSet.size(); i++) {
itemSetContents = itemSetContents + this.itemSet.get(i).toString();
if (i < num - 1) {
itemSetContents = itemSetContents + ",";
}
}
return "{" + itemS... |
a17ca7bb-df3e-4704-8585-7c639f6613c1 | 9 | private static void addTagsFromClass(Class<?> clazz, Object clazzInstance)
{
final Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (Modifier.isStatic(field.getModifiers())) {
continue;
}
if (!field.isAnnotationPresent(T... |
7ae390e1-041d-4d83-bafb-d41bcd5b6a6b | 5 | public User(String nick, InetAddress address, int port) throws GameException, IOException {
if (nick == null || nick.equals("")) throw new GameException(4);
if (address == null) throw new GameException(5);
if (port > 65535 || port < 1024) throw new GameException(6);
this.nick = nick;
... |
4b50d3aa-6169-4914-8ceb-c780c3d74421 | 8 | public static void main(String args[]){
int op = 0;
do{
try {
System.out.println("1- Agregar Cliente");
System.out.println("2- Generar Revision");
System.out.println("3- Actualizar Monto");
System.out.println("... |
c534aa9c-7ab4-4ada-9a16-36cb7f09b12a | 6 | final void write(byte[] src, int off, int len)
throws IOException {
anInt2655++;
if (!isPaused) {
if (caughIoex) {
caughIoex = false;
throw new IOException();
}
if (aByteArray2663 == null)
aByteArray2663 = new byte[bufferSize];
synchronized (this) {
for (int i_7_ = 0; (len ^ 0xffff... |
e04bdbc2-784d-4d89-ac08-2eaca3712506 | 3 | public void createEnemy(long birth, long life, int pattern[], float offset[], int weapon, int design) {
for(int i = 0; i < enemies.length; i++) {
try {
if(enemies[i].living == false) {
enemies[i] = new Enemy(birth,life,pattern,offset,weapon,design);
break;
}
}
c... |
4ddd5c6e-a732-4b49-a826-f1977b1c78c5 | 7 | private Point2D constructNode(RootedTree tree, Node node,
double angleStart, double angleFinish, double xPosition,
double yPosition, double length,
TreeLayoutCache cache) throws Graph.NoEdgeException {
final d... |
a342888d-894e-4732-8123-f5fbea6b7bea | 5 | public void fadeOutIn(FilenameURL filenameURL, long milisOut, long milisIn) {
if (!toStream) {
errorMessage("Method 'fadeOutIn' may only be used for "
+ "streaming and MIDI sources.");
return;
}
if (filenameURL == null) {
errorMessage("Filename/URL not specified in method 'fadeOutIn'.");
return;
... |
4fc21cf1-ba6d-4343-8d30-ed44af80a850 | 1 | public static void setPropertyDefaultAsInt(PropertyContainer container, String key, int default_value) {
if (container != null) {
container.setPropertyDefault(key, new Integer(default_value));
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} |
20ddd98e-9501-4797-bee9-7a89abca319f | 8 | public void setQualitySettings(int settings){
switch(settings){
case QUALITY_LOW:
edfMethod = ExtendedDepthOfField.SOBEL;
reassignment = false;
break;
case QUALITY_LM:
edfMethod = ExtendedDepthOfField.VARIANCE;
varWindowSize = 5;
reassignment = false;
break;
case QUALITY_MEDIUM:
edfMeth... |
8fe464c8-6bd9-4c1b-bac9-f38587a8e9ad | 4 | public void removeRequiredCourseFromDegree(int degreeId, int courseId) {
if(!isValidId(degreeId) || !isValidId(courseId)) {
return;
}
Course course = courseDao.getCourse(courseId);
Degree degree = degreeDao.getDegree(degreeId);
if(course != null && degree != null) {
degree.getRequiredCourses().rem... |
ecb2bb4e-6482-4043-9c6e-4ad9182550d8 | 6 | void fillDistancesPrices() {
for (int i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++) {
int posSlot = getPosSlot(i);
int footerBits = (posSlot >> 1) - 1;
int baseVal = ((2 | (posSlot & 1)) << footerBits);
tempPrices[i] = BitTreeEncoder.reverseGetPri... |
c503d90a-e614-458f-a276-6d2135391f1e | 1 | private void addToListAll(List<Download> downloadList) {
for (Download download : downloadList) {
downloads.put(download.getGid(), download);
}
eventBus.fire(new DownloadsUpdatedEvent(getDownloadsListFiltered()));
} |
edb04e59-b153-4114-8c96-799c500ef138 | 0 | public void setYWidth(double height)
{
this.height=height;
} |
f2023821-9763-4ae3-b0b4-932107ca2989 | 4 | @Override
public void excute() throws RserveException, REXPMismatchException, ParseException, Exception {
try{
REXP x;
c.eval("rsiTest <- rsiTesting(TestData, Bests,Bestl,plotUrl)");
boolean checkBuysell = "NA".equals(c.eval("rsiTest$buysell[1,3]").asString());
... |
74882062-80fa-488d-b2aa-aed21b887237 | 1 | public void testWithFieldAdded_DurationFieldType_int_2() {
LocalDateTime test = new LocalDateTime(2004, 6, 9, 10, 20, 30, 40);
try {
test.withFieldAdded(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
} |
6108e6e9-a2a9-4944-9925-ce32dc089d18 | 4 | @Override
public Transfer createDefaultTransfer() throws TransferException {
// 尝试建立Sipc-proxy连接
Transfer transfer = null;
String sipcProxy = this.fetionContext.getLocaleSetting().getNodeText(
"/config/servers/sipc-proxy");
String sipcSslProxy = this.fetionContext.getLocaleSetting().getNodeText(
"/conf... |
48131a9d-eaf9-47cf-b39c-efbfb343f759 | 7 | private boolean validateAFNEExpression(String expression) throws Exception {
errorMessage = "";
List<String> currentStates = new ArrayList<String>();
currentStates.add(content.getInitial());
currentStates = clousereFunctionByStateValues(currentStates);
for(int i=0; i<exp... |
a834e62f-acdf-48d2-a81a-72e265c6ba89 | 9 | private PhraseType asPtype(String s) {
if (s.startsWith("NP"))
return NounPhrase;
else if (s.startsWith("VP"))
return VerbPhrase;
else if (s.startsWith("ADVP"))
return AdverbPhrase;
else if (s.startsWith("ADJP"))
return AdjectivePhrase;
else if (s.startsWith("PP"))
retur... |
594ce079-7db5-4177-b461-dc38cb02be32 | 1 | public static void main(String[] args) throws Throwable {
if (args.length >= 3) {
Viewer cl = new Viewer(args[0], Integer.parseInt(args[1]));
String[] args2 = new String[args.length - 3];
System.arraycopy(args, 3, args2, 0, args.length - 3);
cl.run(args[2], args2)... |
4d521a32-481e-4a3e-b516-b02357e789d0 | 4 | private void preencherTabela() {
String[] propriedades = {"Id", "Nome", "Usuario", "Cpf", "Endereço","Carga Horaria", "Salario" };
FuncionarioDAO dao = new FuncionarioDAO();
List<Funcionario> funcionarios = dao.list();
String[][] matriz = new String[funcionarios.size()][7];
for (... |
1720d6aa-eba3-469f-b7e8-8c35e3995f15 | 9 | @Override
public void postProcess(ColorOutput colorOutput, FeatureList featureList) {
float delta;
float gain;
float input;
// Currently not active. Should it became active?
if (((Double) featureList.getFeature("KEY_BACKSPACE")) == 1.0) {
// ACTIVATE!
input = -1.0f;
gain = fallKnob.getValue();... |
568e6619-576c-44e5-99ea-4c76623b7d61 | 0 | public static void main(String[] args) {
Object o = new Object();
System.out.println(o);
Object veryLongVar = new Object();
foo(veryLongVar);
Container c = new Container();
c.setBAsString("dt");
} |
43f898cf-39bb-48fc-9b51-f9d82b175e3a | 2 | public static GeneralPath getTorn(float x, float y, float width,
float height, boolean left, boolean right) {
GeneralPath path = new GeneralPath();
path.moveTo(x, y);
path.lineTo(x + width, y);
if (right) {
path.quadTo(x + width - height / 4.0f, y + height / 4.0f,
x + width, y + height / 2.0f);
pa... |
23277a8a-7e0e-4cc1-a2e6-255b04028549 | 6 | public void upgradeBackpack()
{
if (this.game.chestOpen && this.capacity > 1 && this.chestWood >= 5)
{
// upgrade backpack 2
this.capacity = 15;
this.chestWood -= 5;
this.chestWood -= 3;
}
if (this.game.chestOpen && this.capacity == 1 && this.chestWood >= 5)
{
// upgrade backpack
this.capa... |
7dc639b9-91d1-4111-8f27-a3893de6437a | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
int params = split.length;
String player = ((Player) sender).getName();
if (params == 0) {
return false;
} else if (params == 1) {
return false;
} else if (params == 2) {
if (split[0].equals("p... |
146c2342-ffc5-4665-81c2-ac3364176338 | 1 | private void addFace(ArrayList<Integer> indices, int startLocation, boolean direction)
{
if(direction)
{
indices.add(startLocation + 2);
indices.add(startLocation + 1);
indices.add(startLocation + 0);
indices.add(startLocation + 3);
indices.add(startLocation + 2);
indices.add(startLocation + 0);
... |
1004d464-d10a-4d93-98a0-352c4393362a | 1 | public String getDurationBreakdown() {
long millis = timeEnd - System.currentTimeMillis();
// If can't submit, then contest isn't running
if (!canSubmit()) {
return "00:00";
}
long hours = TimeUnit.MILLISECONDS.toHours(millis);
millis -= TimeUnit.HOURS.toMillis(hours);
long minutes = TimeUnit.MILLISE... |
b77b65d7-de63-4a3c-a2c6-0c4ff7d6e5ca | 4 | public int getequalISBN(int newISBN) throws Exception{
try{
@SuppressWarnings("resource")
ObjectInputStream osi = new ObjectInputStream(new FileInputStream("bookcollection.txt"));///óϾ , Ͼ׳ϴ° ҽ߰
this.setBookCount(osi.readInt());
collectionb.clear();
for( int i= 0; i< this.getBookCount();i++){
Book... |
3fd324be-6d4d-428b-a5d1-e35dac7f3a72 | 9 | public static byte[] downHTTP(String inURL, String PostData, String iCookie) {
byte[] buf = null;
try {
URL url = new URL(inURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if ("GET" != PostData) {
// System.out.println("I am Posti... |
53cb1438-c74f-4ce8-9e22-66b759549d0c | 0 | public int GetRecentBus()
{
return recentBus;
} |
2a62cac4-e3b9-443b-9208-4c41af44df63 | 5 | private int writeMemberRef(Member member, int entry)
throws java.io.IOException {
if (Debug.enabled)
Debug.check((entry==10)||(entry==9)||(entry==11));
// CONSTANT_Fieldref = 9; CONSTANT_Methodref = 10;
// CONSTANT_InterfaceMethodref = 11;
int name_ind=getUTFIndex((member instanceof ... |
392f0853-4fa0-4bb4-91e5-73573ab36191 | 0 | @Override
public void up()
{
System.out.println("Lighter UP!");
} |
9164893f-23ea-4a2f-a0e8-b404f6119f1d | 2 | public void compileShader(){
glLinkProgram(program);
if (glGetProgrami(program, GL_LINK_STATUS) == 0){
System.err.println(glGetProgramInfoLog(program,1024));
System.exit(1);
}
glValidateProgram(program);
if (glGetProgrami(program, GL_VALIDATE_STATUS) ==... |
32e17e12-577b-4160-95c1-bcb3df8a3cfd | 0 | @Test
public void testSensedCell() throws IOException {
System.out.println("sensedCell");
Cell instance = new Cell(2,2);
int[] pos = new int[2];
pos[0] = 2;
pos[1] = 2;
int dir = 0;
Sense.senseDir sD = Sense.dirFromString("here");
int[] result = instan... |
62896c32-2eaf-4baa-956f-5c29cc049353 | 0 | public void setEspecial(boolean especial) {
this.especial = especial;
} |
e3127b60-f278-4c40-81e3-effb7376ec72 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the... |
a7f7dba7-2243-40da-b73e-1b9f9fd7baa0 | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
* The difference between this impl. and the previous is that, rather
* than creating and retaining a matrix of size s.length()+1 by
* t.len... |
8609bb09-3d20-4c9f-ad51-528f30d55c69 | 9 | public ArrayList<Article> getUnpublishedArticle(int authorID) throws SQLException {
ConnectionManager conn=null;
ArrayList<Integer> intArtID = new ArrayList<Integer>();
ArrayList<Integer> finalselectedArticleID = new ArrayList<Integer>();
ArrayList<Article> unpubArticle = new ArrayList<Article>();
String que... |
22aad992-be43-49a6-8267-e1b4e4ed4b54 | 7 | public boolean execQuery(String command) throws SQLException
{
boolean value = false;
Connection connection = null;
Statement statement = null;
ResultSet result = null;
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, passwd);
statement = connection.createStat... |
b8f7764b-4199-468e-8e9f-cb8bb00cecd4 | 1 | public DAO() throws DAOPoikkeus {
try {
Class.forName(DBConnectionProperties.getInstance().getProperty("driver")).newInstance();
} catch(Exception e) {
throw new DAOPoikkeus("Tietokannan ajurin lataaminen epäonnistui.", e);
}
} |
e909caae-dc50-43e7-8aa7-90ec904b65fa | 4 | public CycList<E> deepCopy() {
final CycList cycList = new CycList<E>();
if (!this.isProperList()) {
if (this.dottedElement instanceof CycList) {
cycList.setDottedElement(((CycList) this.dottedElement).deepCopy());
} else {
cycList.setDottedElement(this.getDottedElement());
}
... |
bc41abf2-cba0-4a35-b5f8-9c3f09e38b74 | 0 | public ImagePlus getAdjusted(){
return adjImg;
} |
e00c4c85-cab7-49d4-91ba-8df75821bd8b | 8 | private static String solve(int M, int N, char[][] a) {
int[] S = find(a, M, N, 'S');
int[] G = find(a, M, N, 'G');
a[S[0]][S[1]] = a[G[0]][G[1]] = '.';
char[][][] maze = new char[4][M][N];
createMaze(maze, a, M, N, 0); // maze of phase 0
createMaze(maze... |
a70bd010-034b-41ba-83af-3a54ba9c7852 | 8 | private ArrayList<Posicion> posicionesRadioUno(Posicion posicion){
ArrayList<Posicion> posiciones = new ArrayList<Posicion>();
Posicion pos = posicion.getSiguiente(1);
if(posicionValida(pos))
posiciones.add(pos);
pos = posicion.getSiguiente(5);
if(posicionValida(pos))
posiciones.add(pos);
pos = posici... |
949ed941-5096-4ab3-8019-2bf4463a057e | 1 | public void updatePlayers(ArrayList<Player> players, Dealer dealer, int numPlayers){
for (int i=0;i<numPlayers;i++)
{
players.get(i).runLogic();
}
dealer.runLogic();
} |
f339b0de-b92c-4baf-8607-f429c1922589 | 8 | public static int[][] trimWhiteColumns(int[][] seg){
boolean blackFlag = false;
int noOfRows = seg.length;
int noOfColumns = seg[0].length;
ArrayList<Integer> emptyCols = new ArrayList<>();
int[][] segment = null;
// find a column with no foreground pixel.
for(int i = 0; i<noOfColumns; i++){
bla... |
6876c8e7-0c6e-4794-a829-9fd951b65026 | 5 | public void addConstZero(CtClass type) {
if (type.isPrimitive()) {
if (type == CtClass.longType)
addOpcode(LCONST_0);
else if (type == CtClass.floatType)
addOpcode(FCONST_0);
else if (type == CtClass.doubleType)
addOpcode(DCONST... |
40763dfd-bf2b-4243-a446-810c71ad2fd8 | 9 | @Override
public synchronized void handlePacket(Packet packet) {
logger.debug("Handling " + packet);
if (packet.getGroup().equals(PacketGroup.COMMAND)) {
logger.debug("CMD packet found - adding to sender buffer");
this.getPortSender().addToBuffer(packet);
} else if (packet.getGroup().equals(Packe... |
27eb81ff-288b-4dca-9f6c-2b99eb033557 | 5 | public void handleRemoveMachineButton() {
if((loadView.getFileList().getSelectedIndex() >=0) && (loadView.getFileList().getSelectedValue() != null)){
String machine = (String)loadView.getFileList().getSelectedValue();
int result = JOptionPane.showConfirmDialog(mainWindow,"Sure you want to remove ".conc... |
eedb450a-8cb2-4345-bbd5-cacc09acba94 | 9 | public int nextInt() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
int result;
if (p == PEEKED_LONG) {
result = (int) peekedLong;
if (peekedLong != result) { // Make sure no precision was lost casting to 'int'.
throw new NumberFormatException... |
9afa029e-8a75-42ec-b3cd-118657de24fe | 5 | int unpack(Buffer opb) {
int vendorlen = opb.read(32);
if (vendorlen < 0) {
clear();
return (-1);
}
vendor = new byte[vendorlen + 1];
opb.read(vendor, vendorlen);
comments = opb.read(32);
if (comments < 0) {
clear();
... |
7a010c3b-669c-4c46-a952-204092fb133f | 6 | public static boolean checkIsGround(int x, int y, int z) {
if ( (x == -1) || (y == -1) || (z == -1) || (x == dimX) || (y == dimY) || (z == dimZ) )
return true;
return false;
} |
464226fb-611b-41cc-8d18-864be4e2ff0b | 9 | public Set<Light> updateLights(int[][] board) {
Random r = new Random();
int count = 0;
for (Light l : lights) {
MoveableLight ml = (MoveableLight)l;
if (l.getX() == lastLight.x && l.getY() == lastLight.y) {
if (r.nextInt(2) == 0) ml.turnOff(); else ml.turnOn();
continue;
}
// ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.