-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting and update some versions
- Loading branch information
1 parent
9c8c5fe
commit 964d732
Showing
326 changed files
with
21,219 additions
and
20,593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 54 additions & 49 deletions
103
command/src/main/java/com/syntaxphoenix/syntaxapi/command/ArgumentRangeSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,61 @@ | ||
package com.syntaxphoenix.syntaxapi.command; | ||
|
||
import com.syntaxphoenix.syntaxapi.command.range.*; | ||
import com.syntaxphoenix.syntaxapi.command.range.CollectionSizeRange; | ||
import com.syntaxphoenix.syntaxapi.command.range.NumberChooseRange; | ||
import com.syntaxphoenix.syntaxapi.command.range.NumberValueRange; | ||
import com.syntaxphoenix.syntaxapi.command.range.StateRange; | ||
import com.syntaxphoenix.syntaxapi.command.range.TextChooseRange; | ||
import com.syntaxphoenix.syntaxapi.command.range.TextSizeRange; | ||
|
||
public abstract class ArgumentRangeSerializer { | ||
|
||
public static final ArgumentRangeSerializer DEFAULT = new DefaultArgumentRangeSerializer(); | ||
|
||
public String toString(BaseArgumentRange range) { | ||
RangeType type = range.getType(); | ||
String output = ""; | ||
switch (type) { | ||
case TEXT_SIZE_RANGE: | ||
output = toString(range.asTextSize()); | ||
break; | ||
case TEXT_CHOOSE_RANGE: | ||
output = toString(range.asTextChoose()); | ||
break; | ||
case STATE_RANGE: | ||
output = toString(range.asState()); | ||
break; | ||
case COLLECTION_SIZE_RANGE: | ||
output = toString(range.asCollectionSize()); | ||
break; | ||
case NUMBER_VALUE_RANGE: | ||
output = toString(range.asNumberValue()); | ||
break; | ||
case NUMBER_CHOOSE_RANGE: | ||
output = toString(range.asNumberChoose()); | ||
break; | ||
case CUSTOM: | ||
output = range.toString(); | ||
break; | ||
} | ||
return output; | ||
} | ||
|
||
public abstract String toString(CollectionSizeRange<?> range); | ||
|
||
public abstract String toString(NumberValueRange range); | ||
|
||
public abstract String toString(NumberChooseRange range); | ||
|
||
public abstract String toString(StateRange range); | ||
|
||
public abstract String toString(TextSizeRange range); | ||
|
||
public abstract String toString(TextChooseRange range); | ||
|
||
/** | ||
* @param ranges array of complex ranges | ||
* @return array of raw ranges | ||
*/ | ||
public abstract String[] asStringArray(BaseArgumentRange... ranges); | ||
public static final ArgumentRangeSerializer DEFAULT = new DefaultArgumentRangeSerializer(); | ||
|
||
public String toString(BaseArgumentRange range) { | ||
RangeType type = range.getType(); | ||
String output = ""; | ||
switch (type) { | ||
case TEXT_SIZE_RANGE: | ||
output = toString(range.asTextSize()); | ||
break; | ||
case TEXT_CHOOSE_RANGE: | ||
output = toString(range.asTextChoose()); | ||
break; | ||
case STATE_RANGE: | ||
output = toString(range.asState()); | ||
break; | ||
case COLLECTION_SIZE_RANGE: | ||
output = toString(range.asCollectionSize()); | ||
break; | ||
case NUMBER_VALUE_RANGE: | ||
output = toString(range.asNumberValue()); | ||
break; | ||
case NUMBER_CHOOSE_RANGE: | ||
output = toString(range.asNumberChoose()); | ||
break; | ||
case CUSTOM: | ||
output = range.toString(); | ||
break; | ||
} | ||
return output; | ||
} | ||
|
||
public abstract String toString(CollectionSizeRange<?> range); | ||
|
||
public abstract String toString(NumberValueRange range); | ||
|
||
public abstract String toString(NumberChooseRange range); | ||
|
||
public abstract String toString(StateRange range); | ||
|
||
public abstract String toString(TextSizeRange range); | ||
|
||
public abstract String toString(TextChooseRange range); | ||
|
||
/** | ||
* @param ranges array of complex ranges | ||
* @return array of raw ranges | ||
*/ | ||
public abstract String[] asStringArray(BaseArgumentRange... ranges); | ||
|
||
} |
Oops, something went wrong.